Scripts CLI
This package aims to take out the step of remembering all of the scripts in your package.json file and remove the need to put all utility scripts into package.json.

Installation
npm
npm install --save-dev scripts-cli
yarn
yarn add --dev scripts-cli
Config
By default scripts-cli will include all scripts in package.json. By selecting a script in package.json it will run:
npm run <selected script>
In order to change the behaviour of package.json scripts and add any other scripts for the project you can create a .scriptscli.config.mjs file.
type Options =
| {
args?: boolean
argumentsLabel?: string
exec?: string
}
| {
options: Options
}
type Config = {
exclude: string[]
options: Options
}
For each option entry you can provide the following:
| args | default ( false ). When true the cli will allow arguments to be provided and passed to final command. |
| argsLabel | default ( Arguments ). When provided this will be used in the CLI as a label for the arguments input. |
| options | default ( {} ). This allows for nested options. The object supplied has the same options as the top level. |
| exec | default ( undefined ). For a script in package.json if a value is provided here it will override the script. This string will be provided to the shell to run. |
Example Package.json
{
"scripts": {
"test": "echo \"Running tests\"",
"dev": "ts-node . -w",
"db:migrate:latest": "echo \"Running latest migrations\"",
"db:create:migration": "echo \"Creating migration$1\"",
"scripts": "scripts-cli"
}
}
Example .scriptscli.config.json
export default {
exclude: ['scripts', 'db:*'],
options: {
test: {
args: true,
},
'Create test file': {
args: true,
argsLabel: 'File name',
exec: './scripts/create-testfile.sh',
},
db: {
options: {
'create migration': {
args: true,
exec: 'npm run db:create:migration',
},
'db:migrate:latest': {},
},
},
},
}