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:
jurassiscripts / velociraptor
The npm-style script runner for Deno
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.
Documentation
To get started visit velociraptor.run.
Help
If you need any help feel free to ask in discussions or in the chat.
Badge
Show your collaborators/users you use velociraptor:
[![vr scripts](https://badges.velociraptor.run/flat.svg)](https://velociraptor.run)
Contributing
Feedback and PRs are welcome! Take a look at the contributing guidelines.
License
This project is licensed under the MIT License. See LICENSE for details.
To get started, install it with deno install
:
deno install -qA -n vr https://deno.land/x/velociraptor/cli.ts
Then create a file called scripts.yaml
(.json
and .ts
are supported as well) in your project folder
scripts:
start: deno run my-script-file.ts
and run the start
command
$ 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.
More script options
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
Compact deno run
When a script starts with a .ts
or .js
file, deno run
is automatically prepended:
scripts:
start: server.ts # Equivalent to deno run server.ts
Env variables
Use 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
Deno cli options
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
Compound scripts
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
Bonus
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! 🙌
Top comments (4)
Whoa great job, very useful and easy to use without overkill features. Should become Deno official script runner! Looking forward to husky-style git hooks
This was Eazy. Thank you!
Denon didn't watch subfolders (windows 10). deno --watch released about <30 minutes ago. Compiled latest .exe but couldn't get denon to launch deno anymore but this works like a charm.
@nastradoomus since
1.0.0-beta.14
you can also use thewatch
property 👀Just like Robo, but with concurrently.