https://github.com/mkobayashime/bookmarklets-cli
CLI for bookmarklets development
https://github.com/mkobayashime/bookmarklets-cli
bookmarklet bookmarklets
Last synced: 13 days ago
JSON representation
CLI for bookmarklets development
- Host: GitHub
- URL: https://github.com/mkobayashime/bookmarklets-cli
- Owner: mkobayashime
- License: apache-2.0
- Created: 2022-10-27T16:13:32.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-30T05:04:30.000Z (4 months ago)
- Last Synced: 2025-01-01T09:05:20.200Z (4 months ago)
- Topics: bookmarklet, bookmarklets
- Language: TypeScript
- Homepage: https://npmjs.com/package/bookmarklets-cli
- Size: 1.16 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - mkobayashime/bookmarklets-cli - CLI for bookmarklets development (TypeScript)
README
# bookmarklets-cli
CLI for [bookmarklets](https://en.wikipedia.org/wiki/Bookmarklet) development
## Installation
```bash
# you can use this cli without installing locally
npx bookmarklets-cli [...]# if needed
npm install --save bookmarklets-cli
# or
yarn add bookmarklets-cli
```## Usage
### Build
```bash
# transpile `script.ts` into `dist` dir
npx bookmarklets-cli script.ts# glob support
npx bookmarklets-cli 'src/*.ts'# specify dist dir
npx bookmarklets-cli --dist-dir 'out'
```### Dev mode
In dev mode, every time the input script is saved, the CLI transpiles the input script and copies it to the clipboard.
Note that the leading `j` is removed (e.g., `avascript:(()=>{})` instead of `javascript:(()=>{})`). Many browsers automatically remove the `javascript:` part from URLs pasted into the address bar to enhance security, so the leading `j` is removed to avoid this issue.
When testing the copied output from dev mode in a browser, first type `j` in the address bar, then paste the copied output, and press Enter to execute it.```bash
# watch `script.ts`
npx bookmarklets-cli --watch script.ts# glob support
npx bookmarklets-cli --watch 'src/*.ts'
```