create-cloudflare 2.60.0 → 2.61.0

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
@@ -77467,7 +77467,7 @@ var Yargs = YargsFactory(esm_default);
77467
77467
  var yargs_default = Yargs;
77468
77468
 
77469
77469
  // package.json
77470
- var version = "2.60.0";
77470
+ var version = "2.61.0";
77471
77471
 
77472
77472
  // src/metrics.ts
77473
77473
  var import_node_async_hooks = require("node:async_hooks");
@@ -80815,7 +80815,7 @@ var b2 = recast9.types.builders;
80815
80815
  var t = recast9.types.namedTypes;
80816
80816
  var { npm: npm14 } = detectPackageManager();
80817
80817
  var generate20 = async (ctx) => {
80818
- const variant = await getVariant();
80818
+ const variant = await getVariant(ctx);
80819
80819
  ctx.args.lang = variant.lang;
80820
80820
  await runFrameworkGenerator(ctx, [
80821
80821
  ctx.project.name,
@@ -80880,7 +80880,7 @@ function updateTsconfigJson() {
80880
80880
  writeJSON("tsconfig.json", tsconfig);
80881
80881
  s.stop(`${brandColor(`updated`)} ${dim(`\`tsconfig.json\``)}`);
80882
80882
  }
80883
- async function getVariant() {
80883
+ async function getVariant(ctx) {
80884
80884
  const variantsOptions2 = [
80885
80885
  {
80886
80886
  value: "react-ts",
@@ -80903,6 +80903,17 @@ async function getVariant() {
80903
80903
  label: "JavaScript + SWC"
80904
80904
  }
80905
80905
  ];
80906
+ if (ctx.args.variant) {
80907
+ const selected2 = variantsOptions2.find(
80908
+ (variant) => variant.value === ctx.args.variant
80909
+ );
80910
+ if (!selected2) {
80911
+ throw new Error(
80912
+ `Unknown variant "${ctx.args.variant}". Valid variants are: ${variantsOptions2.map((v2) => v2.value).join(", ")}`
80913
+ );
80914
+ }
80915
+ return selected2;
80916
+ }
80906
80917
  const value = await inputPrompt({
80907
80918
  type: "select",
80908
80919
  question: "Select a variant:",
@@ -81497,7 +81508,7 @@ var c3_default49 = config46;
81497
81508
  var import_node_assert4 = __toESM(require("node:assert"));
81498
81509
 
81499
81510
  // ../wrangler/package.json
81500
- var version2 = "4.55.0";
81511
+ var version2 = "4.56.0";
81501
81512
 
81502
81513
  // src/git.ts
81503
81514
  var offerGit = async (ctx) => {
@@ -82510,6 +82521,12 @@ var cliDefinition = {
82510
82521
  ],
82511
82522
  requiresArg: true
82512
82523
  },
82524
+ {
82525
+ name: "variant",
82526
+ type: "string",
82527
+ description: `The variant of the framework to use. This is only applicable for certain frameworks that support multiple variants (e.g. React with TypeScript, TypeScript + SWC, JavaScript, JavaScript + SWC).`,
82528
+ requiresArg: true
82529
+ },
82513
82530
  {
82514
82531
  name: "lang",
82515
82532
  type: "string",
@@ -82892,10 +82909,16 @@ var updateWranglerConfig = async (ctx) => {
82892
82909
  "<COMPATIBILITY_DATE>": await getWorkerdCompatibilityDate()
82893
82910
  };
82894
82911
  if (wranglerJsonOrJsoncExists(ctx)) {
82895
- let wranglerJson = readWranglerJsonOrJsonc(
82896
- ctx,
82897
- (_key, value) => typeof value === "string" && value in substitutions ? substitutions[value] : value
82898
- );
82912
+ let wranglerJson = readWranglerJsonOrJsonc(ctx, (_key, value) => {
82913
+ if (typeof value !== "string") {
82914
+ return value;
82915
+ }
82916
+ let result = value;
82917
+ for (const [placeholder, substitution] of Object.entries(substitutions)) {
82918
+ result = result.replaceAll(placeholder, substitution);
82919
+ }
82920
+ return result;
82921
+ });
82899
82922
  wranglerJson = insertJSONProperty(
82900
82923
  wranglerJson,
82901
82924
  "$schema",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-cloudflare",
3
- "version": "2.60.0",
3
+ "version": "2.61.0",
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/parser": "^7.21.3",
31
31
  "@babel/types": "^7.21.4",
32
32
  "@clack/prompts": "^0.6.3",
33
- "@cloudflare/workers-types": "^4.20251213.0",
33
+ "@cloudflare/workers-types": "^4.20251217.0",
34
34
  "@types/command-exists": "^1.2.0",
35
35
  "@types/cross-spawn": "^6.0.2",
36
36
  "@types/deepmerge": "^2.2.0",
@@ -74,12 +74,12 @@
74
74
  "wrap-ansi": "^9.0.0",
75
75
  "xdg-app-paths": "^8.3.0",
76
76
  "yargs": "^17.7.2",
77
+ "@cloudflare/eslint-config-shared": "1.1.0",
77
78
  "@cloudflare/cli": "1.2.0",
78
- "@cloudflare/workers-tsconfig": "0.0.0",
79
- "@cloudflare/vite-plugin": "1.18.0",
80
79
  "@cloudflare/mock-npm-registry": "0.0.0",
81
- "@cloudflare/eslint-config-shared": "1.1.0",
82
- "wrangler": "4.55.0"
80
+ "@cloudflare/vite-plugin": "1.19.0",
81
+ "@cloudflare/workers-tsconfig": "0.0.0",
82
+ "wrangler": "4.56.0"
83
83
  },
84
84
  "engines": {
85
85
  "node": ">=18.14.1"
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "workflows": [
11
11
  {
12
- "name": "workflows-hello-world",
12
+ "name": "workflow-<WORKER_NAME>",
13
13
  "binding": "MY_WORKFLOW",
14
14
  "class_name": "MyWorkflow",
15
15
  },
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "workflows": [
11
11
  {
12
- "name": "workflows-hello-world",
12
+ "name": "workflow-<WORKER_NAME>",
13
13
  "binding": "MY_WORKFLOW",
14
14
  "class_name": "MyWorkflow",
15
15
  },
@@ -17,7 +17,7 @@ const t = recast.types.namedTypes;
17
17
  const { npm } = detectPackageManager();
18
18
 
19
19
  const generate = async (ctx: C3Context) => {
20
- const variant = await getVariant();
20
+ const variant = await getVariant(ctx);
21
21
  ctx.args.lang = variant.lang;
22
22
 
23
23
  await runFrameworkGenerator(ctx, [
@@ -114,7 +114,7 @@ function updateTsconfigJson() {
114
114
  s.stop(`${brandColor(`updated`)} ${dim(`\`tsconfig.json\``)}`);
115
115
  }
116
116
 
117
- async function getVariant() {
117
+ async function getVariant(ctx: C3Context) {
118
118
  const variantsOptions = [
119
119
  {
120
120
  value: "react-ts",
@@ -137,6 +137,20 @@ async function getVariant() {
137
137
  label: "JavaScript + SWC",
138
138
  },
139
139
  ];
140
+
141
+ // If variant is provided via CLI args, use it directly
142
+ if (ctx.args.variant) {
143
+ const selected = variantsOptions.find(
144
+ (variant) => variant.value === ctx.args.variant,
145
+ );
146
+ if (!selected) {
147
+ throw new Error(
148
+ `Unknown variant "${ctx.args.variant}". Valid variants are: ${variantsOptions.map((v) => v.value).join(", ")}`,
149
+ );
150
+ }
151
+ return selected;
152
+ }
153
+
140
154
  const value = await inputPrompt({
141
155
  type: "select",
142
156
  question: "Select a variant:",