░█▀█░█▀█░█▄█░░░░░█▀▀░█▀▀░█▀▄░▀█▀░█▀█░▀█▀░░░░░█▀▀░█▀▀░█░░░█▀▀░█▀▀░▀█▀░█▀█░█▀▄
░█░█░█▀▀░█░█░▄▄▄░▀▀█░█░░░█▀▄░░█░░█▀▀░░█░░▄▄▄░▀▀█░█▀▀░█░░░█▀▀░█░░░░█░░█░█░█▀▄
░▀░▀░▀░░░▀░▀░░░░░▀▀▀░▀▀▀░▀░▀░▀▀▀░▀░░░░▀░░░░░░▀▀▀░▀▀▀░▀▀▀░▀▀▀░▀▀▀░░▀░░▀▀▀░▀░▀
By: Justin Sunday
GitHub: sundayj/npm-script-selector
Website: JLSunday.com
NPM: npm-script-selector
The NPM Script Selector is a CLI tool for discovering and running project scripts within package.json files. Have you ever worked on a project that contains so many scripts that you can't always remember the available options? That's what happened to me. I currently contribute to a project with 30+ scripts. I became tired of having to open the package file and/or IDE in order to find and run the needed scripts, so I created this small CLI.
Currently, you provide the path to the package.json file, the NPM Script Selector will then list the available scripts for you, where you can interactively select the one you want. It will then run the script for you within the selected project's directory. I plan to add more functionality in the near future.
Uses figlet, commander, and inquirer.
If you like this package, please consider sponsoring:
For feature requests, or bugs, please create an issue here
- Can be used as entry to other scripts.
- Accepts path to a
package.jsonas an input, or automatically finds the nearest one if not provided. - Automatically searches for the nearest
package.jsonfile when no path is specified (walks up directory tree). - Lists scripts contained within that
package.json. - Allows interactive selection of script.
- Prints output from selected script.
- Asks if you would like to run another script when the current one is finished.
- App's title banner is customizable. Customize the font printed to the console when the CLI runs:
- Change the words.
- Change the font style. Font choices can be found here.
- Allow subcommands/options to be passed to selected scripts.
- Option to search for
package.jsonfiles within a directory. - Option to store the paths of frequently used files.
- Option to run the selected scripts in a new window.
- React GUI
Install NPM Script Selector with npm:
npm i -g npm-script-selectorTo run:
# With a specific package.json path
> npmss -f path/to/desired/package.json
# Or let it auto-find the nearest package.json
> npmssNote: The tool can be invoked as either npmss (recommended) or npm-script-selector. If you use npm-script-selector, the tool will display help information and remind you to use npmss instead.
For Help:
> npmss -h
Usage: npmss [options]
The NPM Script Selector is a CLI tool for discovering and running project scripts within package.json files.
Options:
-V, --version output the version number
-f, --file <value> Path to the package.json. (Optional - will auto-find nearest if not provided)
-b, --banner <value> Value for the title to be displayed to the user. (Replaces the NPM-Script-Selector banner.)
-hb, --hide-banner Use this flag if you'd like to not display a banner at all.
-bf, --banner-font <value> Pass the name of a font listed here to print the banner in the desired font. https://github.com/DefinitelyTyped/DefinitelyTyped/blob/53d91777b0daa1b5b6b0beac63ab0b25126b7b13/types/figlet/index.d.ts#L2
-h, --help display help for command
When the -f option is not provided, the tool will automatically search for the nearest package.json file by traversing up the directory tree from your current working directory.
Path can be relative to current directory, or absolute.
Bug reports and pull requests are welcome on GitHub at sundayj/npm-script-selector. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The package is available as open source under the terms of the MIT License.
