create-cloudflare 0.0.0-93150aa0 → 0.0.0-93437141

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 CHANGED
@@ -3810,8 +3810,10 @@ ${grayBar} ${msg}`);
3810
3810
  }
3811
3811
  clearLoop();
3812
3812
  } else {
3813
- logUpdate2(`
3813
+ if (msg !== void 0) {
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-93150aa0";
3856
+ version = "0.0.0-93437141";
3855
3857
  devDependencies = {
3856
3858
  "@babel/parser": "^7.21.3",
3857
3859
  "@babel/types": "^7.21.4",
@@ -3859,7 +3861,7 @@ var init_package = __esm({
3859
3861
  "@cloudflare/cli": "workspace:*",
3860
3862
  "@cloudflare/eslint-config-worker": "*",
3861
3863
  "@cloudflare/workers-tsconfig": "workspace:*",
3862
- "@cloudflare/workers-types": "^4.20230419.0",
3864
+ "@cloudflare/workers-types": "^4.20240320.1",
3863
3865
  "@iarna/toml": "^3.0.0",
3864
3866
  "@types/command-exists": "^1.2.0",
3865
3867
  "@types/cross-spawn": "^6.0.2",
@@ -24556,19 +24558,19 @@ 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.3",
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.0",
24567
- "create-solid": "0.5.3",
24568
- "create-svelte": "6.0.9",
24568
+ "create-remix": "2.8.1",
24569
+ "create-solid": "0.5.5",
24570
+ "create-svelte": "6.0.10",
24569
24571
  "create-vue": "3.9.2",
24570
24572
  gatsby: "5.13.3",
24571
- nuxi: "3.10.1"
24573
+ nuxi: "3.11.1"
24572
24574
  },
24573
24575
  frameworkCliMap: {
24574
24576
  angular: "@angular/create",
@@ -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
- copyFile(
70811
- (0, import_path13.join)(getTemplatePath(ctx), "wrangler.toml"),
70812
- (0, import_path13.join)(ctx.project.path, "wrangler.toml")
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 = () => {
@@ -71260,7 +71268,7 @@ var init_c310 = __esm({
71260
71268
  await runFrameworkGenerator(ctx, [
71261
71269
  ctx.project.name,
71262
71270
  "--template",
71263
- "https://github.com/remix-run/remix/tree/main/templates/vite-cloudflare"
71271
+ "https://github.com/remix-run/remix/tree/main/templates/cloudflare"
71264
71272
  ]);
71265
71273
  logRaw("");
71266
71274
  };
@@ -71846,7 +71854,7 @@ var init_templates = __esm({
71846
71854
  "hello-world": (await Promise.resolve().then(() => (init_c314(), c3_exports14))).default,
71847
71855
  "hello-world-durable-object": (await Promise.resolve().then(() => (init_c315(), c3_exports15))).default,
71848
71856
  // Dummy record -- actual template config resolved in `selectFramework`
71849
- webFramework: { displayName: "Website or web app" },
71857
+ "web-framework": { displayName: "Website or web app" },
71850
71858
  common: (await Promise.resolve().then(() => (init_c316(), c3_exports16))).default,
71851
71859
  scheduled: (await Promise.resolve().then(() => (init_c317(), c3_exports17))).default,
71852
71860
  queues: (await Promise.resolve().then(() => (init_c318(), c3_exports18))).default,
@@ -71861,13 +71869,19 @@ var init_templates = __esm({
71861
71869
  selectTemplate = async (args) => {
71862
71870
  if (!args.type) {
71863
71871
  if (args.framework) {
71864
- args.type = "webFramework";
71872
+ args.type = "web-framework";
71865
71873
  } else if (args.existingScript) {
71866
71874
  args.type = "pre-existing";
71867
71875
  } else if (args.template) {
71868
71876
  args.type = "remote-template";
71869
71877
  }
71870
71878
  }
71879
+ if (args.type && args.type === "webFramework") {
71880
+ warn(
71881
+ "The `webFramework` type is deprecated and will be removed in a future version. Please use `web-framework` instead."
71882
+ );
71883
+ args.type = "web-framework";
71884
+ }
71871
71885
  const templateMap = await getTemplateMap();
71872
71886
  const templateOptions = Object.entries(templateMap).map(
71873
71887
  ([value, { displayName, hidden: hidden2 }]) => ({
@@ -71889,7 +71903,7 @@ var init_templates = __esm({
71889
71903
  if (!Object.keys(templateMap).includes(type)) {
71890
71904
  return crash(`Unknown application type provided: ${type}.`);
71891
71905
  }
71892
- if (type === "webFramework") {
71906
+ if (type === "web-framework") {
71893
71907
  return selectFramework(args);
71894
71908
  }
71895
71909
  if (type === "remote-template") {
@@ -77095,7 +77109,7 @@ init_command();
77095
77109
  init_packageManagers();
77096
77110
 
77097
77111
  // ../wrangler/package.json
77098
- var version2 = "3.35.0";
77112
+ var version2 = "3.39.0";
77099
77113
 
77100
77114
  // src/git.ts
77101
77115
  init_package();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-cloudflare",
3
- "version": "0.0.0-93150aa0",
3
+ "version": "0.0.0-93437141",
4
4
  "description": "A CLI for creating and deploying new applications to Cloudflare.",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -30,7 +30,7 @@
30
30
  "@babel/types": "^7.21.4",
31
31
  "@clack/prompts": "^0.6.3",
32
32
  "@cloudflare/eslint-config-worker": "*",
33
- "@cloudflare/workers-types": "^4.20230419.0",
33
+ "@cloudflare/workers-types": "^4.20240320.1",
34
34
  "@iarna/toml": "^3.0.0",
35
35
  "@types/command-exists": "^1.2.0",
36
36
  "@types/cross-spawn": "^6.0.2",
@@ -68,7 +68,7 @@
68
68
  "yarn": "^1.22.19",
69
69
  "@cloudflare/cli": "1.1.1",
70
70
  "@cloudflare/workers-tsconfig": "0.0.0",
71
- "wrangler": "3.35.0"
71
+ "wrangler": "3.39.0"
72
72
  },
73
73
  "engines": {
74
74
  "node": ">=18.14.1"
@@ -65,4 +65,4 @@ In order to enable the example:
65
65
 
66
66
  After doing this you can run the `dev` or `preview` script and visit the `/api/hello` route to see the example in action.
67
67
 
68
- Finally, if you also want to see the example work in the deployed application make sure to add a `MY_KV` 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.
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.MY_KV
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.MY_KV
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
@@ -27,10 +27,26 @@ const generate = async (ctx: C3Context) => {
27
27
 
28
28
  await runFrameworkGenerator(ctx, [projectName]);
29
29
 
30
- copyFile(
31
- join(getTemplatePath(ctx), "wrangler.toml"),
32
- join(ctx.project.path, "wrangler.toml")
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
 
@@ -14,7 +14,7 @@ export default async function handler(req) {
14
14
  // )
15
15
  //
16
16
  // KV Example:
17
- // const myKv = getRequestContext().env.MY_KV
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.MY_KV;
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
@@ -52,7 +52,3 @@ compatibility_flags = ["nodejs_compat"]
52
52
  # binding = "MY_SERVICE"
53
53
  # service = "my-service"
54
54
 
55
- # KV Example:
56
- # [[kv_namespaces]]
57
- # binding = "MY_KV"
58
- # id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
@@ -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/vite-cloudflare",
16
+ "https://github.com/remix-run/remix/tree/main/templates/cloudflare",
17
17
  ]);
18
18
 
19
19
  logRaw(""); // newline