A template repo for developing scripts with deno. These scripts can be compiled to single js files or even bundled with the deno executable for distribution.
This could also be used as a base for a cli written in deno, simply use a
cli-args parsing package in main.ts
and build out the commands.
.vscode
= A folder,- containing a
settings.json
which activates the deno language server for this workspace - containing a
extensions.json
with recommended vscode extensions for this workspace
- containing a
dist
= A folder containing the output artefacts, like a bundled js file or even executables for windows or macplayground
= a location used as cwd for running main.ts (this allows a clean testing space and avoids problems with the source-code files, like accidental deletion)src
= A folder containing more source files which are used bymain.ts
.env
= A file with environment variables being used with thevelociraptor
script runner.gitignore
= A normal gitingore filedeno.jsonc
- A JSON config file with comments to customize tsc, linting and formatting inside deno executablemain.ts
= the entrypoint for this deno script / appReadme.md
= A normal Readme filescripts.yaml
= A file defining the workspace scripts, likevr start
&vr build
. Needs thevelociraptor
cli to be installed globally. (see install instructions below)
- Update the
APP_NAME
variable in.env
file. It is used as name for bundled js files or compiled executables.
- Install Velociraptor (Script Runner)
- Get the newest install command from here: https://velociraptor.run/docs/installation/
- Run the install command from the website, for example:
deno install -qAn vr https://deno.land/x/velociraptor@1.5.0/cli.ts
- If you used this exact command from Step 2 from this readme,
run
vr upgrade
afterwards to update velociraptor
Two Options:
- use esm.sh, via the helper tasks:
deno task esm:add <:package>
- add bare specifiers to import map via
npm:package-name
CAUTION: If you want to deploy your script / cli to deno.land/x, you must not use import_map! Bc. installing this script via deno.land/x can't access the import map! See: https://deno.land/manual@v1.31.3/basics/import_maps#import-maps-are-for-applications
- Add automation with Github Actions: https://stefanbuck.com/blog/repository-templates-meets-github-actions