You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by au...@apache.org on 2017/10/03 18:11:19 UTC
cordova-fetch git commit: CB-13353 : added saveexact as an option and
updated fetch test
Repository: cordova-fetch
Updated Branches:
refs/heads/master d54b2465e -> b0fce54a3
CB-13353 : added saveexact as an option and updated fetch test
Project: http://git-wip-us.apache.org/repos/asf/cordova-fetch/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-fetch/commit/b0fce54a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-fetch/tree/b0fce54a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-fetch/diff/b0fce54a
Branch: refs/heads/master
Commit: b0fce54a3bcab52c09562a29ebbe2276f82ab51d
Parents: d54b246
Author: Audrey So <au...@apache.org>
Authored: Fri Sep 29 15:29:29 2017 -0700
Committer: Audrey So <au...@apache.org>
Committed: Tue Oct 3 10:40:56 2017 -0700
----------------------------------------------------------------------
index.js | 6 +++++-
spec/fetch-unit.spec.js | 17 +++++++++++++++--
2 files changed, 20 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-fetch/blob/b0fce54a/index.js
----------------------------------------------------------------------
diff --git a/index.js b/index.js
index 16ec031..1125cc8 100644
--- a/index.js
+++ b/index.js
@@ -42,6 +42,7 @@ module.exports = function (target, dest, 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()
@@ -68,7 +69,10 @@ module.exports = function (target, dest, opts) {
}
// if user added --save flag, pass it to npm install command
- if (opts.save) {
+ if (opts.save_exact) {
+ events.emit('verbose', 'saving exact');
+ fetchArgs.push('--save-exact');
+ } else if (opts.save) {
events.emit('verbose', 'saving');
fetchArgs.push('--save');
} else {
http://git-wip-us.apache.org/repos/asf/cordova-fetch/blob/b0fce54a/spec/fetch-unit.spec.js
----------------------------------------------------------------------
diff --git a/spec/fetch-unit.spec.js b/spec/fetch-unit.spec.js
index d5ee719..b980ad1 100644
--- a/spec/fetch-unit.spec.js
+++ b/spec/fetch-unit.spec.js
@@ -36,12 +36,25 @@ describe('unit tests for index.js', function () {
var opts = { cwd: 'some/path', production: true, save: true};
fetch('platform', 'tmpDir', opts)
.then(function (result) {
- expect(superspawn.spawn).toHaveBeenCalledWith('npm', [ 'install', 'platform', '--production', '--save'], jasmine.any(Object));
+ expect(superspawn.spawn).toHaveBeenCalledWith('npm', jasmine.stringMatching(/production/), jasmine.any(Object));
})
.fail(function (err) {
console.error(err);
expect(err).toBeUndefined();
})
.fin(done);
- }, 600000);
+ });
+
+ it('save-exact should be true if passed in', function (done) {
+ var opts = { cwd: 'some/path', save_exact: true };
+ fetch('platform', 'tmpDir', opts)
+ .then(function (result) {
+ expect(superspawn.spawn).toHaveBeenCalledWith('npm', jasmine.stringMatching(/save-exact/), jasmine.any(Object));
+ })
+ .fail(function (err) {
+ console.error(err);
+ expect(err).toBeUndefined();
+ })
+ .fin(done);
+ });
});
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org