@antislop/adonis-run
v0.1.0
Published
Run scripts with your AdonisJS application booted, like rails runner.
Downloads
110
Readme
adonis-run
Run a script with your AdonisJS application booted, like rails runner.
node ace run scripts/release.tsRead more here: Adding rails runner to AdonisJS.
Install
node ace add @antislop/adonis-runThis installs the package and registers its run command in adonisrc.ts:
commands: [
// ... your existing commands
// This will be added:
() => import('@antislop/adonis-run/commands'),
],Usage
Run a script like this:
node ace run scripts/release.tsArguments and flags
Extra arguments are passed through the script and available in process.argv.slice(2):
node ace run scripts/greet.ts Alice "Hello there"// scripts/greet.ts
const [name, greeting] = process.argv.slice(2);
console.log(`${greeting}, ${name}!`);Use -- before script flags so Ace does not interpret them:
node ace run scripts/release.ts production -- --dry-run --limit=10The script receives ['production', '--dry-run', '--limit=10']. The first -- is a separator and is not forwarded. Arguments after it are preserved, including flag values, leading zeros, and additional -- tokens.
process.argv[0] remains the Node.js executable, and process.argv[1] is the resolved script path.
License
MIT
