create-cloudflare 2.33.2 → 2.33.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-cloudflare",
3
- "version": "2.33.2",
3
+ "version": "2.33.4",
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.20241106.0",
33
+ "@cloudflare/workers-types": "^4.20241205.0",
34
34
  "@iarna/toml": "^3.0.0",
35
35
  "@types/command-exists": "^1.2.0",
36
36
  "@types/cross-spawn": "^6.0.2",
@@ -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
+ "@cloudflare/workers-tsconfig": "0.0.0",
70
71
  "@cloudflare/eslint-config-worker": "1.1.0",
71
- "wrangler": "3.92.0",
72
- "@cloudflare/workers-tsconfig": "0.0.0"
72
+ "wrangler": "3.94.0"
73
73
  },
74
74
  "engines": {
75
75
  "node": ">=18.14.1"
@@ -11,6 +11,6 @@
11
11
  "devDependencies": {
12
12
  "@cloudflare/vitest-pool-workers": "^0.5.2",
13
13
  "wrangler": "^3.60.3",
14
- "vitest": "2.0.5"
14
+ "vitest": "2.1.8"
15
15
  }
16
16
  }
@@ -12,7 +12,7 @@
12
12
  "devDependencies": {
13
13
  "@cloudflare/vitest-pool-workers": "^0.5.2",
14
14
  "typescript": "^5.5.2",
15
- "vitest": "2.0.5",
15
+ "vitest": "2.1.8",
16
16
  "wrangler": "^3.60.3"
17
17
  }
18
18
  }
@@ -1,3 +1,4 @@
1
+ import { existsSync } from "node:fs";
1
2
  import { platform } from "node:os";
2
3
  import { logRaw, updateStatus } from "@cloudflare/cli";
3
4
  import { blue, brandColor, dim } from "@cloudflare/cli/colors";
@@ -28,6 +29,7 @@ const configure = async (ctx: C3Context) => {
28
29
  });
29
30
 
30
31
  updateSvelteConfig();
32
+ updatePlaywrightConfig(usesTypescript(ctx));
31
33
  updateTypeDefinitions(ctx);
32
34
  };
33
35
 
@@ -49,6 +51,34 @@ const updateSvelteConfig = () => {
49
51
  });
50
52
  };
51
53
 
54
+ const updatePlaywrightConfig = (shouldUseTypescript: boolean) => {
55
+ const filePath = `playwright.config.${shouldUseTypescript ? "ts" : "js"}`;
56
+ if (!existsSync(filePath)) {
57
+ return;
58
+ }
59
+
60
+ updateStatus(`Changing webServer port in ${blue(filePath)}`);
61
+
62
+ transformFile(filePath, {
63
+ visitObjectExpression: function (n) {
64
+ const portProp = n.node.properties.find((prop) => {
65
+ if (!("key" in prop) || !("name" in prop.key)) {
66
+ return false;
67
+ }
68
+
69
+ return prop.key.name === "port";
70
+ });
71
+
72
+ if (!portProp || !("value" in portProp) || !("value" in portProp.value)) {
73
+ return this.traverse(n);
74
+ }
75
+
76
+ portProp.value.value = 8788;
77
+ return false;
78
+ },
79
+ });
80
+ };
81
+
52
82
  const updateTypeDefinitions = (ctx: C3Context) => {
53
83
  if (!usesTypescript(ctx)) {
54
84
  return;
@@ -11,6 +11,6 @@
11
11
  "devDependencies": {
12
12
  "@cloudflare/vitest-pool-workers": "^0.5.2",
13
13
  "wrangler": "^3.60.3",
14
- "vitest": "2.0.5"
14
+ "vitest": "2.1.8"
15
15
  }
16
16
  }
@@ -12,7 +12,7 @@
12
12
  "devDependencies": {
13
13
  "@cloudflare/vitest-pool-workers": "^0.5.2",
14
14
  "typescript": "^5.5.2",
15
- "vitest": "2.0.5",
15
+ "vitest": "2.1.8",
16
16
  "wrangler": "^3.60.3"
17
17
  }
18
18
  }
@@ -82,7 +82,7 @@ const updateNuxtConfig = () => {
82
82
  b.objectExpression([
83
83
  b.objectProperty(
84
84
  b.identifier("preset"),
85
- b.stringLiteral("./cloudflare-preset"),
85
+ b.stringLiteral("cloudflare_module"),
86
86
  ),
87
87
  ]),
88
88
  );
@@ -1,8 +1,8 @@
1
1
  #:schema node_modules/wrangler/config-schema.json
2
2
  name = "<TBD>"
3
3
  compatibility_date = "<TBD>"
4
- main = "./dist/worker/index.js"
5
- assets = { directory = "./dist/public", binding = "ASSETS" }
4
+ main = "./.output/server/index.mjs"
5
+ assets = { directory = "./.output/public/", binding = "ASSETS" }
6
6
 
7
7
  # Workers Logs
8
8
  # Docs: https://developers.cloudflare.com/workers/observability/logs/workers-logs/
@@ -2,6 +2,7 @@ import { logRaw, updateStatus } from "@cloudflare/cli";
2
2
  import { blue, brandColor, dim } from "@cloudflare/cli/colors";
3
3
  import { runFrameworkGenerator } from "frameworks/index";
4
4
  import { mergeObjectProperties, transformFile } from "helpers/codemod";
5
+ import { getWorkerdCompatibilityDate } from "helpers/compatDate";
5
6
  import { usesTypescript } from "helpers/files";
6
7
  import { detectPackageManager } from "helpers/packageManagers";
7
8
  import { installPackages } from "helpers/packages";
@@ -30,6 +31,8 @@ const configure = async (ctx: C3Context) => {
30
31
  usesTypescript(ctx);
31
32
  const filePath = `app.config.${usesTypescript(ctx) ? "ts" : "js"}`;
32
33
 
34
+ const compatDate = await getWorkerdCompatibilityDate();
35
+
33
36
  updateStatus(`Updating configuration in ${blue(filePath)}`);
34
37
 
35
38
  transformFile(filePath, {
@@ -46,60 +49,14 @@ const configure = async (ctx: C3Context) => {
46
49
  b.objectProperty(
47
50
  b.identifier("server"),
48
51
  b.objectExpression([
49
- // preset: "cloudflare-pages"
52
+ // preset: "cloudflare_module"
50
53
  b.objectProperty(
51
54
  b.identifier("preset"),
52
- b.stringLiteral("cloudflare-pages"),
53
- ),
54
- // output: {
55
- // dir: "{{ rootDir }}/dist",
56
- // publicDir: "{{ output.dir }}/public",
57
- // serverDir: "{{ output.dir }}/worker",
58
- // },
59
- b.objectProperty(
60
- b.identifier("output"),
61
- b.objectExpression([
62
- b.objectProperty(
63
- b.identifier("dir"),
64
- b.stringLiteral("{{ rootDir }}/dist"),
65
- ),
66
- b.objectProperty(
67
- b.identifier("publicDir"),
68
- b.stringLiteral("{{ output.dir }}/public"),
69
- ),
70
- b.objectProperty(
71
- b.identifier("serverDir"),
72
- b.stringLiteral("{{ output.dir }}/worker"),
73
- ),
74
- ]),
75
- ),
76
- // rollupConfig: {
77
- // external: ["node:async_hooks"],
78
- // },
79
- b.objectProperty(
80
- b.identifier("rollupConfig"),
81
- b.objectExpression([
82
- b.objectProperty(
83
- b.identifier("external"),
84
- b.arrayExpression([b.stringLiteral("node:async_hooks")]),
85
- ),
86
- ]),
55
+ b.stringLiteral("cloudflare_module"),
87
56
  ),
88
- // hooks: {
89
- // // Prevent the Pages preset from writing the _routes.json etc.
90
- // compiled() {},
91
- // },
92
57
  b.objectProperty(
93
- b.identifier("hooks"),
94
- b.objectExpression([
95
- b.objectMethod(
96
- "method",
97
- b.identifier("compiled"),
98
- [],
99
- b.blockStatement([]),
100
- false,
101
- ),
102
- ]),
58
+ b.identifier("compatibilityDate"),
59
+ b.stringLiteral(compatDate),
103
60
  ),
104
61
  ]),
105
62
  ),
@@ -2,8 +2,8 @@
2
2
  name = "<TBD>"
3
3
  compatibility_date = "<TBD>"
4
4
  compatibility_flags = ["nodejs_compat"]
5
- main = "./dist/worker/index.js"
6
- assets = { directory = "./dist/public", binding = "ASSETS" }
5
+ main = "./.output/server/index.mjs"
6
+ assets = { directory = "./.output/public", binding = "ASSETS" }
7
7
 
8
8
  # Workers Logs
9
9
  # Docs: https://developers.cloudflare.com/workers/observability/logs/workers-logs/
@@ -0,0 +1,33 @@
1
+ import { runFrameworkGenerator } from "frameworks/index";
2
+ import { detectPackageManager } from "helpers/packageManagers";
3
+ import type { TemplateConfig } from "../../src/templates";
4
+ import type { C3Context } from "types";
5
+
6
+ const { npm } = detectPackageManager();
7
+
8
+ const generate = async (ctx: C3Context) => {
9
+ await runFrameworkGenerator(ctx, [ctx.project.name]);
10
+ };
11
+
12
+ const config: TemplateConfig = {
13
+ configVersion: 1,
14
+ id: "vue",
15
+ frameworkCli: "create-vue",
16
+ platform: "workers",
17
+ displayName: "Vue",
18
+ copyFiles: {
19
+ path: "./templates",
20
+ },
21
+ path: "templates-experimental/vue",
22
+ generate,
23
+ transformPackageJson: async () => ({
24
+ scripts: {
25
+ deploy: `${npm} run build && wrangler deploy`,
26
+ preview: `${npm} run build && wrangler dev`,
27
+ },
28
+ }),
29
+ devScript: "dev",
30
+ deployScript: "deploy",
31
+ previewScript: "preview",
32
+ };
33
+ export default config;
@@ -0,0 +1,10 @@
1
+ #:schema node_modules/wrangler/config-schema.json
2
+ name = "<TBD>"
3
+ compatibility_date = "<TBD>"
4
+ assets = { directory = "./dist" }
5
+
6
+ # Workers Logs
7
+ # Docs: https://developers.cloudflare.com/workers/observability/logs/workers-logs/
8
+ # Configuration: https://developers.cloudflare.com/workers/observability/logs/workers-logs/#enable-workers-logs
9
+ [observability]
10
+ enabled = true
@@ -1,27 +0,0 @@
1
- import { type NitroPreset } from "nitropack";
2
-
3
- export default <NitroPreset>{
4
- extends: "cloudflare",
5
- exportConditions: ["workerd"],
6
- output: {
7
- dir: "{{ rootDir }}/dist",
8
- publicDir: "{{ output.dir }}/public",
9
- serverDir: "{{ output.dir }}/worker",
10
- },
11
- commands: {
12
- preview: "npx wrangler dev",
13
- deploy: "npx wrangler deploy",
14
- },
15
- wasm: {
16
- lazy: false,
17
- esmImport: true,
18
- },
19
- rollupConfig: {
20
- output: {
21
- entryFileNames: "index.js",
22
- format: "esm",
23
- exports: "named",
24
- inlineDynamicImports: false,
25
- },
26
- },
27
- };