create-rue 0.0.6 → 0.0.7

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/bundle.js CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
- /*! create-rue v0.0.6 | MIT */
2
+ /*! create-rue v0.0.7 | MIT */
3
3
  import { createRequire } from "node:module";
4
4
  import * as fs from "node:fs";
5
5
  import "node:fs";
6
- import * as path$1 from "node:path";
6
+ import * as path from "node:path";
7
7
  import "node:path";
8
8
  import { fileURLToPath, pathToFileURL } from "node:url";
9
9
  import { parseArgs, stripVTControlCharacters, styleText } from "node:util";
@@ -11,7 +11,6 @@ import P, { stdin, stdout } from "node:process";
11
11
  import "node:readline";
12
12
  import P$1 from "node:readline";
13
13
  import "node:tty";
14
- import * as path from "path";
15
14
  //#region \0rolldown/runtime.js
16
15
  var __create = Object.create;
17
16
  var __defProp = Object.defineProperty;
@@ -661,79 +660,6 @@ var Q$1 = class extends p {
661
660
  });
662
661
  }
663
662
  };
664
- let it$1 = class extends p {
665
- options;
666
- cursor = 0;
667
- get _value() {
668
- return this.options[this.cursor].value;
669
- }
670
- get _enabledOptions() {
671
- return this.options.filter((t) => t.disabled !== !0);
672
- }
673
- toggleAll() {
674
- const t = this._enabledOptions, e = this.value !== void 0 && this.value.length === t.length;
675
- this.value = e ? [] : t.map((s) => s.value);
676
- }
677
- toggleInvert() {
678
- const t = this.value;
679
- if (!t) return;
680
- const e = this._enabledOptions.filter((s) => !t.includes(s.value));
681
- this.value = e.map((s) => s.value);
682
- }
683
- toggleValue() {
684
- this.value === void 0 && (this.value = []);
685
- const t = this.value.includes(this._value);
686
- this.value = t ? this.value.filter((e) => e !== this._value) : [...this.value, this._value];
687
- }
688
- constructor(t) {
689
- super(t, !1), this.options = t.options, this.value = [...t.initialValues ?? []];
690
- const e = Math.max(this.options.findIndex(({ value: s }) => s === t.cursorAt), 0);
691
- this.cursor = this.options[e].disabled ? d$1(e, 1, this.options) : e, this.on("key", (s) => {
692
- s === "a" && this.toggleAll(), s === "i" && this.toggleInvert();
693
- }), this.on("cursor", (s) => {
694
- switch (s) {
695
- case "left":
696
- case "up":
697
- this.cursor = d$1(this.cursor, -1, this.options);
698
- break;
699
- case "down":
700
- case "right":
701
- this.cursor = d$1(this.cursor, 1, this.options);
702
- break;
703
- case "space":
704
- this.toggleValue();
705
- break;
706
- }
707
- });
708
- }
709
- };
710
- var nt$1 = class extends p {
711
- options;
712
- cursor = 0;
713
- get _selectedValue() {
714
- return this.options[this.cursor];
715
- }
716
- changeValue() {
717
- this.value = this._selectedValue.value;
718
- }
719
- constructor(t) {
720
- super(t, !1), this.options = t.options;
721
- const e = this.options.findIndex(({ value: i }) => i === t.initialValue), s = e === -1 ? 0 : e;
722
- this.cursor = this.options[s].disabled ? d$1(s, 1, this.options) : s, this.changeValue(), this.on("cursor", (i) => {
723
- switch (i) {
724
- case "left":
725
- case "up":
726
- this.cursor = d$1(this.cursor, -1, this.options);
727
- break;
728
- case "down":
729
- case "right":
730
- this.cursor = d$1(this.cursor, 1, this.options);
731
- break;
732
- }
733
- this.changeValue();
734
- });
735
- }
736
- };
737
663
  var at$1 = class extends p {
738
664
  get userInputWithCursor() {
739
665
  if (this.state === "submit") return this.userInput;
@@ -764,7 +690,10 @@ function Ze() {
764
690
  const ee = Ze(), w = (e, i) => ee ? e : i, _e = w("◆", "*"), oe = w("■", "x"), ue = w("▲", "x"), F = w("◇", "o"), le = w("┌", "T"), d = w("│", "|"), E = w("└", "—");
765
691
  w("┐", "T");
766
692
  w("┘", "—");
767
- const z = w("●", ">"), H = w("○", " "), te = w("◻", "[•]"), U = w("◼", "[+]"), J = w("◻", "[ ]");
693
+ const z = w("●", ">"), H = w("○", " ");
694
+ w("◻", "[•]");
695
+ w("◼", "[+]");
696
+ w("◻", "[ ]");
768
697
  w("▪", "•");
769
698
  w("─", "-");
770
699
  w("╮", "+");
@@ -780,50 +709,6 @@ const he = w("●", "•"), pe = w("◆", "*"), me = w("▲", "!"), ge = w("■"
780
709
  case "error": return styleText("yellow", ue);
781
710
  case "submit": return styleText("green", F);
782
711
  }
783
- }, ye = (e) => {
784
- switch (e) {
785
- case "initial":
786
- case "active": return styleText("cyan", d);
787
- case "cancel": return styleText("red", d);
788
- case "error": return styleText("yellow", d);
789
- case "submit": return styleText("green", d);
790
- }
791
- }, et = (e, i, s, r, u) => {
792
- let n = i, o = 0;
793
- for (let c = s; c < r; c++) {
794
- const a = e[c];
795
- if (n = n - a.length, o++, n <= u) break;
796
- }
797
- return {
798
- lineCount: n,
799
- removals: o
800
- };
801
- }, Y = ({ cursor: e, options: i, style: s, output: r = process.stdout, maxItems: u = Number.POSITIVE_INFINITY, columnPadding: n = 0, rowPadding: o = 4 }) => {
802
- const c = O$1(r) - n, a = A(r), l = styleText("dim", "..."), $ = Math.max(a - o, 0), y = Math.max(Math.min(u, $), 5);
803
- let p = 0;
804
- e >= y - 3 && (p = Math.max(Math.min(e - y + 3, i.length - y), 0));
805
- let m = y < i.length && p > 0, g = y < i.length && p + y < i.length;
806
- const S = Math.min(p + y, i.length), h = [];
807
- let f = 0;
808
- m && f++, g && f++;
809
- const v = p + (m ? 1 : 0), T = S - (g ? 1 : 0);
810
- for (let b = v; b < T; b++) {
811
- const x = wrapAnsi(s(i[b], b === e), c, {
812
- hard: !0,
813
- trim: !1
814
- }).split(`
815
- `);
816
- h.push(x), f += x.length;
817
- }
818
- if (f > $) {
819
- let b = 0, x = 0, G = f;
820
- const M = e - v, R = (j, D) => et(h, G, j, D, $);
821
- m ? ({lineCount: G, removals: b} = R(0, M), G > $ && ({lineCount: G, removals: x} = R(M + 1, h.length))) : ({lineCount: G, removals: x} = R(M + 1, h.length), G > $ && ({lineCount: G, removals: b} = R(0, M))), b > 0 && (m = !0, h.splice(0, b)), x > 0 && (g = !0, h.splice(h.length - x, x));
822
- }
823
- const C = [];
824
- m && C.push(l);
825
- for (const b of h) for (const x of b) C.push(x);
826
- return g && C.push(l), C;
827
712
  };
828
713
  const ot = (e) => {
829
714
  const i = e.active ?? "Yes", s = e.inactive ?? "No";
@@ -916,142 +801,9 @@ ${styleText("gray", E)} ` : "";
916
801
  s.write(`${r}${e}
917
802
 
918
803
  `);
919
- }, Q = (e, i) => e.split(`
920
- `).map((s) => i(s)).join(`
921
- `), yt = (e) => {
922
- const i = (r, u) => {
923
- const n = r.label ?? String(r.value);
924
- return u === "disabled" ? `${styleText("gray", J)} ${Q(n, (o) => styleText(["strikethrough", "gray"], o))}${r.hint ? ` ${styleText("dim", `(${r.hint ?? "disabled"})`)}` : ""}` : u === "active" ? `${styleText("cyan", te)} ${n}${r.hint ? ` ${styleText("dim", `(${r.hint})`)}` : ""}` : u === "selected" ? `${styleText("green", U)} ${Q(n, (o) => styleText("dim", o))}${r.hint ? ` ${styleText("dim", `(${r.hint})`)}` : ""}` : u === "cancelled" ? `${Q(n, (o) => styleText(["strikethrough", "dim"], o))}` : u === "active-selected" ? `${styleText("green", U)} ${n}${r.hint ? ` ${styleText("dim", `(${r.hint})`)}` : ""}` : u === "submitted" ? `${Q(n, (o) => styleText("dim", o))}` : `${styleText("dim", J)} ${Q(n, (o) => styleText("dim", o))}`;
925
- }, s = e.required ?? !0;
926
- return new it$1({
927
- options: e.options,
928
- signal: e.signal,
929
- input: e.input,
930
- output: e.output,
931
- initialValues: e.initialValues,
932
- required: s,
933
- cursorAt: e.cursorAt,
934
- validate(r) {
935
- if (s && (r === void 0 || r.length === 0)) return `Please select at least one option.
936
- ${styleText("reset", styleText("dim", `Press ${styleText([
937
- "gray",
938
- "bgWhite",
939
- "inverse"
940
- ], " space ")} to select, ${styleText("gray", styleText("bgWhite", styleText("inverse", " enter ")))} to submit`))}`;
941
- },
942
- render() {
943
- const r = e.withGuide ?? u.withGuide, u$8 = R(e.output, e.message, r ? `${ye(this.state)} ` : "", `${V(this.state)} `), n = `${r ? `${styleText("gray", d)}
944
- ` : ""}${u$8}
945
- `, o = this.value ?? [], c = (a, l) => {
946
- if (a.disabled) return i(a, "disabled");
947
- const $ = o.includes(a.value);
948
- return l && $ ? i(a, "active-selected") : $ ? i(a, "selected") : i(a, l ? "active" : "inactive");
949
- };
950
- switch (this.state) {
951
- case "submit": {
952
- const a = this.options.filter(({ value: $ }) => o.includes($)).map(($) => i($, "submitted")).join(styleText("dim", ", ")) || styleText("dim", "none");
953
- return `${n}${R(e.output, a, r ? `${styleText("gray", d)} ` : "")}`;
954
- }
955
- case "cancel": {
956
- const a = this.options.filter(({ value: $ }) => o.includes($)).map(($) => i($, "cancelled")).join(styleText("dim", ", "));
957
- if (a.trim() === "") return `${n}${styleText("gray", d)}`;
958
- return `${n}${R(e.output, a, r ? `${styleText("gray", d)} ` : "")}${r ? `
959
- ${styleText("gray", d)}` : ""}`;
960
- }
961
- case "error": {
962
- const a = r ? `${styleText("yellow", d)} ` : "", l = this.error.split(`
963
- `).map((p, m) => m === 0 ? `${r ? `${styleText("yellow", E)} ` : ""}${styleText("yellow", p)}` : ` ${p}`).join(`
964
- `), $ = n.split(`
965
- `).length, y = l.split(`
966
- `).length + 1;
967
- return `${n}${a}${Y({
968
- output: e.output,
969
- options: this.options,
970
- cursor: this.cursor,
971
- maxItems: e.maxItems,
972
- columnPadding: a.length,
973
- rowPadding: $ + y,
974
- style: c
975
- }).join(`
976
- ${a}`)}
977
- ${l}
978
- `;
979
- }
980
- default: {
981
- const a = r ? `${styleText("cyan", d)} ` : "", l = n.split(`
982
- `).length, $ = r ? 2 : 1;
983
- return `${n}${a}${Y({
984
- output: e.output,
985
- options: this.options,
986
- cursor: this.cursor,
987
- maxItems: e.maxItems,
988
- columnPadding: a.length,
989
- rowPadding: l + $,
990
- style: c
991
- }).join(`
992
- ${a}`)}
993
- ${r ? styleText("cyan", E) : ""}
994
- `;
995
- }
996
- }
997
- }
998
- }).prompt();
999
804
  };
1000
805
  w("─", "-"), w("━", "="), w("█", "#");
1001
- const re = (e, i) => e.includes(`
1002
- `) ? e.split(`
1003
- `).map((s) => i(s)).join(`
1004
- `) : i(e), _t = (e) => {
1005
- const i = (s, r) => {
1006
- const u = s.label ?? String(s.value);
1007
- switch (r) {
1008
- case "disabled": return `${styleText("gray", H)} ${re(u, (n) => styleText("gray", n))}${s.hint ? ` ${styleText("dim", `(${s.hint ?? "disabled"})`)}` : ""}`;
1009
- case "selected": return `${re(u, (n) => styleText("dim", n))}`;
1010
- case "active": return `${styleText("green", z)} ${u}${s.hint ? ` ${styleText("dim", `(${s.hint})`)}` : ""}`;
1011
- case "cancelled": return `${re(u, (n) => styleText(["strikethrough", "dim"], n))}`;
1012
- default: return `${styleText("dim", H)} ${re(u, (n) => styleText("dim", n))}`;
1013
- }
1014
- };
1015
- return new nt$1({
1016
- options: e.options,
1017
- signal: e.signal,
1018
- input: e.input,
1019
- output: e.output,
1020
- initialValue: e.initialValue,
1021
- render() {
1022
- const s = e.withGuide ?? u.withGuide, r = `${V(this.state)} `, u$12 = `${ye(this.state)} `, n = R(e.output, e.message, u$12, r), o = `${s ? `${styleText("gray", d)}
1023
- ` : ""}${n}
1024
- `;
1025
- switch (this.state) {
1026
- case "submit": {
1027
- const c = s ? `${styleText("gray", d)} ` : "";
1028
- return `${o}${R(e.output, i(this.options[this.cursor], "selected"), c)}`;
1029
- }
1030
- case "cancel": {
1031
- const c = s ? `${styleText("gray", d)} ` : "";
1032
- return `${o}${R(e.output, i(this.options[this.cursor], "cancelled"), c)}${s ? `
1033
- ${styleText("gray", d)}` : ""}`;
1034
- }
1035
- default: {
1036
- const c = s ? `${styleText("cyan", d)} ` : "", a = s ? styleText("cyan", E) : "", l = o.split(`
1037
- `).length, $ = s ? 2 : 1;
1038
- return `${o}${c}${Y({
1039
- output: e.output,
1040
- cursor: this.cursor,
1041
- options: this.options,
1042
- maxItems: e.maxItems,
1043
- columnPadding: c.length,
1044
- rowPadding: l + $,
1045
- style: (y, p) => i(y, y.disabled ? "disabled" : p ? "active" : "inactive")
1046
- }).join(`
1047
- ${c}`)}
1048
- ${a}
1049
- `;
1050
- }
1051
- }
1052
- }
1053
- }).prompt();
1054
- }, je = `${styleText("gray", d)} `, K = {
806
+ const je = `${styleText("gray", d)} `, K = {
1055
807
  message: async (e, { symbol: i = styleText("gray", d) } = {}) => {
1056
808
  process.stdout.write(`${styleText("gray", d)}
1057
809
  ${i} `);
@@ -1418,7 +1170,7 @@ var require_ejs = /* @__PURE__ */ __commonJSMin(((exports) => {
1418
1170
  * @public
1419
1171
  */
1420
1172
  var fs$1 = __require("fs");
1421
- var path$2 = __require("path");
1173
+ var path$1 = __require("path");
1422
1174
  var utils = require_utils();
1423
1175
  var scopeOptionWarned = false;
1424
1176
  /** @type {string} */
@@ -1488,9 +1240,9 @@ var require_ejs = /* @__PURE__ */ __commonJSMin(((exports) => {
1488
1240
  * @return {String}
1489
1241
  */
1490
1242
  exports.resolveInclude = function(name, filename, isDir) {
1491
- var dirname = path$2.dirname;
1492
- var extname = path$2.extname;
1493
- var resolve = path$2.resolve;
1243
+ var dirname = path$1.dirname;
1244
+ var extname = path$1.extname;
1245
+ var resolve = path$1.resolve;
1494
1246
  var includePath = resolve(isDir ? filename : dirname(filename), name);
1495
1247
  if (!extname(name)) includePath += ".ejs";
1496
1248
  return includePath;
@@ -1892,7 +1644,7 @@ var require_ejs = /* @__PURE__ */ __commonJSMin(((exports) => {
1892
1644
  };
1893
1645
  if (opts.filename && typeof Object.defineProperty === "function") {
1894
1646
  var filename = opts.filename;
1895
- var basename = path$2.basename(filename, path$2.extname(filename));
1647
+ var basename = path$1.basename(filename, path$1.extname(filename));
1896
1648
  try {
1897
1649
  Object.defineProperty(returnedFn, "name", {
1898
1650
  value: basename,
@@ -2062,7 +1814,7 @@ var require_ejs = /* @__PURE__ */ __commonJSMin(((exports) => {
2062
1814
  //#region utils/banners.ts
2063
1815
  var import_picocolors = require_picocolors();
2064
1816
  var import_ejs = /* @__PURE__ */ __toESM(require_ejs(), 1);
2065
- const defaultBanner = "Rue.js - The Progressive JavaScript Framework";
1817
+ const defaultBanner = "Rue.js - The Wasm Framework For Vapor Native DOM";
2066
1818
  const gradientBanner = "\x1B[38;2;66;211;146mV\x1B[39m\x1B[38;2;66;211;146mu\x1B[39m\x1B[38;2;66;211;146me\x1B[39m\x1B[38;2;66;211;146m.\x1B[39m\x1B[38;2;66;211;146mj\x1B[39m\x1B[38;2;67;209;149ms\x1B[39m \x1B[38;2;68;206;152m-\x1B[39m \x1B[38;2;69;204;155mT\x1B[39m\x1B[38;2;70;201;158mh\x1B[39m\x1B[38;2;71;199;162me\x1B[39m \x1B[38;2;72;196;165mP\x1B[39m\x1B[38;2;73;194;168mr\x1B[39m\x1B[38;2;74;192;171mo\x1B[39m\x1B[38;2;75;189;174mg\x1B[39m\x1B[38;2;76;187;177mr\x1B[39m\x1B[38;2;77;184;180me\x1B[39m\x1B[38;2;78;182;183ms\x1B[39m\x1B[38;2;79;179;186ms\x1B[39m\x1B[38;2;80;177;190mi\x1B[39m\x1B[38;2;81;175;193mv\x1B[39m\x1B[38;2;82;172;196me\x1B[39m \x1B[38;2;83;170;199mJ\x1B[39m\x1B[38;2;83;167;202ma\x1B[39m\x1B[38;2;84;165;205mv\x1B[39m\x1B[38;2;85;162;208ma\x1B[39m\x1B[38;2;86;160;211mS\x1B[39m\x1B[38;2;87;158;215mc\x1B[39m\x1B[38;2;88;155;218mr\x1B[39m\x1B[38;2;89;153;221mi\x1B[39m\x1B[38;2;90;150;224mp\x1B[39m\x1B[38;2;91;148;227mt\x1B[39m \x1B[38;2;92;145;230mF\x1B[39m\x1B[38;2;93;143;233mr\x1B[39m\x1B[38;2;94;141;236ma\x1B[39m\x1B[38;2;95;138;239mm\x1B[39m\x1B[38;2;96;136;243me\x1B[39m\x1B[38;2;97;133;246mw\x1B[39m\x1B[38;2;98;131;249mo\x1B[39m\x1B[38;2;99;128;252mr\x1B[39m\x1B[38;2;100;126;255mk\x1B[39m";
2067
1819
  //#endregion
2068
1820
  //#region utils/deepMerge.ts
@@ -2116,12 +1868,12 @@ function sortDependencies(packageJson) {
2116
1868
  */
2117
1869
  function renderTemplate(src, dest, callbacks) {
2118
1870
  if (fs.statSync(src).isDirectory()) {
2119
- if (path$1.basename(src) === "node_modules") return;
1871
+ if (path.basename(src) === "node_modules") return;
2120
1872
  fs.mkdirSync(dest, { recursive: true });
2121
- for (const file of fs.readdirSync(src)) renderTemplate(path$1.resolve(src, file), path$1.resolve(dest, file), callbacks);
1873
+ for (const file of fs.readdirSync(src)) renderTemplate(path.resolve(src, file), path.resolve(dest, file), callbacks);
2122
1874
  return;
2123
1875
  }
2124
- const filename = path$1.basename(src);
1876
+ const filename = path.basename(src);
2125
1877
  if (filename === "package.json" && fs.existsSync(dest)) {
2126
1878
  const pkg = sortDependencies(deepMerge(JSON.parse(fs.readFileSync(dest, "utf8")), JSON.parse(fs.readFileSync(src, "utf8"))));
2127
1879
  fs.writeFileSync(dest, JSON.stringify(pkg, null, 2) + "\n");
@@ -2137,7 +1889,7 @@ function renderTemplate(src, dest, callbacks) {
2137
1889
  fs.writeFileSync(dest, JSON.stringify(settings, null, 2) + "\n");
2138
1890
  return;
2139
1891
  }
2140
- if (filename.startsWith("_")) dest = path$1.resolve(path$1.dirname(dest), filename.replace(/^_/, "."));
1892
+ if (filename.startsWith("_")) dest = path.resolve(path.dirname(dest), filename.replace(/^_/, "."));
2141
1893
  if (filename === "_gitignore" && fs.existsSync(dest)) {
2142
1894
  const existing = fs.readFileSync(dest, "utf8");
2143
1895
  const newGitignore = fs.readFileSync(src, "utf8");
@@ -2159,7 +1911,7 @@ function renderTemplate(src, dest, callbacks) {
2159
1911
  function preOrderDirectoryTraverse(dir, dirCallback, fileCallback) {
2160
1912
  for (const filename of fs.readdirSync(dir)) {
2161
1913
  if (filename === ".git") continue;
2162
- const fullpath = path$1.resolve(dir, filename);
1914
+ const fullpath = path.resolve(dir, filename);
2163
1915
  if (fs.lstatSync(fullpath).isDirectory()) {
2164
1916
  dirCallback(fullpath);
2165
1917
  if (fs.existsSync(fullpath)) preOrderDirectoryTraverse(fullpath, dirCallback, fileCallback);
@@ -2175,7 +1927,7 @@ function postOrderDirectoryTraverse(dir, dirCallback, fileCallback) {
2175
1927
  dotGitDirectoryState.hasDotGitDirectory = true;
2176
1928
  continue;
2177
1929
  }
2178
- const fullpath = path$1.resolve(dir, filename);
1930
+ const fullpath = path.resolve(dir, filename);
2179
1931
  if (fs.lstatSync(fullpath).isDirectory()) {
2180
1932
  postOrderDirectoryTraverse(fullpath, dirCallback, fileCallback);
2181
1933
  dirCallback(fullpath);
@@ -2194,14 +1946,7 @@ function getCommand(packageManager, scriptName, args) {
2194
1946
  }
2195
1947
  //#endregion
2196
1948
  //#region utils/generateReadme.ts
2197
- const sfcTypeSupportDoc = [
2198
- "",
2199
- "## Type Support for `.rue` Imports in TS",
2200
- "",
2201
- "TypeScript cannot handle type information for `.rue` imports by default, so we replace the `tsc` CLI with `rue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Rue.volar) to make the TypeScript language service aware of `.rue` types.",
2202
- ""
2203
- ].join("\n");
2204
- function generateReadme({ projectName, packageManager, needsTypeScript, needsCypress, needsCypressCT, needsPlaywright, needsVitest, needsEslint }) {
1949
+ function generateReadme({ projectName, packageManager }) {
2205
1950
  const commandFor = (scriptName, args) => getCommand(packageManager, scriptName, args);
2206
1951
  let readme = `# ${projectName}
2207
1952
 
@@ -2219,7 +1964,6 @@ This template should help get you started developing with Rue 3 in Vite.
2219
1964
  - Firefox:
2220
1965
  - [Rue.js devtools](https://addons.mozilla.org/en-US/firefox/addon/rue-js-devtools/)
2221
1966
  - [Turn on Custom Object Formatter in Firefox DevTools](https://fxdx.dev/firefox-devtools-custom-object-formatters/)
2222
- ${needsTypeScript ? sfcTypeSupportDoc : ""}
2223
1967
  ## Customize configuration
2224
1968
 
2225
1969
  See [Vite Configuration Reference](https://vite.dev/config/).
@@ -2237,68 +1981,10 @@ ${commandFor("install")}
2237
1981
  ${commandFor("dev")}
2238
1982
  \`\`\`
2239
1983
 
2240
- ### ${needsTypeScript ? "Type-Check, " : ""}Compile and Minify for Production
2241
-
2242
- \`\`\`sh
2243
- ${commandFor("build")}
2244
- \`\`\`
2245
- `;
2246
- if (needsVitest) npmScriptsDescriptions += `
2247
- ### Run Unit Tests with [Vitest](https://vitest.dev/)
2248
-
2249
- \`\`\`sh
2250
- ${commandFor("test:unit")}
2251
- \`\`\`
2252
- `;
2253
- if (needsCypressCT) npmScriptsDescriptions += `
2254
- ### Run Headed Component Tests with [Cypress Component Testing](https://on.cypress.io/component)
2255
-
2256
- \`\`\`sh
2257
- ${commandFor("test:unit:dev")} # or \`${commandFor("test:unit")}\` for headless testing
2258
- \`\`\`
2259
- `;
2260
- if (needsCypress) npmScriptsDescriptions += `
2261
- ### Run End-to-End Tests with [Cypress](https://www.cypress.io/)
2262
-
2263
- \`\`\`sh
2264
- ${commandFor("test:e2e:dev")}
2265
- \`\`\`
2266
-
2267
- This runs the end-to-end tests against the Vite development server.
2268
- It is much faster than the production build.
2269
-
2270
- But it's still recommended to test the production build with \`test:e2e\` before deploying (e.g. in CI environments):
1984
+ ### Type-Check, Compile and Minify for Production
2271
1985
 
2272
1986
  \`\`\`sh
2273
1987
  ${commandFor("build")}
2274
- ${commandFor("test:e2e")}
2275
- \`\`\`
2276
- `;
2277
- if (needsPlaywright) npmScriptsDescriptions += `
2278
- ### Run End-to-End Tests with [Playwright](https://playwright.dev)
2279
-
2280
- \`\`\`sh
2281
- # Install browsers for the first run
2282
- npx playwright install
2283
-
2284
- # When testing on CI, must build the project first
2285
- ${commandFor("build")}
2286
-
2287
- # Runs the end-to-end tests
2288
- ${commandFor("test:e2e")}
2289
- # Runs the tests only on Chromium
2290
- ${commandFor("test:e2e", "--project=chromium")}
2291
- # Runs the tests of a specific file
2292
- ${commandFor("test:e2e", "tests/example.spec.ts")}
2293
- # Runs the tests in debug mode
2294
- ${commandFor("test:e2e", "--debug")}
2295
- \`\`\`
2296
- `;
2297
- if (needsEslint) npmScriptsDescriptions += `
2298
- ### Lint with [ESLint](https://eslint.org/)
2299
-
2300
- \`\`\`sh
2301
- ${commandFor("lint")}
2302
1988
  \`\`\`
2303
1989
  `;
2304
1990
  readme += npmScriptsDescriptions;
@@ -2346,92 +2032,11 @@ async function loadLanguageFile(filePath) {
2346
2032
  }
2347
2033
  async function getLanguage(localesRoot) {
2348
2034
  const locale = getLocale();
2349
- const languageFilePath = path$1.resolve(localesRoot, `${locale}.json`);
2350
- const fallbackPath = path$1.resolve(localesRoot, "en-US.json");
2035
+ const languageFilePath = path.resolve(localesRoot, `${locale}.json`);
2036
+ const fallbackPath = path.resolve(localesRoot, "en-US.json");
2351
2037
  return fs.existsSync(languageFilePath) ? await loadLanguageFile(languageFilePath) : await loadLanguageFile(fallbackPath);
2352
2038
  }
2353
2039
  //#endregion
2354
- //#region utils/trimBoilerplate.ts
2355
- function replaceContent(filepath, replacer) {
2356
- const content = fs.readFileSync(filepath, "utf8");
2357
- fs.writeFileSync(filepath, replacer(content));
2358
- }
2359
- function trimBoilerplate(rootDir) {
2360
- const srcDir = path.resolve(rootDir, "src");
2361
- for (const filename of fs.readdirSync(srcDir)) {
2362
- if ([
2363
- "main.js",
2364
- "main.ts",
2365
- "router",
2366
- "stores"
2367
- ].includes(filename)) continue;
2368
- const fullpath = path.resolve(srcDir, filename);
2369
- fs.rmSync(fullpath, { recursive: true });
2370
- }
2371
- }
2372
- function removeCSSImport(rootDir, needsTypeScript, needsCypressCT) {
2373
- replaceContent(path.resolve(rootDir, needsTypeScript ? "src/main.ts" : "src/main.js"), (content) => content.replace("import './assets/main.css'\n\n", ""));
2374
- if (needsCypressCT) replaceContent(path.resolve(rootDir, needsTypeScript ? "cypress/support/component.ts" : "cypress/support/component.js"), (content) => content.replace("import '@/assets/main.css'", "// import '@/assets/main.css'"));
2375
- }
2376
- function emptyRouterConfig(rootDir, needsTypeScript) {
2377
- const srcDir = path.resolve(rootDir, "src");
2378
- replaceContent(path.resolve(srcDir, needsTypeScript ? "router/index.ts" : "router/index.js"), (content) => content.replace(`import HomeView from '../views/HomeView.rue'\n`, "").replace(/routes:\s*\[[\s\S]*?\],/, "routes: [],"));
2379
- }
2380
- //#endregion
2381
- //#region utils/applyRueBeta.ts
2382
- const CORE_RUE_PACKAGES = [
2383
- "rue",
2384
- "@rue/compiler-core",
2385
- "@rue/compiler-dom",
2386
- "@rue/compiler-sfc",
2387
- "@rue/compiler-ssr",
2388
- "@rue/compiler-vapor",
2389
- "@rue/reactivity",
2390
- "@rue/runtime-core",
2391
- "@rue/runtime-dom",
2392
- "@rue/runtime-vapor",
2393
- "@rue/server-renderer",
2394
- "@rue/shared",
2395
- "@rue/compat"
2396
- ];
2397
- function generateOverridesMap() {
2398
- return Object.fromEntries(CORE_RUE_PACKAGES.map((name) => [name, "beta"]));
2399
- }
2400
- /**
2401
- * Apply Rue 3.6 beta overrides to the project based on the package manager.
2402
- * Different package managers have different mechanisms for version overrides:
2403
- * - npm/bun: uses `overrides` field in package.json
2404
- * - yarn: uses `resolutions` field in package.json
2405
- * - pnpm: uses `overrides` and `peerDependencyRules` in pnpm-workspace.yaml
2406
- */
2407
- function applyRueBeta(root, packageManager, pkg) {
2408
- const overrides = generateOverridesMap();
2409
- if (packageManager === "npm" || packageManager === "bun") {
2410
- pkg.overrides = {
2411
- ...pkg.overrides,
2412
- ...overrides
2413
- };
2414
- for (const dependencyName of CORE_RUE_PACKAGES) for (const dependencyType of [
2415
- "dependencies",
2416
- "devDependencies",
2417
- "optionalDependencies"
2418
- ]) if (pkg[dependencyType]?.[dependencyName]) pkg[dependencyType][dependencyName] = overrides[dependencyName];
2419
- } else if (packageManager === "yarn") pkg.resolutions = {
2420
- ...pkg.resolutions,
2421
- ...overrides
2422
- };
2423
- else if (packageManager === "pnpm") {
2424
- const yamlContent = `overrides:
2425
- ${Object.entries(overrides).map(([key, value]) => ` '${key}': '${value}'`).join("\n")}
2426
-
2427
- peerDependencyRules:
2428
- allowAny:
2429
- - 'rue'
2430
- `;
2431
- fs.writeFileSync(path$1.resolve(root, "pnpm-workspace.yaml"), yamlContent, "utf-8");
2432
- }
2433
- }
2434
- //#endregion
2435
2040
  //#region utils/packageManager.ts
2436
2041
  /**
2437
2042
  * Infers the package manager from the user agent string.
@@ -2444,81 +2049,14 @@ function inferPackageManager() {
2444
2049
  if (/bun/.test(userAgent)) return "bun";
2445
2050
  return "npm";
2446
2051
  }
2447
- /**
2448
- * Creates an ordered list of package managers with the preferred one first.
2449
- */
2450
- function getPackageManagerOptions(preferred) {
2451
- return [preferred, ...[
2452
- "npm",
2453
- "pnpm",
2454
- "yarn",
2455
- "bun"
2456
- ].filter((pm) => pm !== preferred)];
2457
- }
2458
2052
  //#endregion
2459
2053
  //#region package.json
2460
2054
  var name = "create-rue";
2461
- var version = "0.0.6";
2055
+ var version = "0.0.7";
2462
2056
  //#endregion
2463
2057
  //#region index.ts
2464
2058
  const language = await getLanguage(fileURLToPath(new URL("./locales", import.meta.url)));
2465
- const FEATURE_FLAGS = [
2466
- "default",
2467
- "ts",
2468
- "typescript",
2469
- "jsx",
2470
- "router",
2471
- "rue-router",
2472
- "pinia",
2473
- "tests",
2474
- "with-tests",
2475
- "vitest",
2476
- "cypress",
2477
- "playwright",
2478
- "eslint",
2479
- "prettier",
2480
- "eslint-with-prettier",
2481
- "oxlint",
2482
- "oxfmt",
2483
- "rue-beta"
2484
- ];
2485
- const FEATURE_OPTIONS = [
2486
- {
2487
- value: "jsx",
2488
- label: language.needsJsx.message
2489
- },
2490
- {
2491
- value: "router",
2492
- label: language.needsRouter.message
2493
- },
2494
- {
2495
- value: "pinia",
2496
- label: language.needsPinia.message
2497
- },
2498
- {
2499
- value: "vitest",
2500
- label: language.needsVitest.message
2501
- },
2502
- {
2503
- value: "e2e",
2504
- label: language.needsE2eTesting.message
2505
- },
2506
- {
2507
- value: "eslint",
2508
- label: language.needsEslint.message
2509
- },
2510
- {
2511
- value: "prettier",
2512
- label: language.needsPrettier.message
2513
- }
2514
- ];
2515
- const EXPERIMENTAL_FEATURE_OPTIONS = [{
2516
- value: "oxfmt",
2517
- label: language.needsOxfmt.message
2518
- }, {
2519
- value: "rue-beta",
2520
- label: language.needsRueBeta.message
2521
- }];
2059
+ const FEATURE_FLAGS = ["default"];
2522
2060
  function isValidPackageName(projectName) {
2523
2061
  return /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(projectName);
2524
2062
  }
@@ -2548,16 +2086,14 @@ async function unwrapPrompt(maybeCancelPromise) {
2548
2086
  return result;
2549
2087
  }
2550
2088
  const helpMessage = `\
2551
- Usage: create-rue [FEATURE_FLAGS...] [OPTIONS...] [DIRECTORY]
2089
+ Usage: create-rue [--default] [OPTIONS...] [DIRECTORY]
2552
2090
 
2553
2091
  Create a new Rue.js project.
2554
- Runs in interactive mode if started without feature flags, or if DIRECTORY is missing or not a valid package name.
2092
+ Runs in interactive mode if started without --default, or if DIRECTORY is missing or not a valid package name.
2555
2093
 
2556
2094
  Options:
2557
2095
  --force
2558
2096
  Create the project even if the directory is not empty.
2559
- --bare
2560
- Create a barebone project without example code.
2561
2097
  --help
2562
2098
  Display this help message.
2563
2099
  --version
@@ -2566,40 +2102,6 @@ Options:
2566
2102
  Available feature flags:
2567
2103
  --default
2568
2104
  Create a project with the default configuration without any additional features.
2569
- --ts, --typescript
2570
- Add TypeScript support.
2571
- --jsx
2572
- Add JSX support.
2573
- --router, --rue-router
2574
- Add Rue Router for SPA development.
2575
- --pinia
2576
- Add Pinia for state management.
2577
- --vitest
2578
- Add Vitest for unit testing.
2579
- --cypress
2580
- Add Cypress for end-to-end testing.
2581
- If used without ${(0, import_picocolors.cyan)("--vitest")}, it will also add Cypress Component Testing.
2582
- --playwright
2583
- Add Playwright for end-to-end testing.
2584
- --eslint
2585
- Add ESLint for code quality.
2586
- --prettier
2587
- Add Prettier for code formatting.
2588
- --oxfmt
2589
- Add Oxfmt for code formatting.
2590
- --rue-beta
2591
- Use Rue 3.6 Beta. Requires specifying a package manager in interactive mode.
2592
-
2593
- Unstable feature flags:
2594
- --tests, --with-tests
2595
- Add both unit testing and end-to-end testing support.
2596
- Currently equivalent to ${(0, import_picocolors.cyan)("--vitest --cypress")}, but may change in the future.
2597
-
2598
- Deprecated feature flags:
2599
- --eslint-with-prettier
2600
- Please use ${(0, import_picocolors.cyan)("--eslint --prettier")} instead.
2601
- --oxlint
2602
- Oxlint is now always included when ESLint is selected.
2603
2105
  `;
2604
2106
  async function init() {
2605
2107
  const cwd = process.cwd();
@@ -2607,7 +2109,6 @@ async function init() {
2607
2109
  const flags = [
2608
2110
  ...FEATURE_FLAGS,
2609
2111
  "force",
2610
- "bare",
2611
2112
  "help",
2612
2113
  "version"
2613
2114
  ];
@@ -2625,7 +2126,6 @@ async function init() {
2625
2126
  console.log(`${name} v${version}`);
2626
2127
  process.exit(0);
2627
2128
  }
2628
- const isFeatureFlagsUsed = FEATURE_FLAGS.some((flag) => typeof argv[flag] === "boolean");
2629
2129
  let targetDir = positionals[0];
2630
2130
  const defaultProjectName = targetDir || "rue-project";
2631
2131
  const forceOverwrite = argv.force;
@@ -2633,11 +2133,7 @@ async function init() {
2633
2133
  const result = {
2634
2134
  projectName: defaultProjectName,
2635
2135
  shouldOverwrite: forceOverwrite,
2636
- packageName: defaultProjectName,
2637
- features: [],
2638
- e2eFramework: void 0,
2639
- experimentFeatures: [],
2640
- needsBareboneTemplates: false
2136
+ packageName: defaultProjectName
2641
2137
  };
2642
2138
  mt(process.stdout.isTTY && process.stdout.getColorDepth() > 8 ? gradientBanner : defaultBanner);
2643
2139
  if (!targetDir) targetDir = result.projectName = result.packageName = (await unwrapPrompt(Ot({
@@ -2661,67 +2157,7 @@ async function init() {
2661
2157
  initialValue: toValidPackageName(targetDir),
2662
2158
  validate: (value) => isValidPackageName(value) ? void 0 : language.packageName.invalidMessage
2663
2159
  }));
2664
- if (!isFeatureFlagsUsed) {
2665
- result.needsTypeScript = await unwrapPrompt(ot({
2666
- message: language.needsTypeScript.message,
2667
- initialValue: true
2668
- }));
2669
- result.features = await unwrapPrompt(yt({
2670
- message: `${language.featureSelection.message} ${(0, import_picocolors.dim)(language.featureSelection.hint)}`,
2671
- options: FEATURE_OPTIONS,
2672
- required: false
2673
- }));
2674
- if (result.features.includes("e2e")) {
2675
- const hasVitest = result.features.includes("vitest");
2676
- result.e2eFramework = await unwrapPrompt(_t({
2677
- message: `${language.e2eSelection.message} ${(0, import_picocolors.dim)(language.e2eSelection.hint)}`,
2678
- options: [{
2679
- value: "playwright",
2680
- label: language.e2eSelection.selectOptions.playwright.title,
2681
- hint: language.e2eSelection.selectOptions.playwright.desc
2682
- }, {
2683
- value: "cypress",
2684
- label: language.e2eSelection.selectOptions.cypress.title,
2685
- hint: hasVitest ? language.e2eSelection.selectOptions.cypress.desc : language.e2eSelection.selectOptions.cypress.hintOnComponentTesting
2686
- }]
2687
- }));
2688
- }
2689
- result.experimentFeatures = await unwrapPrompt(yt({
2690
- message: `${language.needsExperimentalFeatures.message} ${(0, import_picocolors.dim)(language.needsExperimentalFeatures.hint)}`,
2691
- options: EXPERIMENTAL_FEATURE_OPTIONS,
2692
- required: false
2693
- }));
2694
- if (result.experimentFeatures.includes("rue-beta")) {
2695
- const packageManagerOptions = getPackageManagerOptions(inferredPackageManager).map((pm) => ({
2696
- value: pm,
2697
- label: pm
2698
- }));
2699
- result.packageManager = await unwrapPrompt(_t({
2700
- message: `${language.packageManagerSelection.message} ${(0, import_picocolors.dim)(language.packageManagerSelection.hint)}`,
2701
- options: packageManagerOptions
2702
- }));
2703
- }
2704
- }
2705
- if (argv.bare) result.needsBareboneTemplates = true;
2706
- else if (!isFeatureFlagsUsed) result.needsBareboneTemplates = await unwrapPrompt(ot({
2707
- message: language.needsBareboneTemplates.message,
2708
- initialValue: false
2709
- }));
2710
- const { features, experimentFeatures, needsBareboneTemplates } = result;
2711
- const needsTypeScript = argv.ts || argv.typescript || result.needsTypeScript;
2712
- const needsJsx = argv.jsx || features.includes("jsx");
2713
- const needsRouter = argv.router || argv["rue-router"] || features.includes("router");
2714
- const needsPinia = argv.pinia || features.includes("pinia");
2715
- const needsVitest = argv.vitest || argv.tests || argv["with-tests"] || features.includes("vitest");
2716
- const needsEslint = argv.eslint || argv["eslint-with-prettier"] || features.includes("eslint");
2717
- const needsPrettier = argv.prettier || argv["eslint-with-prettier"] || features.includes("prettier");
2718
- const needsOxfmt = experimentFeatures.includes("oxfmt") || argv["oxfmt"];
2719
- const needsRueBeta = experimentFeatures.includes("rue-beta") || argv["rue-beta"];
2720
- const { e2eFramework } = result;
2721
- const needsCypress = argv.cypress || argv.tests || argv["with-tests"] || e2eFramework === "cypress";
2722
- const needsCypressCT = needsCypress && !needsVitest;
2723
- const needsPlaywright = argv.playwright || e2eFramework === "playwright";
2724
- const root = path$1.join(cwd, targetDir);
2160
+ const root = path.resolve(cwd, targetDir);
2725
2161
  if (fs.existsSync(root) && result.shouldOverwrite) emptyDir(root);
2726
2162
  else if (!fs.existsSync(root)) fs.mkdirSync(root);
2727
2163
  console.log(`\n${language.infos.scaffolding} ${root}...`);
@@ -2729,64 +2165,12 @@ async function init() {
2729
2165
  name: result.packageName,
2730
2166
  version: "0.0.0"
2731
2167
  };
2732
- fs.writeFileSync(path$1.resolve(root, "package.json"), JSON.stringify(pkg, null, 2));
2168
+ fs.writeFileSync(path.resolve(root, "package.json"), JSON.stringify(pkg, null, 2));
2733
2169
  const templateRoot = fileURLToPath(new URL("./template", import.meta.url));
2734
2170
  const callbacks = [];
2735
- const render = function render(templateName) {
2736
- renderTemplate(path$1.resolve(templateRoot, templateName), root, callbacks);
2737
- };
2738
- render("base");
2739
- if (needsJsx) render("config/jsx");
2740
- if (needsRouter) render("config/router");
2741
- if (needsPinia) render("config/pinia");
2742
- if (needsVitest) render("config/vitest");
2743
- if (needsCypress) render("config/cypress");
2744
- if (needsCypressCT) render("config/cypress-ct");
2745
- if (needsPlaywright) render("config/playwright");
2746
- if (needsTypeScript) {
2747
- render("config/typescript");
2748
- render("tsconfig/base");
2749
- const rootTsConfig = {
2750
- files: [],
2751
- references: [{ path: "./tsconfig.node.json" }, { path: "./tsconfig.app.json" }]
2752
- };
2753
- if (needsCypress) render("tsconfig/cypress");
2754
- if (needsCypressCT) {
2755
- render("tsconfig/cypress-ct");
2756
- rootTsConfig.references.push({ path: "./tsconfig.cypress-ct.json" });
2757
- }
2758
- if (needsPlaywright) render("tsconfig/playwright");
2759
- if (needsVitest) {
2760
- render("tsconfig/vitest");
2761
- rootTsConfig.references.push({ path: "./tsconfig.vitest.json" });
2762
- }
2763
- fs.writeFileSync(path$1.resolve(root, "tsconfig.json"), JSON.stringify(rootTsConfig, null, 2) + "\n", "utf-8");
2764
- }
2765
- if (needsEslint) {
2766
- render("linting/base");
2767
- if (needsTypeScript) render("linting/core/ts");
2768
- else render("linting/core/js");
2769
- if (needsCypress) render("linting/cypress");
2770
- if (needsCypressCT) render("linting/cypress-ct");
2771
- if (needsPlaywright) render("linting/playwright");
2772
- if (needsVitest) render("linting/vitest");
2773
- render("linting/oxlint");
2774
- callbacks.push(async (dataStore) => {
2775
- const oxlintrcPath = path$1.resolve(root, ".oxlintrc.json");
2776
- dataStore[oxlintrcPath] = {
2777
- needsTypeScript,
2778
- needsVitest
2779
- };
2780
- });
2781
- if (needsPrettier || needsOxfmt) render("linting/formatter");
2782
- }
2783
- if (needsOxfmt) render("formatting/oxfmt");
2784
- else if (needsPrettier) render("formatting/prettier");
2785
- render(`code/${(needsTypeScript ? "typescript-" : "") + (needsRouter ? "router" : "default")}`);
2786
- if (needsPinia && needsRouter) render("entry/router-and-pinia");
2787
- else if (needsPinia) render("entry/pinia");
2788
- else if (needsRouter) render("entry/router");
2789
- else render("entry/default");
2171
+ (function render(templateName) {
2172
+ renderTemplate(path.resolve(templateRoot, templateName), root, callbacks);
2173
+ })("base");
2790
2174
  const dataStore = {};
2791
2175
  for (const cb of callbacks) await cb(dataStore);
2792
2176
  preOrderDirectoryTraverse(root, () => {}, (filepath) => {
@@ -2798,55 +2182,18 @@ async function init() {
2798
2182
  fs.unlinkSync(filepath);
2799
2183
  }
2800
2184
  });
2801
- if (needsBareboneTemplates) {
2802
- trimBoilerplate(root);
2803
- render("bare/base");
2804
- if (needsTypeScript) render("bare/typescript");
2805
- if (needsVitest) render("bare/vitest");
2806
- if (needsCypressCT) render("bare/cypress-ct");
2807
- }
2808
- if (needsTypeScript) {
2809
- preOrderDirectoryTraverse(root, () => {}, (filepath) => {
2810
- if (filepath.endsWith(".js")) {
2811
- const tsFilePath = filepath.replace(/\.js$/, ".ts");
2812
- if (fs.existsSync(tsFilePath)) fs.unlinkSync(filepath);
2813
- else fs.renameSync(filepath, tsFilePath);
2814
- } else if (path$1.basename(filepath) === "jsconfig.json") fs.unlinkSync(filepath);
2815
- });
2816
- const indexHtmlPath = path$1.resolve(root, "index.html");
2817
- const indexHtmlContent = fs.readFileSync(indexHtmlPath, "utf8");
2818
- fs.writeFileSync(indexHtmlPath, indexHtmlContent.replace("src/main.js", "src/main.ts"));
2819
- } else preOrderDirectoryTraverse(root, () => {}, (filepath) => {
2820
- if (filepath.endsWith(".ts")) fs.unlinkSync(filepath);
2821
- });
2822
- if (needsBareboneTemplates) {
2823
- removeCSSImport(root, needsTypeScript, needsCypressCT);
2824
- if (needsRouter) emptyRouterConfig(root, needsTypeScript);
2825
- }
2826
- const packageManager = result.packageManager ?? inferredPackageManager;
2827
- if (needsRueBeta) {
2828
- const pkgPath = path$1.resolve(root, "package.json");
2829
- const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
2830
- applyRueBeta(root, packageManager, pkg);
2831
- fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
2832
- }
2833
- fs.writeFileSync(path$1.resolve(root, "README.md"), generateReadme({
2185
+ const packageManager = inferredPackageManager;
2186
+ fs.writeFileSync(path.resolve(root, "README.md"), generateReadme({
2834
2187
  projectName: result.projectName ?? result.packageName ?? defaultProjectName,
2835
- packageManager,
2836
- needsTypeScript,
2837
- needsVitest,
2838
- needsCypress,
2839
- needsPlaywright,
2840
- needsCypressCT,
2841
- needsEslint
2188
+ packageManager
2842
2189
  }));
2843
2190
  let outroMessage = `${language.infos.done}\n\n`;
2844
2191
  if (root !== cwd) {
2845
- const cdProjectName = path$1.relative(cwd, root);
2192
+ const cdProjectName = path.relative(cwd, root);
2846
2193
  outroMessage += ` ${(0, import_picocolors.bold)((0, import_picocolors.green)(`cd ${cdProjectName.includes(" ") ? `"${cdProjectName}"` : cdProjectName}`))}\n`;
2847
2194
  }
2848
2195
  outroMessage += ` ${(0, import_picocolors.bold)((0, import_picocolors.green)(getCommand(packageManager, "install")))}\n`;
2849
- if (needsPrettier || needsOxfmt) outroMessage += ` ${(0, import_picocolors.bold)((0, import_picocolors.green)(getCommand(packageManager, "format")))}\n`;
2196
+ outroMessage += ` ${(0, import_picocolors.bold)((0, import_picocolors.green)(getCommand(packageManager, "format")))}\n`;
2850
2197
  outroMessage += ` ${(0, import_picocolors.bold)((0, import_picocolors.green)(getCommand(packageManager, "dev")))}\n`;
2851
2198
  if (!dotGitDirectoryState.hasDotGitDirectory) outroMessage += `
2852
2199
  ${(0, import_picocolors.dim)("|")} ${language.infos.optionalGitCommand}
@@ -14,73 +14,9 @@
14
14
  "message": "Package name:",
15
15
  "invalidMessage": "Invalid package.json name"
16
16
  },
17
- "featureSelection": {
18
- "message": "Select features to include in your project:",
19
- "hint": "(↑/↓ to navigate, space to select, a to toggle all, enter to confirm)"
20
- },
21
- "needsTypeScript": {
22
- "message": "Use TypeScript?"
23
- },
24
- "needsJsx": {
25
- "message": "JSX Support"
26
- },
27
- "needsRouter": {
28
- "message": "Router (SPA development)"
29
- },
30
- "needsPinia": {
31
- "message": "Pinia (state management)"
32
- },
33
- "needsVitest": {
34
- "message": "Vitest (unit testing)"
35
- },
36
- "needsE2eTesting": {
37
- "message": "End-to-End Testing"
38
- },
39
- "needsEslint": {
40
- "message": "Linter (error prevention)"
41
- },
42
- "needsPrettier": {
43
- "message": "Prettier (code formatting)"
44
- },
45
- "e2eSelection": {
46
- "message": "Select an End-to-End testing framework:",
47
- "hint": "(↑/↓ to navigate, enter to confirm)",
48
- "selectOptions": {
49
- "playwright": { "title": "Playwright", "desc": "https://playwright.dev/" },
50
- "cypress": {
51
- "title": "Cypress",
52
- "desc": "https://www.cypress.io/",
53
- "hintOnComponentTesting": "also supports unit testing with Cypress Component Testing - https://www.cypress.io/"
54
- }
55
- }
56
- },
57
- "needsExperimental": {
58
- "message": "Enable experimental features"
59
- },
60
- "needsExperimentalFeatures": {
61
- "message": "Select experimental features to include in your project:",
62
- "hint": "(↑/↓ to navigate, space to select, a to toggle all, enter to confirm)"
63
- },
64
- "needsRueBeta": {
65
- "message": "Rue 3.6 (beta)"
66
- },
67
- "needsOxfmt": {
68
- "message": "Replace Prettier with Oxfmt"
69
- },
70
- "needsBareboneTemplates": {
71
- "message": "Skip all example code and start with a blank Rue project?"
72
- },
73
- "packageManagerSelection": {
74
- "message": "Which package manager will you use?",
75
- "hint": "(Rue 3.6 beta requires version overrides that differ per package manager)"
76
- },
77
17
  "errors": {
78
18
  "operationCancelled": "Operation cancelled"
79
19
  },
80
- "defaultToggleOptions": {
81
- "active": "Yes",
82
- "inactive": "No"
83
- },
84
20
  "infos": {
85
21
  "scaffolding": "Scaffolding project in",
86
22
  "done": "Done. Now run:",
@@ -14,73 +14,9 @@
14
14
  "message": "Nom du package\u00a0:",
15
15
  "invalidMessage": "Le nom du package.json est invalide"
16
16
  },
17
- "featureSelection": {
18
- "message": "Sélectionnez les fonctionnalités à inclure dans votre projet\u00a0:",
19
- "hint": "(↑/↓ pour naviguer, espace pour sélectionner, a pour tout sélectionner, entrée pour confirmer)"
20
- },
21
- "needsTypeScript": {
22
- "message": "Utiliser TypeScript\u00a0?"
23
- },
24
- "needsJsx": {
25
- "message": "Support de JSX"
26
- },
27
- "needsRouter": {
28
- "message": "Router (développement SPA)"
29
- },
30
- "needsPinia": {
31
- "message": "Pinia (gestion de l'état)"
32
- },
33
- "needsVitest": {
34
- "message": "Vitest (tests unitaires)"
35
- },
36
- "needsE2eTesting": {
37
- "message": "Tests de bout en bout"
38
- },
39
- "needsEslint": {
40
- "message": "Linter (prévention des erreurs)"
41
- },
42
- "needsPrettier": {
43
- "message": "Prettier (formatage du code)"
44
- },
45
- "e2eSelection": {
46
- "message": "Sélectionnez un framework de test de bout en bout\u00a0:",
47
- "hint": "(↑/↓ pour naviguer, entrée pour confirmer)",
48
- "selectOptions": {
49
- "playwright": { "title": "Playwright", "desc": "https://playwright.dev/" },
50
- "cypress": {
51
- "title": "Cypress",
52
- "desc": "https://www.cypress.io/",
53
- "hintOnComponentTesting": "prend également en charge les tests unitaires avec Cypress Component Testing - https://www.cypress.io/"
54
- }
55
- }
56
- },
57
- "needsExperimental": {
58
- "message": "Activer les fonctionnalités expérimentales"
59
- },
60
- "needsExperimentalFeatures": {
61
- "message": "Sélectionnez les fonctionnalités expérimentales à inclure\u00a0:",
62
- "hint": "(↑/↓ pour naviguer, espace pour sélectionner, a pour tout sélectionner, entrée pour confirmer)"
63
- },
64
- "needsRueBeta": {
65
- "message": "Rue 3.6 (beta)"
66
- },
67
- "needsOxfmt": {
68
- "message": "Remplacer Prettier par Oxfmt"
69
- },
70
- "needsBareboneTemplates": {
71
- "message": "Ignorer tout le code d'exemple et commencer avec un projet Rue vierge\u00a0?"
72
- },
73
- "packageManagerSelection": {
74
- "message": "Quel gestionnaire de paquets allez-vous utiliser\u00a0?",
75
- "hint": "(Rue 3.6 beta nécessite des surcharges de version spécifiques au gestionnaire de paquets)"
76
- },
77
17
  "errors": {
78
18
  "operationCancelled": "Operation annulée"
79
19
  },
80
- "defaultToggleOptions": {
81
- "active": "Oui",
82
- "inactive": "Non"
83
- },
84
20
  "infos": {
85
21
  "scaffolding": "Génération du projet dans",
86
22
  "done": "Terminé. Exécutez maintenant\u00a0:",
@@ -14,73 +14,9 @@
14
14
  "message": "Paket adı:",
15
15
  "invalidMessage": "Geçersiz package.json adı"
16
16
  },
17
- "featureSelection": {
18
- "message": "Projenize eklenecek özellikleri seçin:",
19
- "hint": "(↑/↓ gezinmek için, boşluk seçmek için, a tümünü seçmek için, enter onaylamak için)"
20
- },
21
- "needsTypeScript": {
22
- "message": "TypeScript kullanılsın mı?"
23
- },
24
- "needsJsx": {
25
- "message": "JSX Desteği"
26
- },
27
- "needsRouter": {
28
- "message": "Router (SPA geliştirme)"
29
- },
30
- "needsPinia": {
31
- "message": "Pinia (durum yönetimi)"
32
- },
33
- "needsVitest": {
34
- "message": "Vitest (birim testi)"
35
- },
36
- "needsE2eTesting": {
37
- "message": "Uçtan Uca Test"
38
- },
39
- "needsEslint": {
40
- "message": "Linter (hata önleme)"
41
- },
42
- "needsPrettier": {
43
- "message": "Prettier (kod formatlama)"
44
- },
45
- "e2eSelection": {
46
- "message": "Bir Uçtan Uca test çerçevesi seçin:",
47
- "hint": "(↑/↓ gezinmek için, enter onaylamak için)",
48
- "selectOptions": {
49
- "playwright": { "title": "Playwright", "desc": "https://playwright.dev/" },
50
- "cypress": {
51
- "title": "Cypress",
52
- "desc": "https://www.cypress.io/",
53
- "hintOnComponentTesting": "ayrıca Cypress Bileşen Testi ile birim testini de destekler - https://www.cypress.io/"
54
- }
55
- }
56
- },
57
- "needsExperimental": {
58
- "message": "Deneysel özellikleri etkinleştir"
59
- },
60
- "needsExperimentalFeatures": {
61
- "message": "Dahil edilecek deneysel özellikleri seçin:",
62
- "hint": "(↑/↓ gezinmek için, boşluk seçmek için, a tümünü seçmek için, enter onaylamak için)"
63
- },
64
- "needsRueBeta": {
65
- "message": "Rue 3.6 (beta)"
66
- },
67
- "needsOxfmt": {
68
- "message": "Prettier'ı Oxfmt ile değiştir"
69
- },
70
- "needsBareboneTemplates": {
71
- "message": "Tüm örnek kodları atlayıp boş bir Rue projesi ile başlansın mı?"
72
- },
73
- "packageManagerSelection": {
74
- "message": "Hangi paket yöneticisini kullanacaksınız?",
75
- "hint": "(Rue 3.6 beta, paket yöneticisine özgü sürüm geçersiz kılmaları gerektirir)"
76
- },
77
17
  "errors": {
78
18
  "operationCancelled": "İşlem iptal edildi"
79
19
  },
80
- "defaultToggleOptions": {
81
- "active": "Evet",
82
- "inactive": "Hayır"
83
- },
84
20
  "infos": {
85
21
  "scaffolding": "İskele projesi",
86
22
  "done": "Tamamlandı. Şimdi bunu çalıştır:",
@@ -14,73 +14,9 @@
14
14
  "message": "请输入包名称:",
15
15
  "invalidMessage": "无效的 package.json 名称"
16
16
  },
17
- "featureSelection": {
18
- "message": "请选择要包含的功能:",
19
- "hint": "(↑/↓ 切换,空格选择,a 全选,回车确认)"
20
- },
21
- "needsTypeScript": {
22
- "message": "是否使用 TypeScript 语法?"
23
- },
24
- "needsJsx": {
25
- "message": "JSX 支持"
26
- },
27
- "needsRouter": {
28
- "message": "Router(单页面应用开发)"
29
- },
30
- "needsPinia": {
31
- "message": "Pinia(状态管理)"
32
- },
33
- "needsVitest": {
34
- "message": "Vitest(单元测试)"
35
- },
36
- "needsE2eTesting": {
37
- "message": "端到端测试"
38
- },
39
- "needsEslint": {
40
- "message": "Linter(错误预防)"
41
- },
42
- "needsPrettier": {
43
- "message": "Prettier(代码格式化)"
44
- },
45
- "e2eSelection": {
46
- "message": "选择一个端到端测试框架:",
47
- "hint": "(↑/↓ 切换,回车确认)",
48
- "selectOptions": {
49
- "playwright": { "title": "Playwright", "desc": "https://playwright.dev/" },
50
- "cypress": {
51
- "title": "Cypress",
52
- "desc": "https://www.cypress.io/",
53
- "hintOnComponentTesting": "同时支持基于 Cypress Component Testing 的单元测试 - https://www.cypress.io/"
54
- }
55
- }
56
- },
57
- "needsExperimental": {
58
- "message": "启用试验特性"
59
- },
60
- "needsExperimentalFeatures": {
61
- "message": "选择要包含的试验特性:",
62
- "hint": "(↑/↓ 切换,空格选择,a 全选,回车确认)"
63
- },
64
- "needsRueBeta": {
65
- "message": "Rue 3.6(测试版)"
66
- },
67
- "needsOxfmt": {
68
- "message": "使用 Oxfmt 替代 Prettier"
69
- },
70
- "needsBareboneTemplates": {
71
- "message": "跳过所有示例代码,创建一个空白的 Rue 项目?"
72
- },
73
- "packageManagerSelection": {
74
- "message": "项目将使用哪个包管理器?",
75
- "hint": "(需要根据包管理器生成对应的 Rue 3.6 测试版配置)"
76
- },
77
17
  "errors": {
78
18
  "operationCancelled": "操作取消"
79
19
  },
80
- "defaultToggleOptions": {
81
- "active": "是",
82
- "inactive": "否"
83
- },
84
20
  "infos": {
85
21
  "scaffolding": "正在初始化项目",
86
22
  "done": "项目初始化完成,可执行以下命令:",
@@ -14,73 +14,9 @@
14
14
  "message": "請輸入套件名稱:",
15
15
  "invalidMessage": "無效的 package.json 名稱"
16
16
  },
17
- "featureSelection": {
18
- "message": "請選擇要包含的功能:",
19
- "hint": "(↑/↓ 切換,空格選擇,a 全選,enter 確認)"
20
- },
21
- "needsTypeScript": {
22
- "message": "是否使用 TypeScript?"
23
- },
24
- "needsJsx": {
25
- "message": "JSX 支援"
26
- },
27
- "needsRouter": {
28
- "message": "Router(單頁應用程式開發)"
29
- },
30
- "needsPinia": {
31
- "message": "Pinia(狀態管理)"
32
- },
33
- "needsVitest": {
34
- "message": "Vitest(單元測試)"
35
- },
36
- "needsE2eTesting": {
37
- "message": "端對端測試"
38
- },
39
- "needsEslint": {
40
- "message": "Linter(錯誤預防)"
41
- },
42
- "needsPrettier": {
43
- "message": "Prettier(程式碼格式化)"
44
- },
45
- "e2eSelection": {
46
- "message": "選擇一個端對端測試框架:",
47
- "hint": "(↑/↓ 切換,enter 確認)",
48
- "selectOptions": {
49
- "playwright": { "title": "Playwright", "desc": "https://playwright.dev/" },
50
- "cypress": {
51
- "title": "Cypress",
52
- "desc": "https://www.cypress.io/",
53
- "hintOnComponentTesting": "同時支援基於 Cypress Component Testing 的單元測試 - https://www.cypress.io/"
54
- }
55
- }
56
- },
57
- "needsExperimental": {
58
- "message": "启用試驗性功能"
59
- },
60
- "needsExperimentalFeatures": {
61
- "message": "請選擇要包含的試驗特性:",
62
- "hint": "(↑/↓ 切換,空格選擇,a 全選,enter 確認)"
63
- },
64
- "needsRueBeta": {
65
- "message": "Rue 3.6(測試版)"
66
- },
67
- "needsOxfmt": {
68
- "message": "使用 Oxfmt 替代 Prettier"
69
- },
70
- "needsBareboneTemplates": {
71
- "message": "跳過所有範例程式碼,建立一個空白的 Rue 專案?"
72
- },
73
- "packageManagerSelection": {
74
- "message": "專案將使用哪個套件管理器?",
75
- "hint": "(需要根據套件管理器生成對應的 Rue 3.6 測試版配置)"
76
- },
77
17
  "errors": {
78
18
  "operationCancelled": "操作取消"
79
19
  },
80
- "defaultToggleOptions": {
81
- "active": "是",
82
- "inactive": "否"
83
- },
84
20
  "infos": {
85
21
  "scaffolding": "正在建置專案",
86
22
  "done": "專案建置完成,可執行以下命令:",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-rue",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "🛠️ The recommended way to start a Vite-powered Rue project",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/hunzhiwange/create-rue#readme",
@@ -33,9 +33,7 @@
33
33
  "format-check": "vp fmt --check",
34
34
  "lint": "vp lint . --fix",
35
35
  "build": "rolldown -c rolldown.config.ts",
36
- "snapshot": "zx ./scripts/snapshot.mjs",
37
- "pretest": "pnpm run build && pnpm run snapshot",
38
- "test": "zx ./scripts/test.mjs",
36
+ "test": "pnpm run build && pnpm run test:unit",
39
37
  "test:unit": "vp test",
40
38
  "preversion": "git fetch && git status -uno | grep -q 'Your branch is up to date'",
41
39
  "postversion": "zx ./scripts/postversion.mjs",