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.
@@ -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 runFrameworkGenerator(ctx, [ctx.project.name]);
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 ./build`,
24
- preview: `${npm} run build && wrangler pages dev ./build`,
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",
@@ -2,6 +2,8 @@ export default {
2
2
  configVersion: 1,
3
3
  id: "scheduled",
4
4
  displayName: "Scheduled Worker (Cron Trigger)",
5
+ description:
6
+ "Create a Worker to be executed on a schedule for periodic (cron) jobs",
5
7
  platform: "workers",
6
8
  copyFiles: {
7
9
  variants: {
@@ -1,9 +0,0 @@
1
- export default {
2
- configVersion: 1,
3
- id: "hello-world-python",
4
- displayName: '"Hello World" Worker (Python)',
5
- platform: "workers",
6
- copyFiles: {
7
- path: "./py",
8
- },
9
- };
@@ -1,3 +0,0 @@
1
- type Bindings = {
2
- [key in keyof CloudflareBindings]: CloudflareBindings[key]
3
- }