diff --git a/readme.md b/readme.md index 4b56217..8ba5810 100644 --- a/readme.md +++ b/readme.md @@ -70,6 +70,18 @@ Default value: `'npm'` The location of the `npm` executable. Defaults to `'npm'` as it should be available in the `$PATH` environment variable. +#### options.npmInstallArgs +Type: `array` +Default value: `['install']` + +The command and arguments to pass to `npm install` operations. For example in CI environments you can use `['ci']` and we'd run `npm ci` for install operations instead. + +#### options.npmCleanArgs +Type: `array` +Default value: `['prune', '--production']` + +The command and arguments to pass to `npm prune` operations. For example in CI environments you can use `['ci']` and we'd run `npm ci` for install operations instead. + #### options.passGruntFlags Type: `bool` Default value: `true` diff --git a/tasks/subgrunt.js b/tasks/subgrunt.js index 1346bbf..fdc19e4 100644 --- a/tasks/subgrunt.js +++ b/tasks/subgrunt.js @@ -7,7 +7,7 @@ module.exports = function (grunt) { const runNpmInstall = function (path, options, next) { grunt.util.spawn({ cmd: options.npmPath, - args: ['install'], + args: options.npmInstallArgs, opts: {cwd: path, stdio: 'inherit'} }, (err, result, code) => { if (err || code > 0) { @@ -25,7 +25,7 @@ module.exports = function (grunt) { grunt.util.spawn({ cmd: options.npmPath, - args: ['prune', '--production'], + args: options.npmCleanArgs, opts: {cwd: path, stdio: 'inherit'} }, (err, result, code) => { if (err || code > 0) { @@ -71,6 +71,8 @@ module.exports = function (grunt) { npmInstall: true, npmClean: false, npmPath: 'npm', + npmInstallArgs: ['install'], + npmCleanArgs: ['prune', '--production'], passGruntFlags: true, limit: Math.max(require('os').cpus().length, 2) })