Skip to content

Commit

Permalink
fix: remove extra config files that are generated by c3 with `--exist…
Browse files Browse the repository at this point in the history
…ing-script ` (#8232)

* remove extra config files

* changeset

* revert delete files

* update changeset

* add test
  • Loading branch information
emily-shen authored Feb 27, 2025
1 parent 6c6143b commit 59cb914
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
7 changes: 7 additions & 0 deletions .changeset/sixty-spoons-unite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"create-cloudflare": patch
---

fix: stop c3 adding a duplicate `./wrangler.jsonc` when using --existing-script

This should mean dev and deploy on projects initialised using `create-cloudflare --existing-script` start working again. Note there will still be an extraneous `./src/wrangler.toml`, which will require a separate fix in the dashboard. This file can be manually deleted in the meantime.
7 changes: 6 additions & 1 deletion packages/create-cloudflare/e2e-tests/cli.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs, { readFileSync } from "node:fs";
import { basename } from "node:path";
import { basename, join } from "node:path";
import { detectPackageManager } from "helpers/packageManagers";
import { beforeAll, describe, expect } from "vitest";
import { version } from "../package.json";
Expand Down Expand Up @@ -438,6 +438,11 @@ describe.skipIf(experimental || frameworkToTest || isQuarantineMode())(
);
expect(output).toContain("Pre-existing Worker (from Dashboard)");
expect(output).toContain("Application created successfully!");
expect(fs.existsSync(join(project.path, "wrangler.jsonc"))).toBe(false);
expect(fs.existsSync(join(project.path, "wrangler.json"))).toBe(false);
expect(
fs.readFileSync(join(project.path, "wrangler.toml"), "utf8"),
).toContain('FOO = "bar"');
});
},
);
2 changes: 1 addition & 1 deletion packages/create-cloudflare/templates/pre-existing/c3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export async function copyExistingWorkerFiles(ctx: C3Context) {
{ recursive: true },
);

// copy wrangler.toml from the downloaded Worker
// copy ./wrangler.toml from the downloaded Worker
await cp(
join(tempdir, ctx.args.existingScript, "wrangler.toml"),
join(ctx.project.path, "wrangler.toml"),
Expand Down

This file was deleted.

0 comments on commit 59cb914

Please sign in to comment.