diff --git a/contributors.yml b/contributors.yml index 042ecc33f3d..06ae38764d4 100644 --- a/contributors.yml +++ b/contributors.yml @@ -671,3 +671,4 @@ - zainfathoni - zayenz - zhe +- mic-sob diff --git a/packages/create-remix/__tests__/create-remix-test.ts b/packages/create-remix/__tests__/create-remix-test.ts index 68f28938357..7b850be82ba 100644 --- a/packages/create-remix/__tests__/create-remix-test.ts +++ b/packages/create-remix/__tests__/create-remix-test.ts @@ -82,7 +82,7 @@ describe("create-remix CLI", () => { --template The project template to use --[no-]install Whether or not to install dependencies after creation - --package-manager The package manager to use + --package-manager The package manager to use (npm, pnpm, yarn, bun) --show-install-output Whether to show the output of the install process --[no-]init-script Whether or not to run the template's remix.init script, if present --[no-]git-init Whether or not to initialize a Git repository @@ -900,6 +900,36 @@ describe("create-remix CLI", () => { process.env.npm_config_user_agent = originalUserAgent; }); + it("uses npm when package manager is unknown", async () => { + let projectDir = getProjectDir("pnpm-create-override"); + + let execa = require("execa"); + execa.mockImplementation(async () => {}); + + // Suppress terminal output + let stdoutMock = jest + .spyOn(process.stdout, "write") + .mockImplementation(() => true); + + await createRemix([ + projectDir, + "--template", + path.join(__dirname, "fixtures", "blank"), + "--no-git-init", + "--yes", + "--package-manager", + "notSupportedPackageManagerOrTypo", + ]); + + stdoutMock.mockReset(); + + expect(execa).toHaveBeenCalledWith( + "npm", + expect.arrayContaining(["install"]), + expect.anything() + ); + }); + it("works when creating an app in the current dir", async () => { let emptyDir = getProjectDir("current-dir-if-empty"); fse.mkdirSync(emptyDir); diff --git a/packages/create-remix/index.ts b/packages/create-remix/index.ts index 35e7381500d..a27dca1e4a7 100644 --- a/packages/create-remix/index.ts +++ b/packages/create-remix/index.ts @@ -782,7 +782,7 @@ ${color.arg("--no-motion")} ${color.dim(`Disable animations in console o ${color.arg("--template ")} ${color.dim(`The project template to use`)} ${color.arg("--[no-]install")} ${color.dim(`Whether or not to install dependencies after creation`)} -${color.arg("--package-manager")} ${color.dim(`The package manager to use`)} +${color.arg("--package-manager")} ${color.dim(`The package manager to use (npm, pnpm, yarn, bun)`)} ${color.arg("--show-install-output")} ${color.dim(`Whether to show the output of the install process`)} ${color.arg("--[no-]init-script")} ${color.dim(`Whether or not to run the template's remix.init script, if present`)} ${color.arg("--[no-]git-init")} ${color.dim(`Whether or not to initialize a Git repository`)}