Skip to content

Commit

Permalink
Support "narn run" to list available script commands. Resolves #21. (#22
Browse files Browse the repository at this point in the history
)
  • Loading branch information
joeldenning authored Jun 23, 2020
1 parent 24caffb commit 1ee94ca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/narn-lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ exports.getNpmArgs = (narnArgs, isPnpm = false) => {
npmTarget = "run";
if (narnArgs.length > 1) {
npmArgs = [narnArgs[0], "--", ...narnArgs.slice(1)];
} else if (narnArgs.length === 1 && narnArgs[0] === "run") {
npmArgs = [];
} else {
npmArgs = narnArgs;
}
Expand Down
8 changes: 8 additions & 0 deletions test/run.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const { getNpmArgs } = require("../lib/narn-lib");

// https://github.com/joeldenning/narn/issues/21
describe("narn run", () => {
it("lists all available commands with npm run", () => {
expect(getNpmArgs(["run"])).toEqual(["run"]);
});
});

0 comments on commit 1ee94ca

Please sign in to comment.