Skip to content

Commit

Permalink
Adding support for yarn create (#16)
Browse files Browse the repository at this point in the history
* Adding support for yarn create

* Self review
  • Loading branch information
joeldenning authored Feb 8, 2020
1 parent 6413996 commit c753cc2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ narn upgrade-interactive --latest
# Install global library. All global libs are installed with yarn (since the most important thing is just that you consistently use the same package manager for global libs)
narn global add @vue/cli

# yarn create single-spa is similar to npm init single-spa
narn create single-spa

# View the installed versions of narn and yarn/npm
narn -v
narn --version
Expand Down
4 changes: 4 additions & 0 deletions lib/narn-lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ exports.getNpmArgs = (narnArgs, isPnpm = false) => {
result.command = "ncu";
return result;
}
case "create":
npmTarget = "init";
npmArgs = yarnSubCommands;
break;
case "publish":
result = [];
result.command = "np";
Expand Down
17 changes: 17 additions & 0 deletions test/create.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const { getNpmArgs } = require("../lib/narn-lib");

describe("narn create", () => {
it("can run create-single-spa package with npm", () => {
expect(getNpmArgs(["create", "single-spa"])).toEqual([
"init",
"single-spa"
]);
});

it("can run a create-thing package with pnpm", () => {
expect(getNpmArgs(["create", "single-spa"], true)).toEqual([
"init",
"single-spa"
]);
});
});

0 comments on commit c753cc2

Please sign in to comment.