A breaking change was introduced in Deno
v1.22.0
,
which affects this repository:
BREAKING: Remove unstable
Deno.emit
andDeno.formatDiagnostics
APIs (#14463)
The removed APIs were relocated to a third-party module,
deno.land/x/emit
,
but were only migrated in part. At the time of writing of this notice,
issues exist which prevent
refactoring this codebase without disruption. I plan to update this project
after those issues have been resolved.
In the iterim, a potential workaround is to use Deno's
compile
API
with Deno
v1.21.3
to create a binary as a substitute for installing the script.
- Write documentation
- Write tests
deno install --unstable --name uscript-deno main.ts
To avoid being prompted for permissions every time, install with the following permissions:
deno install --unstable --allow-net --allow-read --allow-run --allow-write --name uscript-deno main.ts
(Some permissions aren't strictly necessary, but allow for an enhanced experience — e.g. --allow-run
is only used to open files in VS Code and to get the correct Windows path in WSL)
Generate a new directory with a script template (main.ts) and metablock template (metablock.yaml)
uscript-deno new $DIR
# uscript-deno new path/to/new/dir
Created:
path/to/new/dir
├ main.ts
└ metablock.yaml
Bundle userscript
uscript-deno bundle $ENTRYPOINT
# uscript-deno bundle path/to/project/main.ts
Written:
path/to/project/main.bundle.user.js
Run in development mode: Watches entrypoint file for changes and bundles again on each change. Also provides metablock userscript on localhost server for quick installation by a script manager extension (e.g. Tampermonkey) (requires fs access by the script manager)
uscript-deno dev $ENTRYPOINT
# uscript-deno dev path/to/project/main.ts
Development userscript metablock at:
http://localhost:10741/meta.user.js
Watching for file changes…
Use ctrl+c to stop.
18:33:11.796 Bundling…
18:33:13.211 Done (1416ms)
…
Generate TSConfig for use with VS Code Deno extension
# print to stdout
uscript-deno tsconfig
# or write to file
uscript-deno tsconfig -o $TSCONFIG_PATH
# uscript-deno tsconfig -o path/to/new/tsconfig.json
Written:
path/to/new/tsconfig.json
Template file data can be modified before installing and are located at data/templates.ts