Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #15, add the ability to set a command for npm:cmd in config #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ Default: []

An array or string specifying npm flags passed to the [npm install](https://docs.npmjs.com/cli/install) cmd.

### `npm.cmd`

Type: `String`
Default: ' '

A string specifying the command to be run by the [npm:cmd](https://github.com/callerc1/shipit-npm#workflow-tasks) task (e.g. `'run build'`) **overridden if the `--cmd` argument is set on the command line**.

### `npm.triggerEvent`

Type: `String`,`Boolean`
Expand Down
11 changes: 9 additions & 2 deletions tasks/npm/cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,19 @@ module.exports = function (gruntOrShipit) {
);
}

if (!argv.cmd && shipit.config.npm) {
argv.cmd = shipit.config.npm.cmd;
}

if(!argv.cmd) {
throw new Error(
shipit.log(
chalk.red('Please specify a npm command eg'),
chalk.gray('shipit staging npm:init npm:cmd'),
chalk.white('--cmd "update"')
chalk.gray('\nshipit staging npm:init npm:cmd'),
chalk.white('--cmd "update"'),
chalk.red('\nor'),
chalk.gray('\n(in your shipitfile)'),
chalk.white('npm: { cmd: \'run build\' }')
)
);
}
Expand Down