Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: using a local *.tgz stack #7649

Merged
merged 2 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading