Skip to content

Commit 524d8c5

Browse files
remove unnecessary src/entry.cloudflare-pages.tsx step
1 parent 3c1d9d3 commit 524d8c5

File tree

4 files changed

+7
-105
lines changed

4 files changed

+7
-105
lines changed

‎.changeset/sweet-adults-open.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: remove unnecessary step in qwik templates
6+
7+
The step that modifies the `src/entry.cloudflare-pages.tsx` file doesn't seem to change the file in any way anymore, so it's been removed

‎packages/create-cloudflare/templates/qwik/pages/c3.ts‎

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const configure = async (ctx: C3Context) => {
2424
await runCommand(cmd);
2525

2626
addBindingsProxy(ctx);
27-
populateCloudflareEnv();
2827
};
2928

3029
const addBindingsProxy = (ctx: C3Context) => {
@@ -89,40 +88,6 @@ const addBindingsProxy = (ctx: C3Context) => {
8988
s.stop(`${brandColor("updated")} \`vite.config.ts\``);
9089
};
9190

92-
const populateCloudflareEnv = () => {
93-
const entrypointPath = "src/entry.cloudflare-pages.tsx";
94-
95-
const s = spinner();
96-
s.start(`Updating \`${entrypointPath}\``);
97-
98-
transformFile(entrypointPath, {
99-
visitTSInterfaceDeclaration: function (n) {
100-
const b = recast.types.builders;
101-
const id = n.node.id as recast.types.namedTypes.Identifier;
102-
if (id.name !== "QwikCityPlatform") {
103-
this.traverse(n);
104-
}
105-
106-
const newBody = [
107-
["env", "Env"],
108-
// Qwik doesn't supply `cf` to the platform object. Should they do so, uncomment this
109-
// ["cf", "CfProperties"],
110-
].map(([varName, type]) =>
111-
b.tsPropertySignature(
112-
b.identifier(varName),
113-
b.tsTypeAnnotation(b.tsTypeReference(b.identifier(type))),
114-
),
115-
);
116-
117-
n.node.body.body = newBody;
118-
119-
return false;
120-
},
121-
});
122-
123-
s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
124-
};
125-
12691
const config: TemplateConfig = {
12792
configVersion: 1,
12893
id: "qwik",

‎packages/create-cloudflare/templates/qwik/workers/c3.ts‎

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ const configure = async (ctx: C3Context) => {
2727
removeFile("./public/_routes.json");
2828

2929
addBindingsProxy(ctx);
30-
populateCloudflareEnv();
3130
};
3231

3332
const addBindingsProxy = (ctx: C3Context) => {
@@ -92,40 +91,6 @@ const addBindingsProxy = (ctx: C3Context) => {
9291
s.stop(`${brandColor("updated")} \`vite.config.ts\``);
9392
};
9493

95-
const populateCloudflareEnv = () => {
96-
const entrypointPath = "src/entry.cloudflare-pages.tsx";
97-
98-
const s = spinner();
99-
s.start(`Updating \`${entrypointPath}\``);
100-
101-
transformFile(entrypointPath, {
102-
visitTSInterfaceDeclaration: function (n) {
103-
const b = recast.types.builders;
104-
const id = n.node.id as recast.types.namedTypes.Identifier;
105-
if (id.name !== "QwikCityPlatform") {
106-
this.traverse(n);
107-
}
108-
109-
const newBody = [
110-
["env", "Env"],
111-
// Qwik doesn't supply `cf` to the platform object. Should they do so, uncomment this
112-
// ["cf", "CfProperties"],
113-
].map(([varName, type]) =>
114-
b.tsPropertySignature(
115-
b.identifier(varName),
116-
b.tsTypeAnnotation(b.tsTypeReference(b.identifier(type))),
117-
),
118-
);
119-
120-
n.node.body.body = newBody;
121-
122-
return false;
123-
},
124-
});
125-
126-
s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
127-
};
128-
12994
const config: TemplateConfig = {
13095
configVersion: 1,
13196
id: "qwik",

‎packages/wrangler/src/autoconfig/frameworks/qwik.ts‎

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export class Qwik extends Framework {
3434
await runCommand(cmd);
3535

3636
addBindingsProxy(projectPath);
37-
populateCloudflareEnv();
3837

3938
await addAssetsIgnoreFile(projectPath);
4039
}
@@ -133,40 +132,6 @@ function addBindingsProxy(projectPath: string) {
133132
s.stop(`${brandColor("updated")} \`vite.config.ts\``);
134133
}
135134

136-
function populateCloudflareEnv() {
137-
const entrypointPath = "src/entry.cloudflare-pages.tsx";
138-
139-
const s = spinner();
140-
s.start(`Updating \`${entrypointPath}\``);
141-
142-
transformFile(entrypointPath, {
143-
visitTSInterfaceDeclaration: function (n) {
144-
const b = recast.types.builders;
145-
const id = n.node.id as recast.types.namedTypes.Identifier;
146-
if (id.name !== "QwikCityPlatform") {
147-
this.traverse(n);
148-
}
149-
150-
const newBody = [
151-
["env", "Env"],
152-
// Qwik doesn't supply `cf` to the platform object. Should they do so, uncomment this
153-
// ["cf", "CfProperties"],
154-
].map(([varName, type]) =>
155-
b.tsPropertySignature(
156-
b.identifier(varName),
157-
b.tsTypeAnnotation(b.tsTypeReference(b.identifier(type)))
158-
)
159-
);
160-
161-
n.node.body.body = newBody;
162-
163-
return false;
164-
},
165-
});
166-
167-
s.stop(`${brandColor("updated")} \`${entrypointPath}\``);
168-
}
169-
170135
async function addAssetsIgnoreFile(projectPath: string) {
171136
const toAdd = ["_worker.js", "_routes.json", "_headers", "_redirects"];
172137

0 commit comments

Comments
 (0)