create-cloudflare 2.35.0 → 2.35.1

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
@@ -73725,7 +73725,7 @@ var Yargs = YargsFactory(esm_default);
73725
73725
  var yargs_default = Yargs;
73726
73726
 
73727
73727
  // package.json
73728
- var version = "2.35.0";
73728
+ var version = "2.35.1";
73729
73729
 
73730
73730
  // src/metrics.ts
73731
73731
  var import_node_async_hooks = require("node:async_hooks");
@@ -74489,10 +74489,10 @@ var package_default = {
74489
74489
  dependencies: {
74490
74490
  "create-astro": "4.11.0",
74491
74491
  "create-analog": "1.8.1",
74492
- "@angular/create": "19.0.4",
74492
+ "@angular/create": "19.0.5",
74493
74493
  "create-docusaurus": "3.6.3",
74494
74494
  "create-hono": "0.14.3",
74495
- "create-next-app": "15.0.3",
74495
+ "create-next-app": "15.1.0",
74496
74496
  "create-qwik": "1.11.0",
74497
74497
  "create-vite": "6.0.1",
74498
74498
  "create-remix": "2.15.1",
@@ -74697,7 +74697,7 @@ var generate2 = async (ctx) => {
74697
74697
  await runFrameworkGenerator(ctx, [ctx.project.name, "--no-install"]);
74698
74698
  logRaw("");
74699
74699
  };
74700
- var configure2 = async (ctx) => {
74700
+ var configure2 = async () => {
74701
74701
  await runCommand([npx, "astro", "add", "cloudflare", "-y"], {
74702
74702
  silent: true,
74703
74703
  startText: "Installing adapter",
@@ -74706,7 +74706,6 @@ var configure2 = async (ctx) => {
74706
74706
  )}`
74707
74707
  });
74708
74708
  updateAstroConfig();
74709
- updateEnvDeclaration(ctx);
74710
74709
  };
74711
74710
  var updateAstroConfig = () => {
74712
74711
  const filePath = "astro.config.mjs";
@@ -74732,26 +74731,6 @@ var updateAstroConfig = () => {
74732
74731
  }
74733
74732
  });
74734
74733
  };
74735
- var updateEnvDeclaration = (ctx) => {
74736
- if (!usesTypescript(ctx)) {
74737
- return;
74738
- }
74739
- const filePath = "src/env.d.ts";
74740
- updateStatus(`Adding type declarations in ${blue(filePath)}`);
74741
- transformFile(filePath, {
74742
- visitProgram: function(n2) {
74743
- const snippets = loadTemplateSnippets(ctx);
74744
- const patch = snippets.runtimeDeclarationTs;
74745
- const b2 = recast2.types.builders;
74746
- const comments = n2.get("comments").value;
74747
- n2.node.comments = comments.map(
74748
- (c2) => b2.commentLine(c2.value)
74749
- );
74750
- n2.get("body").push(...patch);
74751
- return false;
74752
- }
74753
- });
74754
- };
74755
74734
  var config2 = {
74756
74735
  configVersion: 1,
74757
74736
  id: "astro",
@@ -74759,7 +74738,17 @@ var config2 = {
74759
74738
  platform: "workers",
74760
74739
  displayName: "Astro",
74761
74740
  copyFiles: {
74762
- path: "./templates"
74741
+ async selectVariant(ctx) {
74742
+ return usesTypescript(ctx) ? "ts" : "js";
74743
+ },
74744
+ variants: {
74745
+ js: {
74746
+ path: "./templates/js"
74747
+ },
74748
+ ts: {
74749
+ path: "./templates/ts"
74750
+ }
74751
+ }
74763
74752
  },
74764
74753
  devScript: "dev",
74765
74754
  deployScript: "deploy",
@@ -75052,7 +75041,7 @@ var generate7 = async (ctx) => {
75052
75041
  npm4,
75053
75042
  gitFlag
75054
75043
  ]);
75055
- writeFile2("./.node-version", "17");
75044
+ writeFile2("./.node-version", "18");
75056
75045
  logRaw("");
75057
75046
  };
75058
75047
  var configure4 = async (ctx) => {
@@ -75689,7 +75678,7 @@ var generate15 = async (ctx) => {
75689
75678
  await runFrameworkGenerator(ctx, [ctx.project.name, "--no-install"]);
75690
75679
  logRaw("");
75691
75680
  };
75692
- var configure11 = async (ctx) => {
75681
+ var configure11 = async () => {
75693
75682
  await runCommand([npx3, "astro", "add", "cloudflare", "-y"], {
75694
75683
  silent: true,
75695
75684
  startText: "Installing adapter",
@@ -75698,7 +75687,6 @@ var configure11 = async (ctx) => {
75698
75687
  )}`
75699
75688
  });
75700
75689
  updateAstroConfig2();
75701
- updateEnvDeclaration2(ctx);
75702
75690
  };
75703
75691
  var updateAstroConfig2 = () => {
75704
75692
  const filePath = "astro.config.mjs";
@@ -75724,26 +75712,6 @@ var updateAstroConfig2 = () => {
75724
75712
  }
75725
75713
  });
75726
75714
  };
75727
- var updateEnvDeclaration2 = (ctx) => {
75728
- if (!usesTypescript(ctx)) {
75729
- return;
75730
- }
75731
- const filePath = "src/env.d.ts";
75732
- updateStatus(`Adding type declarations in ${blue(filePath)}`);
75733
- transformFile(filePath, {
75734
- visitProgram: function(n2) {
75735
- const snippets = loadTemplateSnippets(ctx);
75736
- const patch = snippets.runtimeDeclarationTs;
75737
- const b2 = recast8.types.builders;
75738
- const comments = n2.get("comments").value;
75739
- n2.node.comments = comments.map(
75740
- (c2) => b2.commentLine(c2.value)
75741
- );
75742
- n2.get("body").push(...patch);
75743
- return false;
75744
- }
75745
- });
75746
- };
75747
75715
  var config16 = {
75748
75716
  configVersion: 1,
75749
75717
  id: "astro",
@@ -75751,7 +75719,17 @@ var config16 = {
75751
75719
  platform: "pages",
75752
75720
  displayName: "Astro",
75753
75721
  copyFiles: {
75754
- path: "./templates"
75722
+ async selectVariant(ctx) {
75723
+ return usesTypescript(ctx) ? "ts" : "js";
75724
+ },
75725
+ variants: {
75726
+ js: {
75727
+ path: "./templates/js"
75728
+ },
75729
+ ts: {
75730
+ path: "./templates/ts"
75731
+ }
75732
+ }
75755
75733
  },
75756
75734
  devScript: "dev",
75757
75735
  deployScript: "deploy",
@@ -76128,7 +76106,7 @@ var generate20 = async (ctx) => {
76128
76106
  npm15,
76129
76107
  gitFlag
76130
76108
  ]);
76131
- writeFile2("./.node-version", "17");
76109
+ writeFile2("./.node-version", "18");
76132
76110
  logRaw("");
76133
76111
  };
76134
76112
  var configure14 = async (ctx) => {
@@ -76872,7 +76850,7 @@ var config26 = {
76872
76850
  var c3_default36 = config26;
76873
76851
 
76874
76852
  // ../wrangler/package.json
76875
- var version2 = "3.96.0";
76853
+ var version2 = "3.97.0";
76876
76854
 
76877
76855
  // src/git.ts
76878
76856
  var offerGit = async (ctx) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-cloudflare",
3
- "version": "2.35.0",
3
+ "version": "2.35.1",
4
4
  "description": "A CLI for creating and deploying new applications to Cloudflare.",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -67,9 +67,9 @@
67
67
  "xdg-app-paths": "^8.3.0",
68
68
  "yargs": "^17.7.2",
69
69
  "@cloudflare/cli": "1.1.1",
70
+ "wrangler": "3.97.0",
70
71
  "@cloudflare/workers-tsconfig": "0.0.0",
71
- "@cloudflare/eslint-config-worker": "1.1.0",
72
- "wrangler": "3.96.0"
72
+ "@cloudflare/eslint-config-worker": "1.1.0"
73
73
  },
74
74
  "engines": {
75
75
  "node": ">=18.14.1"
@@ -1,7 +1,7 @@
1
1
  import { logRaw, updateStatus } from "@cloudflare/cli";
2
2
  import { blue, brandColor, dim } from "@cloudflare/cli/colors";
3
3
  import { runFrameworkGenerator } from "frameworks/index";
4
- import { loadTemplateSnippets, transformFile } from "helpers/codemod";
4
+ import { transformFile } from "helpers/codemod";
5
5
  import { runCommand } from "helpers/command";
6
6
  import { usesTypescript } from "helpers/files";
7
7
  import { detectPackageManager } from "helpers/packageManagers";
@@ -17,7 +17,7 @@ const generate = async (ctx: C3Context) => {
17
17
  logRaw(""); // newline
18
18
  };
19
19
 
20
- const configure = async (ctx: C3Context) => {
20
+ const configure = async () => {
21
21
  await runCommand([npx, "astro", "add", "cloudflare", "-y"], {
22
22
  silent: true,
23
23
  startText: "Installing adapter",
@@ -27,7 +27,6 @@ const configure = async (ctx: C3Context) => {
27
27
  });
28
28
 
29
29
  updateAstroConfig();
30
- updateEnvDeclaration(ctx);
31
30
  };
32
31
 
33
32
  const updateAstroConfig = () => {
@@ -59,35 +58,6 @@ const updateAstroConfig = () => {
59
58
  });
60
59
  };
61
60
 
62
- const updateEnvDeclaration = (ctx: C3Context) => {
63
- if (!usesTypescript(ctx)) {
64
- return;
65
- }
66
-
67
- const filePath = "src/env.d.ts";
68
-
69
- updateStatus(`Adding type declarations in ${blue(filePath)}`);
70
-
71
- transformFile(filePath, {
72
- visitProgram: function (n) {
73
- const snippets = loadTemplateSnippets(ctx);
74
- const patch = snippets.runtimeDeclarationTs;
75
- const b = recast.types.builders;
76
-
77
- // Preserve comments with the new body
78
- const comments = n.get("comments").value;
79
- n.node.comments = comments.map((c: recast.types.namedTypes.CommentLine) =>
80
- b.commentLine(c.value),
81
- );
82
-
83
- // Add the patch
84
- n.get("body").push(...patch);
85
-
86
- return false;
87
- },
88
- });
89
- };
90
-
91
61
  const config: TemplateConfig = {
92
62
  configVersion: 1,
93
63
  id: "astro",
@@ -95,7 +65,21 @@ const config: TemplateConfig = {
95
65
  platform: "pages",
96
66
  displayName: "Astro",
97
67
  copyFiles: {
98
- path: "./templates",
68
+ async selectVariant(ctx) {
69
+ // Note: this `selectVariant` function should not be needed
70
+ // this is just a quick workaround until
71
+ // https://github.com/cloudflare/workers-sdk/issues/7495
72
+ // is resolved
73
+ return usesTypescript(ctx) ? "ts" : "js";
74
+ },
75
+ variants: {
76
+ js: {
77
+ path: "./templates/js",
78
+ },
79
+ ts: {
80
+ path: "./templates/ts",
81
+ },
82
+ },
99
83
  },
100
84
  devScript: "dev",
101
85
  deployScript: "deploy",
@@ -0,0 +1,4 @@
1
+ // Generated by Wrangler
2
+ // After adding bindings to `wrangler.toml`, regenerate this interface via `npm run cf-typegen`
3
+ interface Env {
4
+ }
@@ -0,0 +1,86 @@
1
+ #:schema node_modules/wrangler/config-schema.json
2
+ name = "<TBD>"
3
+ compatibility_date = "<TBD>"
4
+ compatibility_flags = ["nodejs_compat"]
5
+ pages_build_output_dir = "./dist"
6
+
7
+ # Automatically place your workloads in an optimal location to minimize latency.
8
+ # If you are running back-end logic in a Pages Function, running it closer to your back-end infrastructure
9
+ # rather than the end user may result in better performance.
10
+ # Docs: https://developers.cloudflare.com/pages/functions/smart-placement/#smart-placement
11
+ # [placement]
12
+ # mode = "smart"
13
+
14
+ # Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
15
+ # Docs:
16
+ # - https://developers.cloudflare.com/pages/functions/bindings/#environment-variables
17
+ # Note: Use secrets to store sensitive data.
18
+ # - https://developers.cloudflare.com/pages/functions/bindings/#secrets
19
+ # [vars]
20
+ # MY_VARIABLE = "production_value"
21
+
22
+ # Bind the Workers AI model catalog. Run machine learning models, powered by serverless GPUs, on Cloudflare’s global network
23
+ # Docs: https://developers.cloudflare.com/pages/functions/bindings/#workers-ai
24
+ # [ai]
25
+ # binding = "AI"
26
+
27
+ # Bind a D1 database. D1 is Cloudflare’s native serverless SQL database.
28
+ # Docs: https://developers.cloudflare.com/pages/functions/bindings/#d1-databases
29
+ # [[d1_databases]]
30
+ # binding = "MY_DB"
31
+ # database_name = "my-database"
32
+ # database_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
33
+
34
+ # Bind a Durable Object. Durable objects are a scale-to-zero compute primitive based on the actor model.
35
+ # Durable Objects can live for as long as needed. Use these when you need a long-running "server", such as in realtime apps.
36
+ # Docs: https://developers.cloudflare.com/workers/runtime-apis/durable-objects
37
+ # [[durable_objects.bindings]]
38
+ # name = "MY_DURABLE_OBJECT"
39
+ # class_name = "MyDurableObject"
40
+ # script_name = 'my-durable-object'
41
+
42
+ # Bind a KV Namespace. Use KV as persistent storage for small key-value pairs.
43
+ # Docs: https://developers.cloudflare.com/pages/functions/bindings/#kv-namespaces
44
+ # [[kv_namespaces]]
45
+ # binding = "MY_KV_NAMESPACE"
46
+ # id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
47
+
48
+ # Bind a Queue producer. Use this binding to schedule an arbitrary task that may be processed later by a Queue consumer.
49
+ # Docs: https://developers.cloudflare.com/pages/functions/bindings/#queue-producers
50
+ # [[queues.producers]]
51
+ # binding = "MY_QUEUE"
52
+ # queue = "my-queue"
53
+
54
+ # Bind an R2 Bucket. Use R2 to store arbitrarily large blobs of data, such as files.
55
+ # Docs: https://developers.cloudflare.com/pages/functions/bindings/#r2-buckets
56
+ # [[r2_buckets]]
57
+ # binding = "MY_BUCKET"
58
+ # bucket_name = "my-bucket"
59
+
60
+ # Bind another Worker service. Use this binding to call another Worker without network overhead.
61
+ # Docs: https://developers.cloudflare.com/pages/functions/bindings/#service-bindings
62
+ # [[services]]
63
+ # binding = "MY_SERVICE"
64
+ # service = "my-service"
65
+
66
+ # To use different bindings for preview and production environments, follow the examples below.
67
+ # When using environment-specific overrides for bindings, ALL bindings must be specified on a per-environment basis.
68
+ # Docs: https://developers.cloudflare.com/pages/functions/wrangler-configuration#environment-specific-overrides
69
+
70
+ ######## PREVIEW environment config ########
71
+
72
+ # [env.preview.vars]
73
+ # API_KEY = "xyz789"
74
+
75
+ # [[env.preview.kv_namespaces]]
76
+ # binding = "MY_KV_NAMESPACE"
77
+ # id = "<PREVIEW_NAMESPACE_ID>"
78
+
79
+ ######## PRODUCTION environment config ########
80
+
81
+ # [env.production.vars]
82
+ # API_KEY = "abc123"
83
+
84
+ # [[env.production.kv_namespaces]]
85
+ # binding = "MY_KV_NAMESPACE"
86
+ # id = "<PRODUCTION_NAMESPACE_ID>"
@@ -24,7 +24,7 @@ const generate = async (ctx: C3Context) => {
24
24
  gitFlag,
25
25
  ]);
26
26
 
27
- writeFile("./.node-version", "17");
27
+ writeFile("./.node-version", "18");
28
28
 
29
29
  logRaw(""); // newline
30
30
  };
@@ -1,7 +1,7 @@
1
1
  import { logRaw, updateStatus } from "@cloudflare/cli";
2
2
  import { blue, brandColor, dim } from "@cloudflare/cli/colors";
3
3
  import { runFrameworkGenerator } from "frameworks/index";
4
- import { loadTemplateSnippets, transformFile } from "helpers/codemod";
4
+ import { transformFile } from "helpers/codemod";
5
5
  import { runCommand } from "helpers/command";
6
6
  import { usesTypescript } from "helpers/files";
7
7
  import { detectPackageManager } from "helpers/packageManagers";
@@ -17,7 +17,7 @@ const generate = async (ctx: C3Context) => {
17
17
  logRaw(""); // newline
18
18
  };
19
19
 
20
- const configure = async (ctx: C3Context) => {
20
+ const configure = async () => {
21
21
  await runCommand([npx, "astro", "add", "cloudflare", "-y"], {
22
22
  silent: true,
23
23
  startText: "Installing adapter",
@@ -27,7 +27,6 @@ const configure = async (ctx: C3Context) => {
27
27
  });
28
28
 
29
29
  updateAstroConfig();
30
- updateEnvDeclaration(ctx);
31
30
  };
32
31
 
33
32
  const updateAstroConfig = () => {
@@ -59,35 +58,6 @@ const updateAstroConfig = () => {
59
58
  });
60
59
  };
61
60
 
62
- const updateEnvDeclaration = (ctx: C3Context) => {
63
- if (!usesTypescript(ctx)) {
64
- return;
65
- }
66
-
67
- const filePath = "src/env.d.ts";
68
-
69
- updateStatus(`Adding type declarations in ${blue(filePath)}`);
70
-
71
- transformFile(filePath, {
72
- visitProgram: function (n) {
73
- const snippets = loadTemplateSnippets(ctx);
74
- const patch = snippets.runtimeDeclarationTs;
75
- const b = recast.types.builders;
76
-
77
- // Preserve comments with the new body
78
- const comments = n.get("comments").value;
79
- n.node.comments = comments.map((c: recast.types.namedTypes.CommentLine) =>
80
- b.commentLine(c.value),
81
- );
82
-
83
- // Add the patch
84
- n.get("body").push(...patch);
85
-
86
- return false;
87
- },
88
- });
89
- };
90
-
91
61
  const config: TemplateConfig = {
92
62
  configVersion: 1,
93
63
  id: "astro",
@@ -95,7 +65,21 @@ const config: TemplateConfig = {
95
65
  platform: "workers",
96
66
  displayName: "Astro",
97
67
  copyFiles: {
98
- path: "./templates",
68
+ async selectVariant(ctx) {
69
+ // Note: this `selectVariant` function should not be needed
70
+ // this is just a quick workaround until
71
+ // https://github.com/cloudflare/workers-sdk/issues/7495
72
+ // is resolved
73
+ return usesTypescript(ctx) ? "ts" : "js";
74
+ },
75
+ variants: {
76
+ js: {
77
+ path: "./templates/js",
78
+ },
79
+ ts: {
80
+ path: "./templates/ts",
81
+ },
82
+ },
99
83
  },
100
84
  devScript: "dev",
101
85
  deployScript: "deploy",
@@ -0,0 +1,4 @@
1
+ _worker.js
2
+ _routes.json
3
+ _headers
4
+ _redirects
@@ -0,0 +1,4 @@
1
+ // Generated by Wrangler
2
+ // After adding bindings to `wrangler.toml`, regenerate this interface via `npm run cf-typegen`
3
+ interface Env {
4
+ }
@@ -0,0 +1,12 @@
1
+ #:schema node_modules/wrangler/config-schema.json
2
+ name = "<TBD>"
3
+ compatibility_date = "<TBD>"
4
+ compatibility_flags = ["nodejs_compat"]
5
+ main = "./dist/_worker.js/index.js"
6
+ assets = { directory = "./dist", binding = "ASSETS" }
7
+
8
+ # Workers Logs
9
+ # Docs: https://developers.cloudflare.com/workers/observability/logs/workers-logs/
10
+ # Configuration: https://developers.cloudflare.com/workers/observability/logs/workers-logs/#enable-workers-logs
11
+ [observability]
12
+ enabled = true
@@ -24,7 +24,7 @@ const generate = async (ctx: C3Context) => {
24
24
  gitFlag,
25
25
  ]);
26
26
 
27
- writeFile("./.node-version", "17");
27
+ writeFile("./.node-version", "18");
28
28
 
29
29
  logRaw(""); // newline
30
30
  };