create-cloudflare 2.33.0 → 2.33.2

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.33.0";
73728
+ var version = "2.33.2";
73729
73729
 
73730
73730
  // src/metrics.ts
73731
73731
  var import_node_async_hooks = require("node:async_hooks");
@@ -74486,7 +74486,7 @@ var package_default = {
74486
74486
  "create-docusaurus": "3.6.1",
74487
74487
  "create-hono": "0.14.2",
74488
74488
  "create-next-app": "14.2.5",
74489
- "create-qwik": "1.9.1",
74489
+ "create-qwik": "1.11.0",
74490
74490
  "create-vite": "5.5.5",
74491
74491
  "create-remix": "2.14.0",
74492
74492
  "create-solid": "0.5.13",
@@ -74526,7 +74526,11 @@ var runFrameworkGenerator = async (ctx, args) => {
74526
74526
  // templates-experimental/angular/c3.ts
74527
74527
  var { npm } = detectPackageManager();
74528
74528
  var generate = async (ctx) => {
74529
- await runFrameworkGenerator(ctx, [ctx.project.name, "--ssr"]);
74529
+ await runFrameworkGenerator(ctx, [
74530
+ ctx.project.name,
74531
+ "--ssr",
74532
+ "--server-routing"
74533
+ ]);
74530
74534
  logRaw("");
74531
74535
  };
74532
74536
  var configure = async (ctx) => {
@@ -74535,9 +74539,9 @@ var configure = async (ctx) => {
74535
74539
  await installCFWorker();
74536
74540
  };
74537
74541
  async function installCFWorker() {
74538
- await installPackages(["@cloudflare/workers-types", "wrangler"], {
74542
+ await installPackages(["xhr2"], {
74539
74543
  dev: true,
74540
- startText: "Installing adapter dependencies",
74544
+ startText: "Installing additional dependencies",
74541
74545
  doneText: `${brandColor("installed")} ${dim(`via \`${npm} install\``)}`
74542
74546
  });
74543
74547
  }
@@ -74552,10 +74556,17 @@ async function updateAppCode() {
74552
74556
  );
74553
74557
  writeFile2((0, import_node_path3.resolve)(appConfigPath), newAppConfig);
74554
74558
  s.stop(`${brandColor(`updated`)} ${dim(appConfigPath)}`);
74559
+ const appServerRoutesPath = "src/app/app.routes.server.ts";
74560
+ const appRoutes = readFile((0, import_node_path3.resolve)(appServerRoutesPath));
74561
+ const newAppRoutes = appRoutes.replace(
74562
+ "RenderMode.Prerender",
74563
+ "RenderMode.Server"
74564
+ );
74565
+ writeFile2((0, import_node_path3.resolve)(appServerRoutesPath), newAppRoutes);
74566
+ s.stop(`${brandColor(`updated`)} ${dim(appServerRoutesPath)}`);
74555
74567
  s.start(`Updating package.json`);
74556
74568
  const packageJsonPath = (0, import_node_path3.resolve)("package.json");
74557
74569
  const packageManifest = readJSON(packageJsonPath);
74558
- delete packageManifest["dependencies"]["@angular/ssr"];
74559
74570
  delete packageManifest["dependencies"]["express"];
74560
74571
  delete packageManifest["devDependencies"]["@types/express"];
74561
74572
  writeFile2(packageJsonPath, JSON.stringify(packageManifest, null, 2));
@@ -74567,7 +74578,8 @@ function updateAngularJson(ctx) {
74567
74578
  const angularJson = readJSON((0, import_node_path3.resolve)("angular.json"));
74568
74579
  const architectSection = angularJson.projects[ctx.project.name].architect;
74569
74580
  architectSection.build.options.outputPath = "dist";
74570
- architectSection.build.options.assets.push("src/_routes.json");
74581
+ architectSection.build.options.outputMode = "server";
74582
+ architectSection.build.options.ssr.experimentalPlatform = "neutral";
74571
74583
  writeFile2((0, import_node_path3.resolve)("angular.json"), JSON.stringify(angularJson, null, 2));
74572
74584
  s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
74573
74585
  }
@@ -74583,13 +74595,13 @@ var config = {
74583
74595
  path: "templates-experimental/angular",
74584
74596
  devScript: "start",
74585
74597
  deployScript: "deploy",
74598
+ previewScript: "start",
74586
74599
  generate,
74587
74600
  configure,
74588
74601
  transformPackageJson: async () => ({
74589
74602
  scripts: {
74590
74603
  start: `${npm} run build && wrangler dev`,
74591
- build: `ng build && ${npm} run process`,
74592
- process: "node ./tools/alter-polyfills.mjs",
74604
+ build: `ng build`,
74593
74605
  deploy: `${npm} run build && wrangler deploy`
74594
74606
  }
74595
74607
  })
@@ -75609,14 +75621,11 @@ var configure10 = async (ctx) => {
75609
75621
  await installCFWorker2();
75610
75622
  };
75611
75623
  async function installCFWorker2() {
75612
- await installPackages(
75613
- ["@cloudflare/workers-types", "@miniflare/tre@next", "wrangler@beta"],
75614
- {
75615
- dev: true,
75616
- startText: "Installing adapter dependencies",
75617
- doneText: `${brandColor("installed")} ${dim(`via \`${npm10} install\``)}`
75618
- }
75619
- );
75624
+ await installPackages(["xhr2"], {
75625
+ dev: true,
75626
+ startText: "Installing additional dependencies",
75627
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm10} install\``)}`
75628
+ });
75620
75629
  }
75621
75630
  async function updateAppCode2() {
75622
75631
  const s = spinner();
@@ -75668,11 +75677,12 @@ var config14 = {
75668
75677
  },
75669
75678
  devScript: "start",
75670
75679
  deployScript: "deploy",
75680
+ previewScript: "start",
75671
75681
  generate: generate13,
75672
75682
  configure: configure10,
75673
75683
  transformPackageJson: async () => ({
75674
75684
  scripts: {
75675
- start: `${npm10} run build && wrangler pages dev dist/cloudflare ${await compatDateFlag()} --experimental-local`,
75685
+ start: `${npm10} run build && wrangler pages dev dist/cloudflare ${await compatDateFlag()}`,
75676
75686
  build: `ng build && ${npm10} run process`,
75677
75687
  process: "node ./tools/copy-files.mjs",
75678
75688
  deploy: `${npm10} run build && wrangler pages deploy dist/cloudflare`
@@ -76850,7 +76860,7 @@ var config25 = {
76850
76860
  var c3_default35 = config25;
76851
76861
 
76852
76862
  // ../wrangler/package.json
76853
- var version2 = "3.90.0";
76863
+ var version2 = "3.92.0";
76854
76864
 
76855
76865
  // src/git.ts
76856
76866
  var offerGit = async (ctx) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-cloudflare",
3
- "version": "2.33.0",
3
+ "version": "2.33.2",
4
4
  "description": "A CLI for creating and deploying new applications to Cloudflare.",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -68,7 +68,7 @@
68
68
  "yargs": "^17.7.2",
69
69
  "@cloudflare/cli": "1.1.1",
70
70
  "@cloudflare/eslint-config-worker": "1.1.0",
71
- "wrangler": "3.90.0",
71
+ "wrangler": "3.92.0",
72
72
  "@cloudflare/workers-tsconfig": "0.0.0"
73
73
  },
74
74
  "engines": {
@@ -28,14 +28,11 @@ const configure = async (ctx: C3Context) => {
28
28
  };
29
29
 
30
30
  async function installCFWorker() {
31
- await installPackages(
32
- ["@cloudflare/workers-types", "@miniflare/tre@next", "wrangler@beta"],
33
- {
34
- dev: true,
35
- startText: "Installing adapter dependencies",
36
- doneText: `${brandColor("installed")} ${dim(`via \`${npm} install\``)}`,
37
- },
38
- );
31
+ await installPackages(["xhr2"], {
32
+ dev: true,
33
+ startText: "Installing additional dependencies",
34
+ doneText: `${brandColor("installed")} ${dim(`via \`${npm} install\``)}`,
35
+ });
39
36
  }
40
37
  async function updateAppCode() {
41
38
  const s = spinner();
@@ -102,11 +99,12 @@ const config: TemplateConfig = {
102
99
  },
103
100
  devScript: "start",
104
101
  deployScript: "deploy",
102
+ previewScript: "start",
105
103
  generate,
106
104
  configure,
107
105
  transformPackageJson: async () => ({
108
106
  scripts: {
109
- start: `${npm} run build && wrangler pages dev dist/cloudflare ${await compatDateFlag()} --experimental-local`,
107
+ start: `${npm} run build && wrangler pages dev dist/cloudflare ${await compatDateFlag()}`,
110
108
  build: `ng build && ${npm} run process`,
111
109
  process: "node ./tools/copy-files.mjs",
112
110
  deploy: `${npm} run build && wrangler pages deploy dist/cloudflare`,
@@ -6,7 +6,7 @@ const angularApp = new AngularAppEngine();
6
6
  * This is a request handler used by the Angular CLI (dev-server and during build).
7
7
  */
8
8
  export const reqHandler = createRequestHandler(async (req) => {
9
- const res = await angularApp.render(req);
9
+ const res = await angularApp.handle(req);
10
10
 
11
11
  return res ?? new Response('Page not found.', { status: 404 });
12
12
  });
@@ -3,6 +3,6 @@
3
3
  "compilerOptions": {
4
4
  "types": ["@cloudflare/workers-types/experimental", "@cloudflare/vitest-pool-workers"]
5
5
  },
6
- "include": ["./**/*.ts", "../src/env.d.ts"],
6
+ "include": ["./**/*.ts", "../worker-configuration.d.ts"],
7
7
  "exclude": []
8
8
  }
@@ -12,7 +12,11 @@ import type { C3Context } from "types";
12
12
  const { npm } = detectPackageManager();
13
13
 
14
14
  const generate = async (ctx: C3Context) => {
15
- await runFrameworkGenerator(ctx, [ctx.project.name, "--ssr"]);
15
+ await runFrameworkGenerator(ctx, [
16
+ ctx.project.name,
17
+ "--ssr",
18
+ "--server-routing" /** Dev Preview API */,
19
+ ]);
16
20
  logRaw("");
17
21
  };
18
22
 
@@ -23,9 +27,9 @@ const configure = async (ctx: C3Context) => {
23
27
  };
24
28
 
25
29
  async function installCFWorker() {
26
- await installPackages(["@cloudflare/workers-types", "wrangler"], {
30
+ await installPackages(["xhr2"], {
27
31
  dev: true,
28
- startText: "Installing adapter dependencies",
32
+ startText: "Installing additional dependencies",
29
33
  doneText: `${brandColor("installed")} ${dim(`via \`${npm} install\``)}`,
30
34
  });
31
35
  }
@@ -46,12 +50,21 @@ async function updateAppCode() {
46
50
  writeFile(resolve(appConfigPath), newAppConfig);
47
51
  s.stop(`${brandColor(`updated`)} ${dim(appConfigPath)}`);
48
52
 
53
+ // Update an app server routes file to:
54
+ const appServerRoutesPath = "src/app/app.routes.server.ts";
55
+ const appRoutes = readFile(resolve(appServerRoutesPath));
56
+ const newAppRoutes = appRoutes.replace(
57
+ "RenderMode.Prerender",
58
+ "RenderMode.Server",
59
+ );
60
+ writeFile(resolve(appServerRoutesPath), newAppRoutes);
61
+ s.stop(`${brandColor(`updated`)} ${dim(appServerRoutesPath)}`);
62
+
49
63
  // Remove unwanted dependencies
50
64
  s.start(`Updating package.json`);
51
65
  const packageJsonPath = resolve("package.json");
52
66
  const packageManifest = readJSON(packageJsonPath);
53
67
 
54
- delete packageManifest["dependencies"]["@angular/ssr"];
55
68
  delete packageManifest["dependencies"]["express"];
56
69
  delete packageManifest["devDependencies"]["@types/express"];
57
70
 
@@ -66,7 +79,8 @@ function updateAngularJson(ctx: C3Context) {
66
79
  // Update builder
67
80
  const architectSection = angularJson.projects[ctx.project.name].architect;
68
81
  architectSection.build.options.outputPath = "dist";
69
- architectSection.build.options.assets.push("src/_routes.json");
82
+ architectSection.build.options.outputMode = "server";
83
+ architectSection.build.options.ssr.experimentalPlatform = "neutral";
70
84
 
71
85
  writeFile(resolve("angular.json"), JSON.stringify(angularJson, null, 2));
72
86
  s.stop(`${brandColor(`updated`)} ${dim(`\`angular.json\``)}`);
@@ -84,13 +98,13 @@ const config: TemplateConfig = {
84
98
  path: "templates-experimental/angular",
85
99
  devScript: "start",
86
100
  deployScript: "deploy",
101
+ previewScript: "start",
87
102
  generate,
88
103
  configure,
89
104
  transformPackageJson: async () => ({
90
105
  scripts: {
91
106
  start: `${npm} run build && wrangler dev`,
92
- build: `ng build && ${npm} run process`,
93
- process: "node ./tools/alter-polyfills.mjs",
107
+ build: `ng build`,
94
108
  deploy: `${npm} run build && wrangler deploy`,
95
109
  },
96
110
  }),
@@ -0,0 +1,15 @@
1
+ import { AngularAppEngine, createRequestHandler } from '@angular/ssr';
2
+
3
+ const angularApp = new AngularAppEngine();
4
+
5
+ /**
6
+ * This is a request handler used by the Angular CLI (dev-server and during build).
7
+ */
8
+ export const reqHandler = createRequestHandler(async (req) => {
9
+ const res = await angularApp.handle(req);
10
+
11
+ return res ?? new Response('Page not found.', { status: 404 });
12
+ });
13
+
14
+
15
+ export default { fetch: reqHandler };
@@ -1,34 +0,0 @@
1
- import { renderApplication } from "@angular/platform-server";
2
- import bootstrap from "./src/main.server";
3
-
4
- interface Env {
5
- ASSETS: { fetch: typeof fetch };
6
- }
7
-
8
- // We attach the Cloudflare `fetch()` handler to the global scope
9
- // so that we can export it when we process the Angular output.
10
- // See tools/bundle.mjs
11
- async function workerFetchHandler(request: Request, env: Env) {
12
- const url = new URL(request.url);
13
- console.log("render SSR", url.href);
14
-
15
- // Get the root `index.html` content.
16
- const indexUrl = new URL("/index.html", url);
17
- const indexResponse = await env.ASSETS.fetch(new Request(indexUrl));
18
- const document = await indexResponse.text();
19
-
20
- const content = await renderApplication(bootstrap, {
21
- document,
22
- url: url.pathname,
23
- });
24
-
25
- // console.log("rendered SSR", content);
26
- return new Response(content, indexResponse);
27
- }
28
-
29
- export default {
30
- fetch: (request: Request, env: Env) =>
31
- (globalThis as any)["__zone_symbol__Promise"].resolve(
32
- workerFetchHandler(request, env),
33
- ),
34
- };
@@ -1,32 +0,0 @@
1
- import fs from "node:fs";
2
- import { EOL } from "node:os";
3
- import { join } from "node:path";
4
- import path from "node:path";
5
- import { fileURLToPath } from "node:url";
6
- const dirname = path.dirname(fileURLToPath(import.meta.url));
7
-
8
- /**
9
- * Split by lines and comment the banner
10
- * ```
11
- * import { createRequire } from 'node:module';
12
- * globalThis['require'] ??= createRequire(import.meta.url);
13
- * ```
14
- */
15
- const serverPolyfillsFile = join(
16
- dirname,
17
- "../dist/server/polyfills.server.mjs"
18
- );
19
- const serverPolyfillsData = fs
20
- .readFileSync(serverPolyfillsFile, "utf8")
21
- .split(/\r?\n/);
22
-
23
- for (let index = 0; index < 2; index++) {
24
- if (serverPolyfillsData[index].includes("createRequire")) {
25
- serverPolyfillsData[index] = "// " + serverPolyfillsData[index];
26
- }
27
- }
28
-
29
- // Add needed polyfills
30
- serverPolyfillsData.unshift(`globalThis['process'] = {};`);
31
-
32
- fs.writeFileSync(serverPolyfillsFile, serverPolyfillsData.join(EOL));