I've been playing around with Deno in the last few months (if you haven't already, try it out, it's awesome) and one of the things that frustrated me the most was that I easily ended up writing endless
deno cli commands, like this:
deno run --allow-read --allow-write --allow-net --config tsconfig.json --importmap importmap.json --reload file.ts
I mean... I just wrote it and I've already forgotten it 🤦♂️
The instinctive reaction of my webdev-y brain was:
Easy. Let's write it down in a package.json script.
Yeah, no. There ain't no package.json in the land of Deno.
So I left aside my acute
npm run nostalgia and started working on an alternative for Deno, and after some weeks of coding here it is:
Velociraptor is a script runner for Deno, inspired by npm's package.json scripts. It offers a similar experience but with out-of-the-box support for declarative Deno CLI options, environment variables, concurrency and git hooks.
To get started visit velociraptor.run.
Show your collaborators/users you use velociraptor:
Feedback and PRs are welcome! Take a look at the contributing guidelines.
This project is licensed under the MIT License. See LICENSE for details.
To get started, install it with
deno install -qA -n vr https://deno.land/x/velociraptor/cli.ts
Then create a file called
.ts are supported as well) in your project folder
scripts: start: deno run my-script-file.ts
and run the
$ vr start
In this form script files are essentially a remake of the
scripts section of
package.json: keys are script names, values are arbitrary shell scripts. But there's more.
Use objects to superpower your scripts:
scripts: start: cmd: deno run server.ts desc: Starts the server # This description is shown in the list # of available scripts when running vr # without arguments
When a script starts with a
deno run is automatically prepended:
scripts: start: server.ts # Equivalent to deno run server.ts
env to pass env variables to the scripts
env: # Sent to all the scripts PORT: 80 scripts: start-dev: cmd: server.ts env: # script-specific override PORT: 8080 start-prod: deno run server.ts
A subset of
deno cli options can be passed to the scripts (to name a few:
--allow-* permissions, tsconfig.json, import maps, lock files...)
scripts: start: cmd: server.ts allow: - net - read tsconfig: tsconfig.json imap: importmap.json allow: # Global options - write
A list of commands is executed in series
scripts: start: - deno run one.ts - deno run two.ts
and parallel commands are supported as well
scripts: start: pll: - deno run one.ts - deno run two.ts
Support for husky-style git hooks is coming soon! 🐶
Check out the documentation in the repo for more details.
Hope you'll find it useful! 🙌