Run npm commands concurrently in directories that have package.json
files.
$ npm install npm-extras -g
npm-do
runs concurrent npm commands. You can opitonal specify the flag --deep
to run npm commands in deeply nested subdirectories that have a package.json
file as well. An npm command is the action for npm to execute. For example, when running npm install
the command is install
.
If no npm command is specified, then npm-do
will run npm install
.
Consider a directories structure such as
- root/
- package.json
- examples
- bit-bundler
- package.json
- babel
package.json
- eslint
- package.json
npm-do install
will run npm install
in the root
directory. If you specify the --deep
flag, npm-do
will do a deep search for package.json
files and will run npm install
concurrently. E.g it will run npm install
in root
, examples/bit-bundler
, examples/bit-bundler/babel
, and examples/eslint
concurrently.
- The following example will run
npm install
.
$ npm-do install --deep
- run "npm update"
$ npm-do update --deep
- run an npm script called "build"
$ npm-do run build --deep
- install a couple of modules in all sub directories as dev dependencies
$ npm-do install bit-bundler eslint --save-dev --deep
npm-subdir
will run npm commands concurrently in all subdirectories (deeply nested) with package.json
files; excluding root. Given the sample structure in npm-do
, npm-subdir install
will run npm install
in examples/bit-bundler
, examples/bit-bundler/babel
, and examples/eslint
.
npm-deep
will run npm commands in the root directory as well as subdirectories (deeply nested) with package.json
files. This is an alias for npm-do --deep
. Given the sample structure in npm-do
, npm-deep install
will run npm install
in root
, examples/bit-bundler
, examples/bit-bundler/babel
, and examples/eslint
.
This is a helper command that will:
- Update the package.json version based on the input
- Create a git tag
- Push changes related to the release to git, including the tag
- Publish new version of the npm module to the npm registry
-
deep. This flag will be used to determine if sub directories should also be processed. Defaults to false.
-
message. This is the message used when creating the git tag.
-
version. This is the version for updating the packge.json file. This value is handed off to
npm version
, so it will be helpful to take a look here for more details. This defaults to "minor".
- Publishing with all defaults. version is minor and the message is in the format of "Release v%s" where "%s" is the new version generated.
$ npm-release
- Updating the version to patch
$ npm-release patch
- Updating the version to major with a tag message
$ npm-release major -m "Major update with breaking changes"
- Alternatively, you can choose to supply the version as an option
$ npm-release --version 3.1.2
Command to print to console one or more fields from package.json files. npm-pkg
also supports pacakge.json file in sub directories via the --deep
flag.
- Print the version of the package.json in the current directory.
$ npm-pkg version
- Print the version of package.json files in the current and sub directories.
$ npm-pkg version --deep
- Print the name, dependencies, and scripts in the current and sub directories
$ npm-pkg name dependencies scripts --deep