From 2a0f31e7c88d088368691e5a74ae237ab9d0d4af Mon Sep 17 00:00:00 2001 From: Matthias Jahn Date: Sun, 20 Mar 2016 17:53:42 +0100 Subject: [PATCH 1/2] Add option to save exact version numbers --- bin/updtr | 6 ++++-- lib/run.js | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/bin/updtr b/bin/updtr index f48e88e..c537d19 100755 --- a/bin/updtr +++ b/bin/updtr @@ -12,7 +12,8 @@ program .option("-w, --wanted", "updates to wanted version specified in package.json instead of the modules latest version") .option("-t, --test ", "change the command for the tests") .option("-e, --exclude ", "exclude modules comma seperated, e.g. updtr --exclude module1,module2", "excludes") - .option("--test-stdout", "shows stdout if your test command fails"); + .option("--test-stdout", "shows stdout if your test command fails") + .option("--save-exact", "save exact module version"); program.parse(process.argv); @@ -28,7 +29,8 @@ updtr.run({ wanted: program.wanted, testCmd: program.test, exclude: program.exclude, - testStdout: program.testStdout + testStdout: program.testStdout, + saveExact: program.saveExact }, function (err) { if (err) { throw err; diff --git a/lib/run.js b/lib/run.js index d0aae57..551dd28 100644 --- a/lib/run.js +++ b/lib/run.js @@ -49,12 +49,17 @@ function run(config, done) { testCmd: testCmd }; var testStdout; + var installCmd = "npm i " + info.name + "@" + info.updateTo + " " + info.saveCmd; + + if (config.saveExact) { + installCmd += " --save-exact"; + } emitter.emit("updating", event); async.series({ deleteOldVersion: async.apply(exec, "npm remove " + info.name + " " + info.saveCmd), - installNewVersion: async.apply(exec, "npm i " + info.name + "@" + info.updateTo + " " + info.saveCmd), + installNewVersion: async.apply(exec, installCmd), emitTestingEvent: function (done) { emitter.emit("testing", event); setImmediate(done); From 1fc31ac995ca0cfd4ed7371dadf553f2729109db Mon Sep 17 00:00:00 2001 From: Matthias Jahn Date: Sun, 20 Mar 2016 17:54:41 +0100 Subject: [PATCH 2/2] Add --save-exact option to README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 906c2b9..26f1157 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ npm install -g updtr -t, --test change the command for the tests -e, --exclude exclude modules comma seperated, e.g. updtr --exclude module1,module2 --test-stdout shows stdout if your test command fails + --save-exact save exact module version ``` ## License