The Step runs npm with the command and arguments you provide, for example, to install missing packages or run a package's test.
Description
You can install missing JS dependencies with this Step if you insert it before any build step and provide the install
command.
You can also test certain packages with the test
command.
You can do both in one Workflow, however, this requires one Run npm command Step for installation followed by another Run npm command Step for testing purposes.
- Add the Run npm command Step to your Workflow preceding any build Step.
- Set the Working directory.
- Set the command you want npm to execute, for example
install
to runnpm install
in the The npm command with arguments to run input. - If you're looking for a particular npm version, you can set it in the Version of npm to use input.
- You can cache the content of the node modules directory if you select
true
in the drop-down. By default this input is set to false.
Make sure you insert the Step before any build Step so that every dependency is downloaded a build Step starts running.
Add this step directly to your workflow in the Bitrise Workflow Editor.
You can also run this step directly with Bitrise CLI.
Inputs
Key | Description | Flags | Default |
---|---|---|---|
workdir |
Working directory of the step. You can leave it empty to not change it. | $BITRISE_SOURCE_DIR |
|
command |
Specify the command with arguments to run with npm . This input value will be append to the end of the npm command call. For example: - install -> npm install - install -g cordova -> npm install -g cordova |
required | |
npm_version |
Set this value to the version of npm that is required to run the command. Must be a valid semver string. | ||
cache_local_deps |
Select if the contents of node_modules directory should be cached. true : Mark local dependencies to be cached. false : Do not use cache. |
required | false |
Outputs
There are no outputs defined in this stepWe welcome pull requests and issues against this repository.
For pull requests, work on your changes in a forked repository and use the Bitrise CLI to run step tests locally.
Learn more about developing steps: