@subsquid/commands
v2.3.1
Published
Command launcher for squids, replaces npm scripts and make(1)
Downloads
2,737
Readme
@subsquid/commands
Command launcher for squids.
This tool was created as a replacement for npm scripts and Makefiles to cover the following shortcomings of both.
npm
scripts:
- Hard to write complex commands.
- Commands are interpreted via the system shell, meaning the behaviour can be inconsistent across different platforms.
- No comments.
- No command descriptions to list in the overview.
make(1)
:
- Not cross-platform
- Esoteric and unfamiliar to many modern developers.
- No command descriptions to list in the overview.
Usage
squid-commands(1)
is driven by a special commands.json
file expected at the project root.
# list defined commands
squid-commands
# path arguments and flags to the script
squid-commands clean --force
# it is ok to use from any project dir
cd child/
squid-commands build
commands.json
Below is a sample commands.json
file demonstrating its features
{ // comments are ok
"$schema": "https://subsquid.io/schemas/commands.json",
"commands": {
"clean": {
"description": "delete all build artifacts",
"cmd": ["rm", "-rf", "lib"]
},
"build": {
"description": "build the project",
"deps": ["clean"], // commands to execute before
"cmd": ["tsc"]
},
"typegen": {
"hidden": true, // Don't show in the overview listing
"workdir": "abi", // change working dir
"command": [
"squid-evm-typegen", // node_modules/.bin is in the PATH
"../src/abi",
{"glob": "*.json"} // cross-platform glob expansion
],
"env": { // additional environment variables
"DEBUG": "*"
}
}
}
}