Repository: cordova-fetch Updated Branches: refs/heads/master b0fce54a3 -> 64287eeac
CB-13303 : updating opts.production This closes #6 Project: http://git-wip-us.apache.org/repos/asf/cordova-fetch/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-fetch/commit/64287eea Tree: http://git-wip-us.apache.org/repos/asf/cordova-fetch/tree/64287eea Diff: http://git-wip-us.apache.org/repos/asf/cordova-fetch/diff/64287eea Branch: refs/heads/master Commit: 64287eeac998a94ebf1d032700db05ae0bb891d4 Parents: b0fce54 Author: Audrey So <[email protected]> Authored: Tue Oct 3 13:54:46 2017 -0700 Committer: Steve Gill <[email protected]> Committed: Tue Oct 3 18:39:36 2017 -0700 ---------------------------------------------------------------------- index.js | 7 +++---- spec/fetch-unit.spec.js | 13 +++++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-fetch/blob/64287eea/index.js ---------------------------------------------------------------------- diff --git a/index.js b/index.js index 1125cc8..4284ad4 100644 --- a/index.js +++ b/index.js @@ -40,9 +40,7 @@ module.exports = function (target, dest, opts) { var fetchArgs = opts.link ? ['link'] : ['install']; opts = opts || {}; var tree1; - opts.production = opts.production || true; var nodeModulesDir = dest; - opts.save_exact = opts.save_exact || false; // check if npm is installed return module.exports.isNpmInstalled() @@ -64,8 +62,10 @@ module.exports = function (target, dest, opts) { // set the directory where npm install will be run opts.cwd = dest; // npm should use production by default when install is npm run - if (opts.production) { + + if ((opts.production) || (opts.production === undefined)) { fetchArgs.push('--production'); + opts.production = true; } // if user added --save flag, pass it to npm install command @@ -78,7 +78,6 @@ module.exports = function (target, dest, opts) { } else { fetchArgs.push('--no-save'); } - // Grab json object of installed modules before npm install return depls(nodeModulesDir); }) http://git-wip-us.apache.org/repos/asf/cordova-fetch/blob/64287eea/spec/fetch-unit.spec.js ---------------------------------------------------------------------- diff --git a/spec/fetch-unit.spec.js b/spec/fetch-unit.spec.js index b980ad1..a8c206d 100644 --- a/spec/fetch-unit.spec.js +++ b/spec/fetch-unit.spec.js @@ -57,4 +57,17 @@ describe('unit tests for index.js', function () { }) .fin(done); }); + + it('noprod should turn production off', function (done) { + var opts = { cwd: 'some/path', production: false}; + fetch('platform', 'tmpDir', opts) + .then(function (result) { + expect(superspawn.spawn).not.toHaveBeenCalledWith('npm', jasmine.stringMatching(/production/), jasmine.any(Object)); + }) + .fail(function (err) { + console.error(err); + expect(err).toBeUndefined(); + }) + .fin(done); + }); }); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
