Skip to content

Commit 59cb914

Browse files
authored
fix: remove extra config files that are generated by c3 with --existing-script (#8232)
* remove extra config files * changeset * revert delete files * update changeset * add test
1 parent 6c6143b commit 59cb914

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

.changeset/sixty-spoons-unite.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"create-cloudflare": patch
3+
---
4+
5+
fix: stop c3 adding a duplicate `./wrangler.jsonc` when using --existing-script
6+
7+
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.

packages/create-cloudflare/e2e-tests/cli.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import fs, { readFileSync } from "node:fs";
2-
import { basename } from "node:path";
2+
import { basename, join } from "node:path";
33
import { detectPackageManager } from "helpers/packageManagers";
44
import { beforeAll, describe, expect } from "vitest";
55
import { version } from "../package.json";
@@ -438,6 +438,11 @@ describe.skipIf(experimental || frameworkToTest || isQuarantineMode())(
438438
);
439439
expect(output).toContain("Pre-existing Worker (from Dashboard)");
440440
expect(output).toContain("Application created successfully!");
441+
expect(fs.existsSync(join(project.path, "wrangler.jsonc"))).toBe(false);
442+
expect(fs.existsSync(join(project.path, "wrangler.json"))).toBe(false);
443+
expect(
444+
fs.readFileSync(join(project.path, "wrangler.toml"), "utf8"),
445+
).toContain('FOO = "bar"');
441446
});
442447
},
443448
);

packages/create-cloudflare/templates/pre-existing/c3.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export async function copyExistingWorkerFiles(ctx: C3Context) {
5656
{ recursive: true },
5757
);
5858

59-
// copy wrangler.toml from the downloaded Worker
59+
// copy ./wrangler.toml from the downloaded Worker
6060
await cp(
6161
join(tempdir, ctx.args.existingScript, "wrangler.toml"),
6262
join(ctx.project.path, "wrangler.toml"),

packages/create-cloudflare/templates/pre-existing/js/wrangler.jsonc

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)