Skip to content

Commit

Permalink
Implementing upgrade-interactive. Resolves #9.
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldenning committed Jan 27, 2020
1 parent 233b572 commit 1293fc1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/narn-lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ exports.getNpmArgs = narnArgs => {
npmTarget = "init";
npmArgs = [];
break;
case "upgrade-interactive":
if (yarnArgs.latest) {
return ["ncu", "-iu", "&&", "npm", "install"];
} else {
npmTarget = "update";
npmArgs = yarnSubCommands;
}
break;
default:
npmTarget = "run";
if (narnArgs.length > 1) {
Expand Down
17 changes: 17 additions & 0 deletions test/upgrade-interactive.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const { getNpmArgs } = require("../lib/narn-lib");

describe("narn upgrade-interactive", () => {
it("Can run npm update", () => {
expect(getNpmArgs(["upgrade-interactive"])).toEqual(["update"]);
});

it("Can run npm-check-updates for --latest behavior", () => {
expect(getNpmArgs(["upgrade-interactive", "--latest"])).toEqual([
"ncu",
"-iu",
"&&",
"npm",
"install"
]);
});
});

0 comments on commit 1293fc1

Please sign in to comment.