create-cloudflare 0.0.0-96b79b3f → 0.0.0-96e4e165
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 +899 -648
- package/package.json +6 -4
- package/templates/astro/c3.ts +78 -8
- package/templates/astro/snippets/runtimeDeclaration.ts +4 -0
- package/templates/astro/templates/wrangler.toml +50 -0
- package/templates/nuxt/c3.ts +38 -5
- package/templates/nuxt/templates/env.d.ts +14 -0
- package/templates/nuxt/templates/worker-configuration.d.ts +3 -0
- package/templates/qwik/c3.ts +73 -23
- package/templates/qwik/snippets/getPlatformProxy.ts +6 -0
- package/templates/qwik/templates/worker-configuration.d.ts +3 -0
- package/templates/remix/c3.ts +37 -3
- package/templates/remix/templates/worker-configuration.d.ts +3 -0
- package/templates/remix/templates/wrangler.toml +50 -0
- package/templates/solid/c3.ts +54 -12
- package/templates/solid/js/vite.config.js +0 -12
- package/templates/solid/ts/vite.config.ts +0 -12
package/templates/solid/c3.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { logRaw } from "@cloudflare/cli";
|
|
1
|
+
import { logRaw, updateStatus } from "@cloudflare/cli";
|
|
2
|
+
import { blue } from "@cloudflare/cli/colors";
|
|
3
|
+
import { transformFile } from "helpers/codemod";
|
|
2
4
|
import { runFrameworkGenerator } from "helpers/command";
|
|
3
|
-
import { compatDateFlag } from "helpers/files";
|
|
5
|
+
import { compatDateFlag, usesTypescript } from "helpers/files";
|
|
4
6
|
import { detectPackageManager } from "helpers/packages";
|
|
7
|
+
import * as recast from "recast";
|
|
5
8
|
import type { TemplateConfig } from "../../src/templates";
|
|
6
9
|
import type { C3Context } from "types";
|
|
7
10
|
|
|
@@ -9,31 +12,70 @@ const { npm } = detectPackageManager();
|
|
|
9
12
|
|
|
10
13
|
const generate = async (ctx: C3Context) => {
|
|
11
14
|
// Run the create-solid command
|
|
12
|
-
|
|
15
|
+
// -s flag forces solid-start
|
|
16
|
+
await runFrameworkGenerator(ctx, ["-p", ctx.project.name, "-s"]);
|
|
13
17
|
|
|
14
18
|
logRaw("");
|
|
15
19
|
};
|
|
16
20
|
|
|
21
|
+
const configure = async (ctx: C3Context) => {
|
|
22
|
+
usesTypescript(ctx);
|
|
23
|
+
const filePath = `app.config.${usesTypescript(ctx) ? "ts" : "js"}`;
|
|
24
|
+
|
|
25
|
+
updateStatus(`Updating configuration in ${blue(filePath)}`);
|
|
26
|
+
|
|
27
|
+
transformFile(filePath, {
|
|
28
|
+
visitCallExpression: function (n) {
|
|
29
|
+
const callee = n.node.callee as recast.types.namedTypes.Identifier;
|
|
30
|
+
if (callee.name !== "defineConfig") {
|
|
31
|
+
return this.traverse(n);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const b = recast.types.builders;
|
|
35
|
+
n.node.arguments = [
|
|
36
|
+
b.objectExpression([
|
|
37
|
+
b.objectProperty(
|
|
38
|
+
b.identifier("server"),
|
|
39
|
+
b.objectExpression([
|
|
40
|
+
b.objectProperty(
|
|
41
|
+
b.identifier("preset"),
|
|
42
|
+
b.stringLiteral("cloudflare-pages")
|
|
43
|
+
),
|
|
44
|
+
b.objectProperty(
|
|
45
|
+
b.identifier("rollupConfig"),
|
|
46
|
+
b.objectExpression([
|
|
47
|
+
b.objectProperty(
|
|
48
|
+
b.identifier("external"),
|
|
49
|
+
b.arrayExpression([b.stringLiteral("node:async_hooks")])
|
|
50
|
+
),
|
|
51
|
+
])
|
|
52
|
+
),
|
|
53
|
+
])
|
|
54
|
+
),
|
|
55
|
+
]),
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
return false;
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
|
|
17
63
|
const config: TemplateConfig = {
|
|
18
64
|
configVersion: 1,
|
|
19
65
|
id: "solid",
|
|
20
66
|
displayName: "Solid",
|
|
21
67
|
platform: "pages",
|
|
22
|
-
copyFiles: {
|
|
23
|
-
variants: {
|
|
24
|
-
js: { path: "./js" },
|
|
25
|
-
ts: { path: "./ts" },
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
68
|
generate,
|
|
69
|
+
configure,
|
|
29
70
|
transformPackageJson: async () => ({
|
|
30
71
|
scripts: {
|
|
31
|
-
|
|
32
|
-
|
|
72
|
+
preview: `${npm} run build && npx wrangler pages dev dist ${await compatDateFlag()} --compatibility-flag nodejs_compat`,
|
|
73
|
+
deploy: `${npm} run build && wrangler pages deploy ./dist`,
|
|
33
74
|
},
|
|
34
75
|
}),
|
|
35
76
|
devScript: "dev",
|
|
36
|
-
|
|
77
|
+
deployScript: "deploy",
|
|
78
|
+
previewScript: "preview",
|
|
37
79
|
compatibilityFlags: ["nodejs_compat"],
|
|
38
80
|
};
|
|
39
81
|
export default config;
|