-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 42c534f
Showing
19 changed files
with
3,998 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = tab | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
name: Bug report | ||
about: Create a report to help us improve | ||
labels: 'bug: pending triage' | ||
--- | ||
|
||
## Bug description | ||
<!-- | ||
What did you do? (Provide code in next section) | ||
What did you expect to happen? | ||
What happened instead? | ||
Do you have an error stack-trace? | ||
--> | ||
|
||
## Reproduction | ||
<!-- | ||
Provide one of the following: | ||
1. A code-snippet that reproduces the issue | ||
2. A reproduction repo that reproduces the issue | ||
3. A PR with a failing test-case | ||
Remove irrelevant code to make it easier for others to read and debug. | ||
-- Why? | ||
The goal is to maximize communication efficiency. | ||
When an issue is immediately reproducible, others can start debugging instead of following-up with questions. | ||
--> | ||
|
||
## Environment | ||
|
||
- snap-tweet version: | ||
- Operating System: | ||
- Node version: | ||
- Package manager (npm/yarn/pnpm) and version: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea for this project | ||
labels: 'feature request' | ||
--- | ||
|
||
## Is your feature request related to a problem? | ||
<!-- | ||
What's the motivation behind this issue? | ||
Eg. I'm frustrated when... | ||
--> | ||
|
||
## Describe the solution you'd like | ||
<!-- | ||
What kind of solution would you like to see? | ||
What makes it a good solution? | ||
--> | ||
|
||
## Describe alternatives you've considered | ||
<!-- | ||
What else did you try? | ||
Do you have a work around? | ||
--> | ||
|
||
## Additional context | ||
<!-- | ||
Anything else to share? | ||
Screenshots? Links? | ||
--> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: master | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 14.x | ||
- name: Install dependencies | ||
run: npx ci | ||
- name: Build | ||
run: npm run build | ||
- name: Lint | ||
run: npm run lint | ||
- name: Test | ||
run: npm run test --if-present | ||
- name: Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
run: npx semantic-release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: [develop] | ||
pull_request: | ||
branches: [master, develop] | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [12.x, 14.x] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Install dependencies | ||
run: npx ci | ||
- name: Build | ||
run: npm run build | ||
- name: Lint | ||
run: npm run lint | ||
- name: Test | ||
run: npm run test --if-present |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# macOS | ||
.DS_Store | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Dependency directories | ||
node_modules/ | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# VSCode | ||
.vscode | ||
|
||
# Distribution | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v12.19.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) Hiroki Osame <hiroki.osame@gmail.com> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# 📸 snap-tweet | ||
|
||
Command-line tool to capture clean and simple tweet snapshots. | ||
|
||
<p align="center"> | ||
<img src=".github/example.png" width="60%"> | ||
<br> | ||
<em>Light mode</em> | ||
</p> | ||
|
||
<p align="center"> | ||
<img src=".github/example-dark.png" width="60%"> | ||
<br> | ||
<em>Dark mode</em> | ||
</p> | ||
|
||
### Features | ||
- 🎛 Adjustable width | ||
- 💅 Rounded corners & transparent background | ||
- 🌚 Dark-mode | ||
- 🌐 Customizable locale | ||
- 🙅♀️ No "Share" & "Info" buttons | ||
- 💖 No watermark | ||
|
||
<sub>Support this project by ⭐️ starring and sharing it. [Follow me](/~https://github.com/privatenumber) to see what other cool projects I'm working on! ❤️</sub> | ||
|
||
## 🚀 Install | ||
```sh | ||
npm i -g snap-tweet | ||
``` | ||
|
||
### npx | ||
```sh | ||
npx snap-tweet | ||
``` | ||
|
||
## 🚦 Quick usage | ||
```sh | ||
snap-tweet https://twitter.com/jack/status/20 | ||
``` | ||
|
||
### Manual | ||
``` | ||
snap-tweet | ||
Usage: | ||
$ snap-tweet <...tweet urls> | ||
Options: | ||
-o, --output-dir <path> Tweet screenshot output directory | ||
-w, --width <width> Width of tweet (default: 550) | ||
-t, --show-thread Show tweet thread | ||
-d, --dark-mode Show tweet in dark mode | ||
-l, --locale <locale> Locale (default: en) | ||
-h, --help Display this message | ||
-v, --version Display version number | ||
Examples: | ||
$ snap-tweet https://twitter.com/jack/status/20 | ||
$ snap-tweet https://twitter.com/TwitterJP/status/578707432 --locale ja | ||
$ snap-tweet https://twitter.com/Interior/status/463440424141459456 --width 900 --dark-mode | ||
``` | ||
|
||
## 🏋️♀️ Motivation | ||
It all started when I simply wanted to embed a couple tweets into a Google Doc... | ||
|
||
Quick googling showed that there's no way to embed an actual tweet because Google Docs doesn't support HTML iframes or JavaScript. And I wasn't going to install a plugin just for some tweets. | ||
|
||
|
||
I figured I could just take a screenshot of the tweet. But only to realize I would be spending way too much time cropping each tweet, and they still wouldn't be perfect because of the lack of transparency behind the rounded corners. And not to mention, the static screenshot would include buttons like "Copy link to Tweet" that looked actionable but actually weren't. | ||
|
||
I found services like [Screenshot Guru](https://screenshot.guru) (and their [Twitter Screenshots](https://chrome.google.com/webstore/detail/twitter-screenshots/imfhndkgmnbnogfjcecdpopaooachgco) Chrome extension), [Pikaso](https://pikaso.me/), etc. but none of them met my needs (low quality images, actionable buttons present, watermarks, etc.). | ||
|
||
All I wanted to do was to embed the tweet like how it looks in the [official embedder](https://publish.twitter.com/#) into a static environment. No sign up, no watermark, no BS... It shouldn't be this hard! 🤯 | ||
|
||
So of course, I spent a few hours developing a tool to save us all the headache 😇 | ||
|
||
_(I know, this is some pretty crazy [yak shaving](https://en.wiktionary.org/wiki/yak_shaving). Checkout [my other projects](/~https://github.com/privatenumber) to see how deep I've gone.)_ | ||
|
||
|
||
## 🙋♀️ Need help? | ||
If you have a question about usage, [ask on Discussions](/~https://github.com/privatenumber/snap-tweet/discussions). | ||
|
||
If you'd like to make a feature request or file a bug report, [open an Issue](/~https://github.com/privatenumber/snap-tweet/issues). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/usr/bin/env node | ||
require('../dist/cli.js'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"name": "snap-tweet", | ||
"version": "0.0.0-semantic-release", | ||
"description": "Snap a screenshot of a tweet", | ||
"keywords": [ | ||
"twitter", | ||
"tweet", | ||
"snap", | ||
"snapshot", | ||
"screenshot" | ||
], | ||
"license": "MIT", | ||
"repository": "privatenumber/snap-tweet", | ||
"funding": "/~https://github.com/privatenumber/snap-tweet?sponsor=1", | ||
"author": { | ||
"name": "Hiroki Osame", | ||
"email": "hiroki.osame@gmail.com" | ||
}, | ||
"files": [ | ||
"bin/snap-tweet.js", | ||
"dist" | ||
], | ||
"main": "dist/snap-tweet.js", | ||
"bin": "bin/snap-tweet.js", | ||
"scripts": { | ||
"build": "rm -rf dist && tsup src --dts", | ||
"dev": "esno src/cli.ts", | ||
"lint": "eslint ." | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "npm run build && lint-staged" | ||
} | ||
}, | ||
"lint-staged": { | ||
"*.{js,ts}": "eslint" | ||
}, | ||
"dependencies": { | ||
"ink": "^3.0.8", | ||
"react": "^17.0.2" | ||
}, | ||
"devDependencies": { | ||
"@pvtnbr/eslint-config-typescript": "^0.1.16", | ||
"@types/react": "^17.0.5", | ||
"cac": "^6.7.3", | ||
"chrome-launcher": "^0.13.4", | ||
"chrome-remote-interface": "^0.30.0", | ||
"eslint": "^7.25.0", | ||
"esno": "^0.5.0", | ||
"exit-hook": "^2.2.1", | ||
"husky": "^4.3.8", | ||
"ink-task-list": "^1.0.1", | ||
"lint-staged": "^10.5.4", | ||
"open": "^8.0.7", | ||
"p-retry": "^4.5.0", | ||
"tempy": "^1.0.1", | ||
"tsup": "^4.10.1", | ||
"typescript": "^4.2.4", | ||
"unused-filename": "^2.1.0" | ||
}, | ||
"eslintConfig": { | ||
"extends": "@pvtnbr/eslint-config-typescript" | ||
} | ||
} |
Oops, something went wrong.