Skip to content

Commit

Permalink
Fix: using a local *.tgz stack (#7649)
Browse files Browse the repository at this point in the history
  • Loading branch information
real34 authored Oct 12, 2023
1 parent a895ef6 commit 1f5b740
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .changeset/big-tigers-burn.md
Original file line number Diff line number Diff line change
@@ -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).
1 change: 1 addition & 0 deletions docs/guides/templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down
19 changes: 19 additions & 0 deletions packages/create-remix/__tests__/create-remix-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/create-remix/copy-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ async function copyTemplateFromLocalFilePath(
filePath: string,
destPath: string
): Promise<boolean> {
if (filePath.endsWith(".tar.gz")) {
if (filePath.endsWith(".tar.gz") || filePath.endsWith(".tgz")) {
await extractLocalTarball(filePath, destPath);
return false;
}
Expand Down

0 comments on commit 1f5b740

Please sign in to comment.