From 4a015b23ff02d8e2866b80269eeb168f0a050ca8 Mon Sep 17 00:00:00 2001 From: Joel Denning Date: Mon, 28 Oct 2019 18:47:43 -0600 Subject: [PATCH] Supporting installing packages from file. Resolves #4. --- lib/narn-lib.js | 1 + test/add.test.js | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/lib/narn-lib.js b/lib/narn-lib.js index 540bd5c..f75624d 100644 --- a/lib/narn-lib.js +++ b/lib/narn-lib.js @@ -64,6 +64,7 @@ exports.getNpmArgs = narnArgs => { }; function transformNarnPackageString(packageToAdd) { + packageToAdd = packageToAdd.replace("file:", ""); const packageNameWithoutVersion = packageToAdd.slice( 0, packageToAdd.indexOf("@") > 0 diff --git a/test/add.test.js b/test/add.test.js index 7bc2faf..a87db41 100644 --- a/test/add.test.js +++ b/test/add.test.js @@ -89,4 +89,12 @@ describe("narn add", () => { "git@github.com:joeldenning/narn.git#master" ]); }); + + it("supports installing from file", () => { + expect(getNpmArgs(["add", "file:../local-package"])).toEqual([ + "install", + "--save", + "../local-package" + ]); + }); });