create-cloudflare 0.0.0-d4c23d23 → 0.0.0-d4dae6f6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +23 -12
- package/package.json +3 -3
- package/templates/next/README.md +11 -1
- package/templates/next/app/js/app/api/hello/route.js +1 -1
- package/templates/next/app/ts/app/api/hello/route.ts +1 -1
- package/templates/next/c3.ts +23 -4
- package/templates/next/env.d.ts +3 -5
- package/templates/next/pages/js/pages/api/hello.js +1 -1
- package/templates/next/pages/ts/pages/api/hello.ts +1 -1
- package/templates/next/wrangler.toml +2 -1
- package/templates/nuxt/templates/worker-configuration.d.ts +3 -2
- package/templates/qwik/templates/worker-configuration.d.ts +3 -2
- package/templates/remix/c3.ts +1 -1
- package/templates/remix/templates/worker-configuration.d.ts +3 -2
package/dist/cli.js
CHANGED
|
@@ -3810,8 +3810,10 @@ ${grayBar} ${msg}`);
|
|
|
3810
3810
|
}
|
|
3811
3811
|
clearLoop();
|
|
3812
3812
|
} else {
|
|
3813
|
-
|
|
3813
|
+
if (msg) {
|
|
3814
|
+
logUpdate2(`
|
|
3814
3815
|
${grayBar} ${msg}`);
|
|
3816
|
+
}
|
|
3815
3817
|
newline();
|
|
3816
3818
|
}
|
|
3817
3819
|
}
|
|
@@ -3851,7 +3853,7 @@ var init_args = __esm({
|
|
|
3851
3853
|
var version, devDependencies;
|
|
3852
3854
|
var init_package = __esm({
|
|
3853
3855
|
"package.json"() {
|
|
3854
|
-
version = "0.0.0-
|
|
3856
|
+
version = "0.0.0-d4dae6f6";
|
|
3855
3857
|
devDependencies = {
|
|
3856
3858
|
"@babel/parser": "^7.21.3",
|
|
3857
3859
|
"@babel/types": "^7.21.4",
|
|
@@ -24556,15 +24558,15 @@ var init_package2 = __esm({
|
|
|
24556
24558
|
"additionally it also contains a map that maps frameworks to their respective clis"
|
|
24557
24559
|
],
|
|
24558
24560
|
dependencies: {
|
|
24559
|
-
"create-astro": "4.7.
|
|
24561
|
+
"create-astro": "4.7.4",
|
|
24560
24562
|
"@angular/create": "17.2.3",
|
|
24561
24563
|
"create-docusaurus": "3.1.1",
|
|
24562
24564
|
"create-hono": "0.5.0",
|
|
24563
24565
|
"create-next-app": "14.1.0",
|
|
24564
24566
|
"create-qwik": "1.4.5",
|
|
24565
24567
|
"create-react-app": "5.0.1",
|
|
24566
|
-
"create-remix": "2.8.
|
|
24567
|
-
"create-solid": "0.5.
|
|
24568
|
+
"create-remix": "2.8.1",
|
|
24569
|
+
"create-solid": "0.5.5",
|
|
24568
24570
|
"create-svelte": "6.0.9",
|
|
24569
24571
|
"create-vue": "3.9.2",
|
|
24570
24572
|
gatsby: "5.13.3",
|
|
@@ -70807,10 +70809,16 @@ var init_c36 = __esm({
|
|
|
70807
70809
|
generate6 = async (ctx) => {
|
|
70808
70810
|
const projectName = ctx.project.name;
|
|
70809
70811
|
await runFrameworkGenerator(ctx, [projectName]);
|
|
70810
|
-
|
|
70811
|
-
|
|
70812
|
-
|
|
70812
|
+
const wranglerToml = readFile((0, import_path13.join)(getTemplatePath(ctx), "wrangler.toml"));
|
|
70813
|
+
const newTomlContent = wranglerToml.replace(
|
|
70814
|
+
/#\s+\[\[kv_namespaces\]\]\n#\s+binding\s+=\s+"MY_KV_NAMESPACE"\n#\s+id\s+=\s+"[a-zA-Z0-9]+?"/,
|
|
70815
|
+
($1) => `# KV Example:
|
|
70816
|
+
${$1}`
|
|
70813
70817
|
);
|
|
70818
|
+
if (!/# KV Example/.test(newTomlContent)) {
|
|
70819
|
+
crash("Failed to properly generate the wrangler.toml file");
|
|
70820
|
+
}
|
|
70821
|
+
writeFile2((0, import_path13.join)(ctx.project.path, "wrangler.toml"), newTomlContent);
|
|
70814
70822
|
updateStatus("Created wrangler.toml file");
|
|
70815
70823
|
};
|
|
70816
70824
|
updateNextConfig = () => {
|
|
@@ -70941,7 +70949,7 @@ var init_c36 = __esm({
|
|
|
70941
70949
|
}
|
|
70942
70950
|
}
|
|
70943
70951
|
},
|
|
70944
|
-
transformPackageJson: async () => {
|
|
70952
|
+
transformPackageJson: async (_2, ctx) => {
|
|
70945
70953
|
const isNpm = npm4 === "npm";
|
|
70946
70954
|
const isBun = npm4 === "bun";
|
|
70947
70955
|
const isNpmOrBun = isNpm || isBun;
|
|
@@ -70953,7 +70961,10 @@ var init_c36 = __esm({
|
|
|
70953
70961
|
scripts: {
|
|
70954
70962
|
"pages:build": `${pmCommand} ${nextOnPagesCommand}`,
|
|
70955
70963
|
preview: `${pagesBuildRunCommand} && wrangler pages dev .vercel/output/static`,
|
|
70956
|
-
deploy: `${pagesBuildRunCommand} && wrangler pages deploy .vercel/output/static
|
|
70964
|
+
deploy: `${pagesBuildRunCommand} && wrangler pages deploy .vercel/output/static`,
|
|
70965
|
+
...usesTypescript(ctx) && {
|
|
70966
|
+
"build-cf-types": `wrangler types --env-interface CloudflareEnv env.d.ts`
|
|
70967
|
+
}
|
|
70957
70968
|
}
|
|
70958
70969
|
};
|
|
70959
70970
|
},
|
|
@@ -71257,7 +71268,7 @@ var init_c310 = __esm({
|
|
|
71257
71268
|
await runFrameworkGenerator(ctx, [
|
|
71258
71269
|
ctx.project.name,
|
|
71259
71270
|
"--template",
|
|
71260
|
-
"https://github.com/remix-run/remix/tree/main/templates/
|
|
71271
|
+
"https://github.com/remix-run/remix/tree/main/templates/cloudflare"
|
|
71261
71272
|
]);
|
|
71262
71273
|
logRaw("");
|
|
71263
71274
|
};
|
|
@@ -77092,7 +77103,7 @@ init_command();
|
|
|
77092
77103
|
init_packageManagers();
|
|
77093
77104
|
|
|
77094
77105
|
// ../wrangler/package.json
|
|
77095
|
-
var version2 = "3.
|
|
77106
|
+
var version2 = "3.36.0";
|
|
77096
77107
|
|
|
77097
77108
|
// src/git.ts
|
|
77098
77109
|
init_package();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-cloudflare",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-d4dae6f6",
|
|
4
4
|
"description": "A CLI for creating and deploying new applications to Cloudflare.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
"yargs": "^17.7.1",
|
|
68
68
|
"yarn": "^1.22.19",
|
|
69
69
|
"@cloudflare/cli": "1.1.1",
|
|
70
|
-
"
|
|
71
|
-
"
|
|
70
|
+
"wrangler": "3.36.0",
|
|
71
|
+
"@cloudflare/workers-tsconfig": "0.0.0"
|
|
72
72
|
},
|
|
73
73
|
"engines": {
|
|
74
74
|
"node": ">=18.14.1"
|
package/templates/next/README.md
CHANGED
|
@@ -52,7 +52,17 @@ In order to enable the example:
|
|
|
52
52
|
```
|
|
53
53
|
# KV Example:
|
|
54
54
|
```
|
|
55
|
+
- If you're using TypeScript run the `build-cf-types` script to update the `env.d.ts` file:
|
|
56
|
+
```bash
|
|
57
|
+
npm run build-cf-types
|
|
58
|
+
# or
|
|
59
|
+
yarn build-cf-types
|
|
60
|
+
# or
|
|
61
|
+
pnpm build-cf-types
|
|
62
|
+
# or
|
|
63
|
+
bun build-cf-types
|
|
64
|
+
```
|
|
55
65
|
|
|
56
66
|
After doing this you can run the `dev` or `preview` script and visit the `/api/hello` route to see the example in action.
|
|
57
67
|
|
|
58
|
-
Finally, if you also want to see the example work in the deployed application make sure to add a `
|
|
68
|
+
Finally, if you also want to see the example work in the deployed application make sure to add a `MY_KV_NAMESPACE` binding to your Pages application in its [dashboard kv bindings settings section](https://dash.cloudflare.com/?to=/:account/pages/view/:pages-project/settings/functions#kv_namespace_bindings_section). After having configured it make sure to re-deploy your application.
|
|
@@ -12,7 +12,7 @@ export async function GET(request) {
|
|
|
12
12
|
// )
|
|
13
13
|
//
|
|
14
14
|
// KV Example:
|
|
15
|
-
// const myKv = getRequestContext().env.
|
|
15
|
+
// const myKv = getRequestContext().env.MY_KV_NAMESPACE
|
|
16
16
|
// await myKv.put('suffix', ' from a KV store!')
|
|
17
17
|
// const suffix = await myKv.get('suffix')
|
|
18
18
|
// responseText += suffix
|
|
@@ -13,7 +13,7 @@ export async function GET(request: NextRequest) {
|
|
|
13
13
|
// )
|
|
14
14
|
//
|
|
15
15
|
// KV Example:
|
|
16
|
-
// const myKv = getRequestContext().env.
|
|
16
|
+
// const myKv = getRequestContext().env.MY_KV_NAMESPACE
|
|
17
17
|
// await myKv.put('suffix', ' from a KV store!')
|
|
18
18
|
// const suffix = await myKv.get('suffix')
|
|
19
19
|
// responseText += suffix
|
package/templates/next/c3.ts
CHANGED
|
@@ -27,10 +27,26 @@ const generate = async (ctx: C3Context) => {
|
|
|
27
27
|
|
|
28
28
|
await runFrameworkGenerator(ctx, [projectName]);
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
const wranglerToml = readFile(join(getTemplatePath(ctx), "wrangler.toml"));
|
|
31
|
+
|
|
32
|
+
// Note: here we add `# KV Example:` to the toml file for the KV example, we don't actually
|
|
33
|
+
// include the comment in the template wrangler.toml file just so to keep it identical
|
|
34
|
+
// and consistent with that of all the other frameworks
|
|
35
|
+
// (instead of making it a special case which needs extra care)
|
|
36
|
+
const newTomlContent = wranglerToml.replace(
|
|
37
|
+
/#\s+\[\[kv_namespaces\]\]\n#\s+binding\s+=\s+"MY_KV_NAMESPACE"\n#\s+id\s+=\s+"[a-zA-Z0-9]+?"/,
|
|
38
|
+
($1) => `# KV Example:\n${$1}`
|
|
33
39
|
);
|
|
40
|
+
|
|
41
|
+
if (!/# KV Example/.test(newTomlContent)) {
|
|
42
|
+
// This should never happen to users, it is a check mostly so that
|
|
43
|
+
// if the toml file is changed in a way that breaks the "KV Example" addition
|
|
44
|
+
// the C3 Next.js e2e runs will fail with this
|
|
45
|
+
crash("Failed to properly generate the wrangler.toml file");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
writeFile(join(ctx.project.path, "wrangler.toml"), newTomlContent);
|
|
49
|
+
|
|
34
50
|
updateStatus("Created wrangler.toml file");
|
|
35
51
|
};
|
|
36
52
|
|
|
@@ -192,7 +208,7 @@ export default {
|
|
|
192
208
|
},
|
|
193
209
|
},
|
|
194
210
|
},
|
|
195
|
-
transformPackageJson: async () => {
|
|
211
|
+
transformPackageJson: async (_, ctx) => {
|
|
196
212
|
const isNpm = npm === "npm";
|
|
197
213
|
const isBun = npm === "bun";
|
|
198
214
|
const isNpmOrBun = isNpm || isBun;
|
|
@@ -207,6 +223,9 @@ export default {
|
|
|
207
223
|
"pages:build": `${pmCommand} ${nextOnPagesCommand}`,
|
|
208
224
|
preview: `${pagesBuildRunCommand} && wrangler pages dev .vercel/output/static`,
|
|
209
225
|
deploy: `${pagesBuildRunCommand} && wrangler pages deploy .vercel/output/static`,
|
|
226
|
+
...(usesTypescript(ctx) && {
|
|
227
|
+
"build-cf-types": `wrangler types --env-interface CloudflareEnv env.d.ts`,
|
|
228
|
+
}),
|
|
210
229
|
},
|
|
211
230
|
};
|
|
212
231
|
},
|
package/templates/next/env.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
+
// Generated by Wrangler
|
|
2
|
+
// by running `wrangler types --env-interface CloudflareEnv env.d.ts`
|
|
3
|
+
|
|
1
4
|
interface CloudflareEnv {
|
|
2
|
-
// Add here the Cloudflare Bindings you want to have available in your application
|
|
3
|
-
// (for more details on Bindings see: https://developers.cloudflare.com/pages/functions/bindings/)
|
|
4
|
-
//
|
|
5
|
-
// KV Example:
|
|
6
|
-
// MY_KV: KVNamespace
|
|
7
5
|
}
|
|
@@ -14,7 +14,7 @@ export default async function handler(req) {
|
|
|
14
14
|
// )
|
|
15
15
|
//
|
|
16
16
|
// KV Example:
|
|
17
|
-
// const myKv = getRequestContext().env.
|
|
17
|
+
// const myKv = getRequestContext().env.MY_KV_NAMESPACE
|
|
18
18
|
// await myKv.put('suffix', ' from a KV store!')
|
|
19
19
|
// const suffix = await myKv.get('suffix')
|
|
20
20
|
// responseText += suffix
|
|
@@ -15,7 +15,7 @@ export default async function handler(req: NextRequest) {
|
|
|
15
15
|
// )
|
|
16
16
|
//
|
|
17
17
|
// KV Example:
|
|
18
|
-
// const myKv = getRequestContext().env.
|
|
18
|
+
// const myKv = getRequestContext().env.MY_KV_NAMESPACE
|
|
19
19
|
// await myKv.put('suffix', ' from a KV store!')
|
|
20
20
|
// const suffix = await myKv.get('suffix')
|
|
21
21
|
// responseText += suffix
|
package/templates/remix/c3.ts
CHANGED
|
@@ -13,7 +13,7 @@ const generate = async (ctx: C3Context) => {
|
|
|
13
13
|
await runFrameworkGenerator(ctx, [
|
|
14
14
|
ctx.project.name,
|
|
15
15
|
"--template",
|
|
16
|
-
"https://github.com/remix-run/remix/tree/main/templates/
|
|
16
|
+
"https://github.com/remix-run/remix/tree/main/templates/cloudflare",
|
|
17
17
|
]);
|
|
18
18
|
|
|
19
19
|
logRaw(""); // newline
|