diff --git a/README.md b/README.md index bcb267c..7bcbe77 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/lib/narn-lib.js b/lib/narn-lib.js index d7bafc8..b145e1d 100644 --- a/lib/narn-lib.js +++ b/lib/narn-lib.js @@ -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"; diff --git a/test/create.test.js b/test/create.test.js new file mode 100644 index 0000000..0dccb2f --- /dev/null +++ b/test/create.test.js @@ -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" + ]); + }); +});