create-cloudflare 0.0.0-624882eae → 0.0.0-6291fa161

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.
Files changed (45) hide show
  1. package/dist/cli.js +89 -47
  2. package/dist/tsconfig.tsbuildinfo +1 -1
  3. package/package.json +8 -8
  4. package/templates/angular/pages/c3.ts +1 -0
  5. package/templates/astro/pages/c3.ts +1 -0
  6. package/templates/astro/workers/templates/ts/wrangler.jsonc +1 -1
  7. package/templates/docusaurus/pages/c3.ts +1 -0
  8. package/templates/gatsby/pages/c3.ts +1 -0
  9. package/templates/hello-world-assets-only/c3.ts +2 -2
  10. package/templates/hello-world-with-assets/c3.ts +3 -2
  11. package/templates/hono/pages/c3.ts +1 -0
  12. package/templates/next/pages/c3.ts +1 -0
  13. package/templates/next/workers/c3.ts +4 -4
  14. package/templates/next/workers/templates/open-next.config.ts +5 -2
  15. package/templates/next/workers/templates/wrangler.jsonc +1 -1
  16. package/templates/nuxt/pages/c3.ts +1 -0
  17. package/templates/openapi/ts/__dot__gitignore +1 -0
  18. package/templates/openapi/ts/package.json +7 -6
  19. package/templates/openapi/ts/src/endpoints/taskCreate.ts +2 -2
  20. package/templates/openapi/ts/src/endpoints/taskDelete.ts +2 -2
  21. package/templates/openapi/ts/src/endpoints/taskFetch.ts +2 -2
  22. package/templates/openapi/ts/src/endpoints/taskList.ts +2 -2
  23. package/templates/openapi/ts/src/index.ts +4 -1
  24. package/templates/openapi/ts/src/types.ts +3 -0
  25. package/templates/openapi/ts/tsconfig.json +18 -20
  26. package/templates/pre-existing/c3.ts +1 -1
  27. package/templates/qwik/pages/c3.ts +1 -0
  28. package/templates/qwik/workers/c3.ts +2 -4
  29. package/templates/react/pages/c3.ts +1 -0
  30. package/templates/react/workers/c3.ts +1 -1
  31. package/templates/react/workers/js/src/App.jsx +1 -1
  32. package/templates/react/workers/js/{api → worker}/index.js +1 -1
  33. package/templates/react/workers/js/wrangler.jsonc +2 -2
  34. package/templates/react/workers/ts/src/App.tsx +1 -1
  35. package/templates/react/workers/ts/tsconfig.worker.json +2 -2
  36. package/templates/react/workers/ts/{api → worker}/index.ts +2 -3
  37. package/templates/react/workers/ts/wrangler.jsonc +2 -2
  38. package/templates/remix/pages/c3.ts +1 -0
  39. package/templates/scheduled/ts/src/index.ts +7 -0
  40. package/templates/svelte/pages/c3.ts +1 -0
  41. package/templates/vue/pages/c3.ts +1 -0
  42. package/templates/vue/workers/js/server/index.js +2 -2
  43. package/templates/vue/workers/js/wrangler.jsonc +0 -1
  44. package/templates/vue/workers/ts/server/index.ts +2 -3
  45. package/templates/vue/workers/ts/wrangler.jsonc +0 -1
package/dist/cli.js CHANGED
@@ -74560,7 +74560,7 @@ var Yargs = YargsFactory(esm_default);
74560
74560
  var yargs_default = Yargs;
74561
74561
 
74562
74562
  // package.json
74563
- var version = "0.0.0-624882eae";
74563
+ var version = "0.0.0-6291fa161";
74564
74564
 
74565
74565
  // src/metrics.ts
74566
74566
  var import_node_async_hooks = require("node:async_hooks");
@@ -75335,21 +75335,21 @@ var package_default = {
75335
75335
  "so that we can use dependabot to update these dependencies automatically."
75336
75336
  ],
75337
75337
  dependencies: {
75338
- "create-astro": "4.11.1",
75338
+ "create-astro": "4.11.2",
75339
75339
  "create-analog": "1.8.1",
75340
- "@angular/create": "19.2.5",
75340
+ "@angular/create": "19.2.8",
75341
75341
  "create-docusaurus": "3.7.0",
75342
- "create-hono": "0.15.3",
75343
- "create-next-app": "15.2.1",
75344
- "create-qwik": "1.12.0",
75345
- "create-vite": "6.1.1",
75346
- "create-remix": "2.15.3",
75347
- "create-react-router": "7.4.1",
75342
+ "create-hono": "0.17.0",
75343
+ "create-next-app": "15.3.1",
75344
+ "create-qwik": "1.13.0",
75345
+ "create-vite": "6.4.1",
75346
+ "create-remix": "2.16.5",
75347
+ "create-react-router": "7.5.1",
75348
75348
  "create-solid": "0.6.2",
75349
- "create-vue": "3.15.1",
75350
- gatsby: "5.14.1",
75351
- sv: "0.6.23",
75352
- nuxi: "3.21.1"
75349
+ "create-vue": "3.16.4",
75350
+ gatsby: "5.14.3",
75351
+ sv: "0.8.1",
75352
+ nuxi: "3.25.0"
75353
75353
  }
75354
75354
  };
75355
75355
 
@@ -75750,6 +75750,7 @@ var config3 = {
75750
75750
  frameworkCli: "@angular/create",
75751
75751
  displayName: "Angular",
75752
75752
  platform: "pages",
75753
+ hidden: true,
75753
75754
  copyFiles: {
75754
75755
  path: "./templates"
75755
75756
  },
@@ -75909,6 +75910,7 @@ var config6 = {
75909
75910
  id: "astro",
75910
75911
  frameworkCli: "create-astro",
75911
75912
  platform: "pages",
75913
+ hidden: true,
75912
75914
  displayName: "Astro",
75913
75915
  path: "templates/astro/pages",
75914
75916
  copyFiles: {
@@ -76053,6 +76055,7 @@ var config10 = {
76053
76055
  id: "docusaurus",
76054
76056
  frameworkCli: "create-docusaurus",
76055
76057
  platform: "pages",
76058
+ hidden: true,
76056
76059
  displayName: "Docusaurus",
76057
76060
  path: "templates/docusaurus/pages",
76058
76061
  generate: generate7,
@@ -76129,6 +76132,7 @@ var config13 = {
76129
76132
  id: "gatsby",
76130
76133
  frameworkCli: "gatsby",
76131
76134
  platform: "pages",
76135
+ hidden: true,
76132
76136
  displayName: "Gatsby",
76133
76137
  path: "templates/gatsby/pages",
76134
76138
  generate: generate9,
@@ -76200,8 +76204,8 @@ var config16 = {
76200
76204
  configVersion: 1,
76201
76205
  id: "hello-world-assets-only",
76202
76206
  path: "templates/hello-world-assets-only",
76203
- displayName: "Assets only",
76204
- description: "For static sites (including SPAs) or when using your own backend",
76207
+ displayName: "Static site",
76208
+ description: "For static sites or when using your own backend. Uses Workers Static Assets.",
76205
76209
  platform: "workers",
76206
76210
  copyFiles: {
76207
76211
  path: "./templates"
@@ -76255,8 +76259,8 @@ var config19 = {
76255
76259
  configVersion: 1,
76256
76260
  id: "hello-world-with-assets",
76257
76261
  path: "templates/hello-world-with-assets",
76258
- displayName: "Worker + Assets",
76259
- description: "For static sites with an API or server-side rendering (SSR)",
76262
+ displayName: "SSR / full-stack app",
76263
+ description: "For sites with a backend API, or server-side rendering (SSR). Uses Static Assets with a Worker.",
76260
76264
  platform: "workers",
76261
76265
  copyFiles: {
76262
76266
  variants: {
@@ -76333,6 +76337,7 @@ var config20 = {
76333
76337
  },
76334
76338
  path: "templates/hono/pages",
76335
76339
  platform: "pages",
76340
+ hidden: true,
76336
76341
  generate: generate11,
76337
76342
  transformPackageJson: async () => ({
76338
76343
  scripts: {
@@ -76496,6 +76501,7 @@ var c3_default24 = {
76496
76501
  id: "next",
76497
76502
  frameworkCli: "create-next-app",
76498
76503
  platform: "pages",
76504
+ hidden: true,
76499
76505
  displayName: "Next.js",
76500
76506
  path: "templates/next/pages",
76501
76507
  generate: generate13,
@@ -76560,7 +76566,7 @@ var generate14 = async (ctx) => {
76560
76566
  };
76561
76567
  var configure8 = async (ctx) => {
76562
76568
  const packages = [
76563
- "@opennextjs/cloudflare@0.5.x",
76569
+ "@opennextjs/cloudflare@~1.0.0-beta.0 || ^1.0.0",
76564
76570
  "@cloudflare/workers-types"
76565
76571
  ];
76566
76572
  await installPackages(packages, {
@@ -76588,7 +76594,7 @@ var c3_default25 = {
76588
76594
  configVersion: 1,
76589
76595
  id: "next",
76590
76596
  frameworkCli: "create-next-app",
76591
- frameworkCliPinnedVersion: "~15.2.2",
76597
+ frameworkCliPinnedVersion: "~15.3.0",
76592
76598
  platform: "workers",
76593
76599
  displayName: "Next.js (using Node.js compat + Workers Assets)",
76594
76600
  path: "templates/next/workers",
@@ -76599,8 +76605,8 @@ var c3_default25 = {
76599
76605
  configure: configure8,
76600
76606
  transformPackageJson: async () => ({
76601
76607
  scripts: {
76602
- deploy: `opennextjs-cloudflare && wrangler deploy`,
76603
- preview: `opennextjs-cloudflare && wrangler dev`,
76608
+ deploy: `opennextjs-cloudflare build && opennextjs-cloudflare deploy`,
76609
+ preview: `opennextjs-cloudflare build && opennextjs-cloudflare preview`,
76604
76610
  "cf-typegen": `wrangler types --env-interface CloudflareEnv cloudflare-env.d.ts`
76605
76611
  }
76606
76612
  }),
@@ -76707,6 +76713,7 @@ var config24 = {
76707
76713
  id: "nuxt",
76708
76714
  frameworkCli: "nuxi",
76709
76715
  platform: "pages",
76716
+ hidden: true,
76710
76717
  displayName: "Nuxt",
76711
76718
  copyFiles: {
76712
76719
  path: "./templates"
@@ -76977,7 +76984,7 @@ async function copyExistingWorkerFiles(ctx) {
76977
76984
  await runCommand(
76978
76985
  [
76979
76986
  ...dlx,
76980
- "wrangler@3",
76987
+ "wrangler@latest",
76981
76988
  "init",
76982
76989
  "--from-dash",
76983
76990
  ctx.args.existingScript,
@@ -77153,6 +77160,7 @@ var config30 = {
77153
77160
  frameworkCli: "create-qwik",
77154
77161
  displayName: "Qwik",
77155
77162
  platform: "pages",
77163
+ hidden: true,
77156
77164
  copyFiles: {
77157
77165
  path: "./templates"
77158
77166
  },
@@ -77182,8 +77190,6 @@ var configure12 = async (ctx) => {
77182
77190
  const cmd = [name2 === "pnpm" ? npm13 : npx5, "qwik", "add", "cloudflare-pages"];
77183
77191
  endSection(`Running ${quoteShellArgs(cmd)}`);
77184
77192
  await runCommand(cmd);
77185
- removeFile("./public/_headers");
77186
- removeFile("./public/_redirects");
77187
77193
  removeFile("./public/_routes.json");
77188
77194
  addBindingsProxy2(ctx);
77189
77195
  populateCloudflareEnv2();
@@ -77223,7 +77229,7 @@ var addBindingsProxy2 = (ctx) => {
77223
77229
  return false;
77224
77230
  }
77225
77231
  if (configArgument.type !== "ObjectExpression") {
77226
- crash("Failed to update `vite.config.ts`");
77232
+ throw new Error("Failed to update `vite.config.ts`");
77227
77233
  }
77228
77234
  configArgument.properties.push(platformPropery);
77229
77235
  return false;
@@ -77365,6 +77371,7 @@ var config34 = {
77365
77371
  frameworkCli: "create-vite",
77366
77372
  displayName: "React",
77367
77373
  platform: "pages",
77374
+ hidden: true,
77368
77375
  path: "templates/react/pages",
77369
77376
  generate: generate20,
77370
77377
  transformPackageJson: async () => ({
@@ -77401,7 +77408,7 @@ var configure13 = async (ctx) => {
77401
77408
  startText: "Installing the Cloudflare Vite plugin",
77402
77409
  doneText: `${brandColor(`installed`)} ${dim("@cloudflare/vite-plugin")}`
77403
77410
  });
77404
- await transformViteConfig(ctx);
77411
+ transformViteConfig(ctx);
77405
77412
  if (usesTypescript(ctx)) {
77406
77413
  updateTsconfigJson();
77407
77414
  }
@@ -77554,6 +77561,7 @@ var config37 = {
77554
77561
  id: "remix",
77555
77562
  frameworkCli: "create-remix",
77556
77563
  platform: "pages",
77564
+ hidden: true,
77557
77565
  displayName: "Remix",
77558
77566
  copyFiles: {
77559
77567
  path: "./templates"
@@ -77810,6 +77818,7 @@ var config42 = {
77810
77818
  frameworkCli: "sv",
77811
77819
  displayName: "SvelteKit",
77812
77820
  platform: "pages",
77821
+ hidden: true,
77813
77822
  copyFiles: {
77814
77823
  path: "./templates"
77815
77824
  },
@@ -77953,6 +77962,7 @@ var config45 = {
77953
77962
  frameworkCli: "create-vue",
77954
77963
  displayName: "Vue",
77955
77964
  platform: "pages",
77965
+ hidden: true,
77956
77966
  path: "templates/pages/vue",
77957
77967
  generate: generate27,
77958
77968
  transformPackageJson: async () => ({
@@ -78053,7 +78063,7 @@ var c3_default50 = config47;
78053
78063
  var import_node_assert = __toESM(require("node:assert"));
78054
78064
 
78055
78065
  // ../wrangler/package.json
78056
- var version2 = "0.0.0-624882eae";
78066
+ var version2 = "0.0.0-6291fa161";
78057
78067
 
78058
78068
  // src/git.ts
78059
78069
  var offerGit = async (ctx) => {
@@ -78429,10 +78439,10 @@ var createContext = async (args, prevArgs) => {
78429
78439
  deriveCorrelatedArgs(args);
78430
78440
  const experimental = args.experimental;
78431
78441
  const frameworkMap = getFrameworkMap({ experimental });
78432
- const helloWorldTemplateMap = await getHelloWorldTemplateMap({
78442
+ const helloWorldTemplateMap = getHelloWorldTemplateMap({
78433
78443
  experimental
78434
78444
  });
78435
- const otherTemplateMap = await getOtherTemplateMap({ experimental });
78445
+ const otherTemplateMap = getOtherTemplateMap({ experimental });
78436
78446
  let linesPrinted = 0;
78437
78447
  const goBack = async (from) => {
78438
78448
  const currentArgs = { ...args };
@@ -78552,21 +78562,31 @@ var createContext = async (args, prevArgs) => {
78552
78562
  throw new Error(`Unsupported framework: ${framework}`);
78553
78563
  }
78554
78564
  if ("platformVariants" in frameworkConfig) {
78565
+ const availableVariants = Object.entries(
78566
+ frameworkConfig.platformVariants
78567
+ ).filter(([, config48]) => !config48.hidden);
78568
+ if (availableVariants.length === 1) {
78569
+ args.platform ??= availableVariants[0][0];
78570
+ }
78555
78571
  const platform3 = await processArgument(args, "platform", {
78556
78572
  type: "select",
78557
78573
  label: "platform",
78558
78574
  question: "Select your deployment platform",
78559
78575
  options: [
78560
- {
78561
- label: "Workers with Assets (BETA)",
78562
- value: "workers",
78563
- description: "Take advantage of the full Developer Platform, including R2, Queues, Durable Objects and more."
78564
- },
78565
- {
78566
- label: "Pages",
78567
- value: "pages",
78568
- description: "Great for simple websites and applications."
78569
- },
78576
+ ...args.platform === "workers" || !frameworkConfig.platformVariants.workers.hidden ? [
78577
+ {
78578
+ label: "Workers with Assets",
78579
+ value: "workers",
78580
+ description: "Take advantage of the full Developer Platform, including R2, Queues, Durable Objects and more."
78581
+ }
78582
+ ] : [],
78583
+ ...args.platform === "pages" || !frameworkConfig.platformVariants.pages.hidden ? [
78584
+ {
78585
+ label: "Pages",
78586
+ value: "pages",
78587
+ description: "Great for simple websites and applications."
78588
+ }
78589
+ ] : [],
78570
78590
  backOption
78571
78591
  ],
78572
78592
  defaultValue: "workers"
@@ -78671,7 +78691,7 @@ async function copyTemplateFiles(ctx) {
78671
78691
  }
78672
78692
  srcdir = (0, import_path13.join)(getTemplatePath(ctx), variantInfo.path);
78673
78693
  }
78674
- const copyDestDir = await getCopyFilesDestinationDir(ctx);
78694
+ const copyDestDir = getCopyFilesDestinationDir(ctx);
78675
78695
  const destdir = (0, import_path13.join)(ctx.project.path, ...copyDestDir ? [copyDestDir] : []);
78676
78696
  const s = spinner();
78677
78697
  s.start(`Copying template files`);
@@ -78694,7 +78714,7 @@ var processRemoteTemplate = async (args) => {
78694
78714
  if (src.startsWith("https://github.com/") && src.includes("/tree/main/")) {
78695
78715
  src = src.replace("https://github.com/", "github:").replace("/tree/main/", "/");
78696
78716
  }
78697
- const path6 = await downloadRemoteTemplate(src);
78717
+ const path6 = await downloadRemoteTemplate(src, args.templateMode);
78698
78718
  const config48 = inferTemplateConfig(path6);
78699
78719
  validateTemplate(path6, config48);
78700
78720
  updateStatus(`${brandColor("template")} ${dim("cloned and validated")}`);
@@ -78753,13 +78773,14 @@ var inferCopyFilesDefinition = (path6) => {
78753
78773
  const copyFiles = Object.keys(variants).length !== 0 ? { variants } : { path: "." };
78754
78774
  return copyFiles;
78755
78775
  };
78756
- var downloadRemoteTemplate = async (src) => {
78776
+ var downloadRemoteTemplate = async (src, mode) => {
78757
78777
  try {
78758
78778
  updateStatus(`Cloning template from: ${blue(src)}`);
78759
78779
  const emitter = (0, import_degit.default)(src, {
78760
78780
  cache: false,
78761
78781
  verbose: false,
78762
- force: true
78782
+ force: true,
78783
+ mode
78763
78784
  });
78764
78785
  const tmpDir = await (0, import_promises4.mkdtemp)((0, import_path13.join)((0, import_os2.tmpdir)(), "c3-template"));
78765
78786
  await emitter.clone(tmpDir);
@@ -78947,12 +78968,12 @@ var cliDefinition = {
78947
78968
  description: `Whether the application should be deployed to Pages or Workers. This is only applicable for Frameworks templates that support both Pages and Workers.`,
78948
78969
  values: [
78949
78970
  {
78950
- name: "pages",
78951
- description: "Create a web application that can be deployed to Pages."
78971
+ name: "workers",
78972
+ description: "Create a web application that can be deployed to Workers."
78952
78973
  },
78953
78974
  {
78954
- name: "workers",
78955
- description: "Create a web application that can be deployed to Workers (BETA)."
78975
+ name: "pages",
78976
+ description: "Create a web application that can be deployed to Pages."
78956
78977
  }
78957
78978
  ],
78958
78979
  requiresArg: true
@@ -79014,6 +79035,27 @@ var cliDefinition = {
79014
79035
  npm create cloudflare -- --template https://github.com/cloudflare/workers-sdk/templates/worker-r2
79015
79036
  `
79016
79037
  },
79038
+ {
79039
+ name: "template-mode",
79040
+ type: "string",
79041
+ requiresArg: true,
79042
+ description: `The mechanism to use when fetching the template.
79043
+
79044
+ Can be either "git" or "tar". "tar" does not support fetching from private
79045
+ repositories. By default, degit will use "tar" if the template is hosted on GitHub, BitBucket, GitLab, or git.sr.ht.
79046
+ Otherwise, it will use "git".
79047
+ `,
79048
+ values: [
79049
+ {
79050
+ name: "git",
79051
+ description: "Use git to fetch the template. Supports private repositories."
79052
+ },
79053
+ {
79054
+ name: "tar",
79055
+ description: "Use tar to fetch the template. Only supported on public repositories hosted on GitHub, BitBucket, GitLab, or git.sr.ht."
79056
+ }
79057
+ ]
79058
+ },
79017
79059
  {
79018
79060
  name: "accept-defaults",
79019
79061
  alias: "y",