create-cloudflare 0.0.0-ebc85c36 → 0.0.0-ecdfabed0
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 +4286 -4079
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/templates/common/c3.ts +3 -0
- package/templates/hello-world/c3.ts +5 -1
- package/templates/hello-world/ts/tsconfig.json +2 -1
- package/templates/hello-world-durable-object/c3.ts +3 -1
- package/templates/hono/c3.ts +0 -10
- package/templates/hono/snippets/appDeclaration.ts +1 -1
- package/templates/openapi/c3.ts +1 -0
- package/templates/queues/c3.ts +2 -0
- package/templates/react/c3.ts +31 -3
- package/templates/scheduled/c3.ts +2 -0
- package/templates/hello-world-python/c3.ts +0 -9
- package/templates/hono/snippets/bindingsType.ts +0 -3
- /package/templates/{hello-world-python → hello-world}/py/__dot__gitignore +0 -0
- /package/templates/{hello-world-python → hello-world}/py/package.json +0 -0
- /package/templates/{hello-world-python → hello-world}/py/src/entry.py +0 -0
- /package/templates/{hello-world-python → hello-world}/py/wrangler.toml +0 -0
package/templates/react/c3.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { logRaw } from "@cloudflare/cli";
|
|
2
|
+
import { processArgument } from "@cloudflare/cli/args";
|
|
2
3
|
import { runFrameworkGenerator } from "frameworks/index";
|
|
3
4
|
import { detectPackageManager } from "helpers/packageManagers";
|
|
4
5
|
import type { TemplateConfig } from "../../src/templates";
|
|
@@ -7,11 +8,38 @@ import type { C3Context } from "types";
|
|
|
7
8
|
const { npm } = detectPackageManager();
|
|
8
9
|
|
|
9
10
|
const generate = async (ctx: C3Context) => {
|
|
10
|
-
await
|
|
11
|
+
const variant = await processArgument<string>(ctx.args, "variant", {
|
|
12
|
+
type: "select",
|
|
13
|
+
question: "Select a variant:",
|
|
14
|
+
label: "variant",
|
|
15
|
+
options: variantsOptions,
|
|
16
|
+
defaultValue: variantsOptions[0].value,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
await runFrameworkGenerator(ctx, [ctx.project.name, "--template", variant]);
|
|
11
20
|
|
|
12
21
|
logRaw("");
|
|
13
22
|
};
|
|
14
23
|
|
|
24
|
+
const variantsOptions = [
|
|
25
|
+
{
|
|
26
|
+
value: "react-ts",
|
|
27
|
+
label: "TypeScript",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
value: "react-swc-ts",
|
|
31
|
+
label: "TypeScript + SWC",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
value: "react",
|
|
35
|
+
label: "JavaScript",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
value: "react-swc",
|
|
39
|
+
label: "JavaScript + SWC",
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
|
|
15
43
|
const config: TemplateConfig = {
|
|
16
44
|
configVersion: 1,
|
|
17
45
|
id: "react",
|
|
@@ -20,8 +48,8 @@ const config: TemplateConfig = {
|
|
|
20
48
|
generate,
|
|
21
49
|
transformPackageJson: async () => ({
|
|
22
50
|
scripts: {
|
|
23
|
-
deploy: `${npm} run build && wrangler pages deploy ./
|
|
24
|
-
preview: `${npm} run build && wrangler pages dev ./
|
|
51
|
+
deploy: `${npm} run build && wrangler pages deploy ./dist`,
|
|
52
|
+
preview: `${npm} run build && wrangler pages dev ./dist`,
|
|
25
53
|
},
|
|
26
54
|
}),
|
|
27
55
|
devScript: "dev",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|