diff --git a/.changeset/big-tigers-burn.md b/.changeset/big-tigers-burn.md new file mode 100644 index 00000000000..6fa17f4713e --- /dev/null +++ b/.changeset/big-tigers-burn.md @@ -0,0 +1,7 @@ +--- +"create-remix": patch +--- + +Support local tarballs with `.tgz` extension + +It allows to directly support [`pnpm pack` tarballs](https://pnpm.io/cli/pack). \ No newline at end of file diff --git a/docs/guides/templates.md b/docs/guides/templates.md index 59eefa31da3..a4c9a875d7b 100644 --- a/docs/guides/templates.md +++ b/docs/guides/templates.md @@ -115,6 +115,7 @@ You can provide a local directory or tarball on disk to the `--template` option, ```shellscript nonumber npx create-remix@latest --template /my/remix-stack npx create-remix@latest --template /my/remix-stack.tar.gz +npx create-remix@latest --template /my/remix-stack.tgz npx create-remix@latest --template file:///Users/michael/my-remix-stack.tar.gz ``` diff --git a/packages/create-remix/__tests__/create-remix-test.ts b/packages/create-remix/__tests__/create-remix-test.ts index cb3a6762b20..2d73c904b04 100644 --- a/packages/create-remix/__tests__/create-remix-test.ts +++ b/packages/create-remix/__tests__/create-remix-test.ts @@ -426,6 +426,25 @@ describe("create-remix CLI", () => { expect(fse.existsSync(path.join(projectDir, "app/root.tsx"))).toBeTruthy(); }); + it("works for a path to a tgz tarball on disk", async () => { + let projectDir = getProjectDir("local-tarball"); + + let { status, stderr } = await execCreateRemix({ + args: [ + projectDir, + "--template", + path.join(__dirname, "fixtures", "arc.tgz"), + "--no-git-init", + "--no-install", + ], + }); + + expect(stderr.trim()).toBeFalsy(); + expect(status).toBe(0); + expect(fse.existsSync(path.join(projectDir, "package.json"))).toBeTruthy(); + expect(fse.existsSync(path.join(projectDir, "app/root.tsx"))).toBeTruthy(); + }); + it("works for a file URL to a tarball on disk", async () => { let projectDir = getProjectDir("file-url-tarball"); diff --git a/packages/create-remix/__tests__/fixtures/arc.tgz b/packages/create-remix/__tests__/fixtures/arc.tgz new file mode 100644 index 00000000000..9b90ab69219 Binary files /dev/null and b/packages/create-remix/__tests__/fixtures/arc.tgz differ diff --git a/packages/create-remix/copy-template.ts b/packages/create-remix/copy-template.ts index cf10b6b432d..3ad55c1d261 100644 --- a/packages/create-remix/copy-template.ts +++ b/packages/create-remix/copy-template.ts @@ -135,7 +135,7 @@ async function copyTemplateFromLocalFilePath( filePath: string, destPath: string ): Promise { - if (filePath.endsWith(".tar.gz")) { + if (filePath.endsWith(".tar.gz") || filePath.endsWith(".tgz")) { await extractLocalTarball(filePath, destPath); return false; }