create-dev-to 1.4.0 → 1.5.0

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.
Files changed (2) hide show
  1. package/dist/index.js +70 -63
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -12,71 +12,90 @@ import { InstallLogger } from "./installLogger.js";
12
12
  import { displayInstallSummary } from "./visualComponents.js";
13
13
  const PACKAGE_MANAGERS = ["pnpm", "npm", "yarn", "bun"];
14
14
  const __BUILD_INFO__ = {
15
- commit: "9870ae8",
15
+ commit: "395653e",
16
16
  branch: "main",
17
- buildTime: "2026-01-10 16:50",
18
- version: "1.4.0"
17
+ buildTime: "2026-01-11 02:43",
18
+ version: "1.5.0"
19
19
  };
20
20
  const FRAMEWORKS = [
21
21
  {
22
22
  name: "react",
23
23
  display: "React",
24
24
  color: cyan,
25
- supported: true
25
+ variants: [
26
+ {
27
+ name: "react-ts",
28
+ display: "TypeScript",
29
+ color: cyan
30
+ },
31
+ {
32
+ name: "react-compiler-ts",
33
+ display: "TypeScript + React Compiler",
34
+ color: cyan
35
+ },
36
+ {
37
+ name: "react-swc-ts",
38
+ display: "TypeScript + SWC",
39
+ color: cyan
40
+ },
41
+ {
42
+ name: "react",
43
+ display: "JavaScript",
44
+ color: yellow
45
+ },
46
+ {
47
+ name: "react-compiler",
48
+ display: "JavaScript + React Compiler",
49
+ color: yellow
50
+ },
51
+ {
52
+ name: "react-swc",
53
+ display: "JavaScript + SWC",
54
+ color: yellow
55
+ }
56
+ ]
26
57
  },
27
58
  {
28
59
  name: "vue",
29
60
  display: "Vue",
30
61
  color: green,
31
- supported: false
62
+ variants: []
32
63
  },
33
64
  {
34
65
  name: "svelte",
35
66
  display: "Svelte",
36
67
  color: red,
37
- supported: false
68
+ variants: []
38
69
  },
39
70
  {
40
71
  name: "solid",
41
72
  display: "Solid",
42
73
  color: cyan,
43
- supported: false
74
+ variants: []
44
75
  },
45
76
  {
46
77
  name: "preact",
47
78
  display: "Preact",
48
79
  color: cyan,
49
- supported: false
80
+ variants: []
50
81
  },
51
82
  {
52
83
  name: "lit",
53
84
  display: "Lit",
54
85
  color: yellow,
55
- supported: false
86
+ variants: []
56
87
  },
57
88
  {
58
89
  name: "qwik",
59
90
  display: "Qwik",
60
91
  color: cyan,
61
- supported: false
92
+ variants: []
62
93
  },
63
94
  {
64
95
  name: "vanilla",
65
96
  display: "Vanilla",
66
97
  color: yellow,
67
- supported: false
68
- }
69
- ];
70
- const REACT_TEMPLATES = [
71
- {
72
- name: "react-ts",
73
- display: "TypeScript",
74
- color: cyan
75
- },
76
- {
77
- name: "react",
78
- display: "JavaScript",
79
- color: yellow
98
+ variants: []
80
99
  }
81
100
  ];
82
101
  const TEMPLATE_SOURCES = [
@@ -324,6 +343,7 @@ Please check your network connection or try again later.`
324
343
  }
325
344
  }
326
345
  }
346
+ throw new Error("Unexpected end of cloneViteTemplate function");
327
347
  }
328
348
  function getDegitCommandForPM(pm) {
329
349
  switch (pm) {
@@ -792,24 +812,23 @@ async function init() {
792
812
  }
793
813
  packageManager = pmChoice;
794
814
  }
795
- const framework = await clack.select({
815
+ const selectedFramework = await clack.select({
796
816
  message: "Select a framework:",
797
817
  options: FRAMEWORKS.map((fw) => ({
798
- value: fw.name,
799
- label: fw.supported ? fw.color(fw.display) : `${fw.color(fw.display)} ${dim("(Coming soon)")}`,
800
- hint: fw.supported ? void 0 : "Not yet supported"
818
+ value: fw,
819
+ label: fw.variants.length > 0 ? fw.color(fw.display) : `${fw.color(fw.display)} ${dim("(Coming soon)")}`,
820
+ hint: fw.variants.length > 0 ? void 0 : "Not yet supported"
801
821
  })),
802
- initialValue: "react"
822
+ initialValue: FRAMEWORKS[0]
803
823
  });
804
- if (clack.isCancel(framework)) {
824
+ if (clack.isCancel(selectedFramework)) {
805
825
  clack.cancel("Operation cancelled.");
806
826
  process.exit(0);
807
827
  }
808
- const selectedFramework = FRAMEWORKS.find((fw) => fw.name === framework);
809
- if (!selectedFramework?.supported) {
810
- clack.outro(yellow(`\u26A0\uFE0F ${selectedFramework?.display} support is coming soon!`));
828
+ if (selectedFramework.variants.length === 0) {
829
+ clack.outro(yellow(`\u26A0\uFE0F ${selectedFramework.display} support is coming soon!`));
811
830
  clack.note(
812
- `We're working hard to add support for ${selectedFramework?.display}.
831
+ `We're working hard to add support for ${selectedFramework.display}.
813
832
 
814
833
  For now, please use React or stay tuned for updates!`,
815
834
  "Roadmap"
@@ -818,54 +837,40 @@ For now, please use React or stay tuned for updates!`,
818
837
  }
819
838
  const variant = await clack.select({
820
839
  message: "Select a variant:",
821
- options: REACT_TEMPLATES.map((template2) => ({
822
- value: template2.name,
823
- label: template2.color(template2.display)
840
+ options: selectedFramework.variants.map((v) => ({
841
+ value: v.name,
842
+ label: v.color(v.display)
824
843
  }))
825
844
  });
826
845
  if (clack.isCancel(variant)) {
827
846
  clack.cancel("Operation cancelled.");
828
847
  process.exit(0);
829
848
  }
830
- const template = variant;
831
- const shouldUseSWC = await clack.confirm({
832
- message: "Use SWC for faster transpilation? (Optional)",
833
- initialValue: false
834
- });
835
- if (clack.isCancel(shouldUseSWC)) {
836
- clack.cancel("Operation cancelled.");
837
- process.exit(0);
838
- }
839
- const shouldUseReactCompiler = await clack.confirm({
840
- message: "Use React Compiler? (Experimental)",
841
- initialValue: false
842
- });
843
- if (clack.isCancel(shouldUseReactCompiler)) {
844
- clack.cancel("Operation cancelled.");
845
- process.exit(0);
846
- }
847
- const shouldUseRolldown = await clack.confirm({
848
- message: "Use Rolldown for bundling? (Experimental)",
849
- initialValue: false
850
- });
851
- if (clack.isCancel(shouldUseRolldown)) {
852
- clack.cancel("Operation cancelled.");
853
- process.exit(0);
854
- }
849
+ let template = variant;
855
850
  const root = path.join(cwd, targetDir);
856
851
  const spinner = clack.spinner();
857
852
  spinner.start("Scaffolding project");
853
+ let isReactSwc = false;
854
+ if (template.includes("-swc")) {
855
+ isReactSwc = true;
856
+ template = template.replace("-swc", "");
857
+ }
858
+ let isReactCompiler = false;
859
+ if (template.includes("-compiler")) {
860
+ isReactCompiler = true;
861
+ template = template.replace("-compiler", "");
862
+ }
858
863
  const cloneResult = await cloneViteTemplate(template, root, packageManager, spinner);
859
864
  const pkgPath = path.join(root, "package.json");
860
865
  const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
861
866
  pkg.name = toValidPackageName(getProjectName());
862
867
  fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
863
868
  const isTs = template.includes("ts");
864
- if (shouldUseSWC) {
869
+ if (isReactSwc) {
865
870
  spinner.message("Setting up SWC...");
866
871
  setupReactSWC(root, isTs);
867
872
  }
868
- if (shouldUseReactCompiler) {
873
+ if (isReactCompiler) {
869
874
  spinner.message("Setting up React Compiler...");
870
875
  setupReactCompiler(root, isTs);
871
876
  }
@@ -897,6 +902,8 @@ For now, please use React or stay tuned for updates!`,
897
902
  initialValue: true
898
903
  });
899
904
  if (clack.isCancel(shouldInstall)) {
905
+ clack.cancel("Operation cancelled.");
906
+ process.exit(0);
900
907
  }
901
908
  if (shouldInstall) {
902
909
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-dev-to",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "engines": {