create-rstack 1.4.4 → 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.
- package/dist/index.js +202 -192
- package/package.json +10 -9
- package/template-biome/{biome.json → biome.json.template} +6 -2
- package/template-biome/package.json +1 -1
- package/template-eslint/react-js/eslint.config.mjs +1 -1
- package/template-eslint/react-js/package.json +4 -4
- package/template-eslint/react-ts/eslint.config.mjs +1 -1
- package/template-eslint/react-ts/package.json +5 -5
- package/template-eslint/svelte-js/package.json +4 -4
- package/template-eslint/svelte-ts/package.json +5 -5
- package/template-eslint/vanilla-js/package.json +3 -3
- package/template-eslint/vanilla-ts/package.json +4 -4
- package/template-eslint/vue-js/eslint.config.mjs +1 -1
- package/template-eslint/vue-js/package.json +4 -4
- package/template-eslint/vue-ts/eslint.config.mjs +1 -1
- package/template-eslint/vue-ts/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import * as __WEBPACK_EXTERNAL_MODULE_tty__ from "tty";
|
|
3
|
+
import node_fs from "node:fs";
|
|
4
|
+
import node_path, { dirname } from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { stripVTControlCharacters } from "node:util";
|
|
7
|
+
import node_process, { stdin, stdout } from "node:process";
|
|
8
|
+
import node_readline from "node:readline";
|
|
9
|
+
import { Writable } from "node:stream";
|
|
10
|
+
import node_os from "node:os";
|
|
11
|
+
import node_tty from "node:tty";
|
|
13
12
|
var __webpack_modules__ = {
|
|
14
13
|
"./node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js": function(module) {
|
|
15
14
|
var isMergeableObject = function(value) {
|
|
@@ -459,11 +458,11 @@ var W = {
|
|
|
459
458
|
return i;
|
|
460
459
|
}, u.slice = function(F, s, i) {
|
|
461
460
|
textLen = u.length(F), s = s || 0, i = i || 1, s < 0 && (s = textLen + s), i < 0 && (i = textLen + i);
|
|
462
|
-
for(var D = "",
|
|
461
|
+
for(var D = "", C = 0, n = t(F), E = 0; E < n.length; E++){
|
|
463
462
|
var a = n[E], o = u.length(a);
|
|
464
|
-
if (
|
|
463
|
+
if (C >= s - (2 == o ? 1 : 0)) if (C + o <= i) D += a;
|
|
465
464
|
else break;
|
|
466
|
-
|
|
465
|
+
C += o;
|
|
467
466
|
}
|
|
468
467
|
return D;
|
|
469
468
|
};
|
|
@@ -498,7 +497,7 @@ function dist_p(e, u = {}) {
|
|
|
498
497
|
}
|
|
499
498
|
return F;
|
|
500
499
|
}
|
|
501
|
-
const dist_w = 10, dist_N = (e = 0)=>(u)=>`\x1B[${u + e}m`, dist_I = (e = 0)=>(u)=>`\x1B[${38 + e};5;${u}m`, dist_R = (e = 0)=>(u, t, F)=>`\x1B[${38 + e};2;${u};${t};${F}m`,
|
|
500
|
+
const dist_w = 10, dist_N = (e = 0)=>(u)=>`\x1B[${u + e}m`, dist_I = (e = 0)=>(u)=>`\x1B[${38 + e};5;${u}m`, dist_R = (e = 0)=>(u, t, F)=>`\x1B[${38 + e};2;${u};${t};${F}m`, dist_r = {
|
|
502
501
|
modifier: {
|
|
503
502
|
reset: [
|
|
504
503
|
0,
|
|
@@ -686,28 +685,28 @@ const dist_w = 10, dist_N = (e = 0)=>(u)=>`\x1B[${u + e}m`, dist_I = (e = 0)=>(u
|
|
|
686
685
|
]
|
|
687
686
|
}
|
|
688
687
|
};
|
|
689
|
-
Object.keys(
|
|
690
|
-
const iD = Object.keys(
|
|
688
|
+
Object.keys(dist_r.modifier);
|
|
689
|
+
const iD = Object.keys(dist_r.color), CD = Object.keys(dist_r.bgColor);
|
|
691
690
|
[
|
|
692
691
|
...iD,
|
|
693
|
-
...
|
|
692
|
+
...CD
|
|
694
693
|
];
|
|
695
|
-
function
|
|
694
|
+
function rD() {
|
|
696
695
|
const e = new Map;
|
|
697
|
-
for (const [u, t] of Object.entries(
|
|
698
|
-
for (const [F, s] of Object.entries(t))
|
|
696
|
+
for (const [u, t] of Object.entries(dist_r)){
|
|
697
|
+
for (const [F, s] of Object.entries(t))dist_r[F] = {
|
|
699
698
|
open: `\x1B[${s[0]}m`,
|
|
700
699
|
close: `\x1B[${s[1]}m`
|
|
701
|
-
}, t[F] =
|
|
702
|
-
Object.defineProperty(
|
|
700
|
+
}, t[F] = dist_r[F], e.set(s[0], s[1]);
|
|
701
|
+
Object.defineProperty(dist_r, u, {
|
|
703
702
|
value: t,
|
|
704
703
|
enumerable: !1
|
|
705
704
|
});
|
|
706
705
|
}
|
|
707
|
-
return Object.defineProperty(
|
|
706
|
+
return Object.defineProperty(dist_r, "codes", {
|
|
708
707
|
value: e,
|
|
709
708
|
enumerable: !1
|
|
710
|
-
}),
|
|
709
|
+
}), dist_r.color.close = "\x1B[39m", dist_r.bgColor.close = "\x1B[49m", dist_r.color.ansi = dist_N(), dist_r.color.ansi256 = dist_I(), dist_r.color.ansi16m = dist_R(), dist_r.bgColor.ansi = dist_N(dist_w), dist_r.bgColor.ansi256 = dist_I(dist_w), dist_r.bgColor.ansi16m = dist_R(dist_w), Object.defineProperties(dist_r, {
|
|
711
710
|
rgbToAnsi256: {
|
|
712
711
|
value: (u, t, F)=>u === t && t === F ? u < 8 ? 16 : u > 248 ? 231 : Math.round((u - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u / 255 * 5) + 6 * Math.round(t / 255 * 5) + Math.round(F / 255 * 5),
|
|
713
712
|
enumerable: !1
|
|
@@ -734,7 +733,7 @@ function CD() {
|
|
|
734
733
|
enumerable: !1
|
|
735
734
|
},
|
|
736
735
|
hexToAnsi256: {
|
|
737
|
-
value: (u)=>
|
|
736
|
+
value: (u)=>dist_r.rgbToAnsi256(...dist_r.hexToRgb(u)),
|
|
738
737
|
enumerable: !1
|
|
739
738
|
},
|
|
740
739
|
ansi256ToAnsi: {
|
|
@@ -745,8 +744,8 @@ function CD() {
|
|
|
745
744
|
if (u >= 232) t = ((u - 232) * 10 + 8) / 255, F = t, s = t;
|
|
746
745
|
else {
|
|
747
746
|
u -= 16;
|
|
748
|
-
const
|
|
749
|
-
t = Math.floor(u / 36) / 5, F = Math.floor(
|
|
747
|
+
const C = u % 36;
|
|
748
|
+
t = Math.floor(u / 36) / 5, F = Math.floor(C / 6) / 5, s = C % 6 / 5;
|
|
750
749
|
}
|
|
751
750
|
const i = 2 * Math.max(t, F, s);
|
|
752
751
|
if (0 === i) return 30;
|
|
@@ -756,16 +755,16 @@ function CD() {
|
|
|
756
755
|
enumerable: !1
|
|
757
756
|
},
|
|
758
757
|
rgbToAnsi: {
|
|
759
|
-
value: (u, t, F)=>
|
|
758
|
+
value: (u, t, F)=>dist_r.ansi256ToAnsi(dist_r.rgbToAnsi256(u, t, F)),
|
|
760
759
|
enumerable: !1
|
|
761
760
|
},
|
|
762
761
|
hexToAnsi: {
|
|
763
|
-
value: (u)=>
|
|
762
|
+
value: (u)=>dist_r.ansi256ToAnsi(dist_r.hexToAnsi256(u)),
|
|
764
763
|
enumerable: !1
|
|
765
764
|
}
|
|
766
|
-
}),
|
|
765
|
+
}), dist_r;
|
|
767
766
|
}
|
|
768
|
-
const ED =
|
|
767
|
+
const ED = rD(), d = new Set([
|
|
769
768
|
"\x1B",
|
|
770
769
|
"\x9B"
|
|
771
770
|
]), oD = 39, y = "\x07", V = "[", nD = "]", G = "m", _ = `${nD}8;;`, dist_z = (e)=>`${d.values().next().value}${V}${e}${G}`, K = (e)=>`${d.values().next().value}${_}${e}${y}`, aD = (e)=>e.split(" ").map((u)=>dist_p(u)), k = (e, u, t)=>{
|
|
@@ -773,13 +772,13 @@ const ED = CD(), d = new Set([
|
|
|
773
772
|
...u
|
|
774
773
|
];
|
|
775
774
|
let s = !1, i = !1, D = dist_p(P(e[e.length - 1]));
|
|
776
|
-
for (const [
|
|
775
|
+
for (const [C, n] of F.entries()){
|
|
777
776
|
const E = dist_p(n);
|
|
778
|
-
if (D + E <= t ? e[e.length - 1] += n : (e.push(n), D = 0), d.has(n) && (s = !0, i = F.slice(
|
|
777
|
+
if (D + E <= t ? e[e.length - 1] += n : (e.push(n), D = 0), d.has(n) && (s = !0, i = F.slice(C + 1).join("").startsWith(_)), s) {
|
|
779
778
|
i ? n === y && (s = !1, i = !1) : n === G && (s = !1);
|
|
780
779
|
continue;
|
|
781
780
|
}
|
|
782
|
-
D += E, D === t &&
|
|
781
|
+
D += E, D === t && C < F.length - 1 && (e.push(""), D = 0);
|
|
783
782
|
}
|
|
784
783
|
!D && e[e.length - 1].length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
|
|
785
784
|
}, hD = (e)=>{
|
|
@@ -791,33 +790,33 @@ const ED = CD(), d = new Set([
|
|
|
791
790
|
if (!1 !== t.trim && "" === e.trim()) return "";
|
|
792
791
|
let F = "", s, i;
|
|
793
792
|
const D = aD(e);
|
|
794
|
-
let
|
|
793
|
+
let C = [
|
|
795
794
|
""
|
|
796
795
|
];
|
|
797
796
|
for (const [E, a] of e.split(" ").entries()){
|
|
798
|
-
!1 !== t.trim && (
|
|
799
|
-
let o = dist_p(
|
|
800
|
-
if (0 !== E && (o >= u && (!1 === t.wordWrap || !1 === t.trim) && (
|
|
797
|
+
!1 !== t.trim && (C[C.length - 1] = C[C.length - 1].trimStart());
|
|
798
|
+
let o = dist_p(C[C.length - 1]);
|
|
799
|
+
if (0 !== E && (o >= u && (!1 === t.wordWrap || !1 === t.trim) && (C.push(""), o = 0), (o > 0 || !1 === t.trim) && (C[C.length - 1] += " ", o++)), t.hard && D[E] > u) {
|
|
801
800
|
const c = u - o, f = 1 + Math.floor((D[E] - c - 1) / u);
|
|
802
|
-
Math.floor((D[E] - 1) / u) < f &&
|
|
801
|
+
Math.floor((D[E] - 1) / u) < f && C.push(""), k(C, a, u);
|
|
803
802
|
continue;
|
|
804
803
|
}
|
|
805
804
|
if (o + D[E] > u && o > 0 && D[E] > 0) {
|
|
806
805
|
if (!1 === t.wordWrap && o < u) {
|
|
807
|
-
k(
|
|
806
|
+
k(C, a, u);
|
|
808
807
|
continue;
|
|
809
808
|
}
|
|
810
|
-
|
|
809
|
+
C.push("");
|
|
811
810
|
}
|
|
812
811
|
if (o + D[E] > u && !1 === t.wordWrap) {
|
|
813
|
-
k(
|
|
812
|
+
k(C, a, u);
|
|
814
813
|
continue;
|
|
815
814
|
}
|
|
816
|
-
|
|
815
|
+
C[C.length - 1] += a;
|
|
817
816
|
}
|
|
818
|
-
!1 !== t.trim && (
|
|
817
|
+
!1 !== t.trim && (C = C.map((E)=>hD(E)));
|
|
819
818
|
const n = [
|
|
820
|
-
...
|
|
819
|
+
...C.join(`
|
|
821
820
|
`)
|
|
822
821
|
];
|
|
823
822
|
for (const [E, a] of n.entries()){
|
|
@@ -911,8 +910,8 @@ var gD = Object.defineProperty, vD = (e, u, t)=>u in e ? gD(e, u, {
|
|
|
911
910
|
class x {
|
|
912
911
|
constructor(u, t = !0){
|
|
913
912
|
dist_h(this, "input"), dist_h(this, "output"), dist_h(this, "_abortSignal"), dist_h(this, "rl"), dist_h(this, "opts"), dist_h(this, "_render"), dist_h(this, "_track", !1), dist_h(this, "_prevFrame", ""), dist_h(this, "_subscribers", new Map), dist_h(this, "_cursor", 0), dist_h(this, "state", "initial"), dist_h(this, "error", ""), dist_h(this, "value");
|
|
914
|
-
const { input: F =
|
|
915
|
-
this.opts =
|
|
913
|
+
const { input: F = stdin, output: s = stdout, render: i, signal: D, ...C } = u;
|
|
914
|
+
this.opts = C, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i.bind(this), this._track = t, this._abortSignal = D, this.input = F, this.output = s;
|
|
916
915
|
}
|
|
917
916
|
unsubscribe() {
|
|
918
917
|
this._subscribers.clear();
|
|
@@ -947,17 +946,17 @@ class x {
|
|
|
947
946
|
once: !0
|
|
948
947
|
});
|
|
949
948
|
}
|
|
950
|
-
const F = new
|
|
949
|
+
const F = new Writable;
|
|
951
950
|
F._write = (s, i, D)=>{
|
|
952
951
|
this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D();
|
|
953
|
-
}, this.input.pipe(F), this.rl =
|
|
952
|
+
}, this.input.pipe(F), this.rl = node_readline.createInterface({
|
|
954
953
|
input: this.input,
|
|
955
954
|
output: F,
|
|
956
955
|
tabSize: 2,
|
|
957
956
|
prompt: "",
|
|
958
957
|
escapeCodeTimeout: 50,
|
|
959
958
|
terminal: !0
|
|
960
|
-
}),
|
|
959
|
+
}), node_readline.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), void 0 !== this.opts.initialValue && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), dist_m(this.input, !0), this.output.on("resize", this.render), this.render(), this.once("submit", ()=>{
|
|
961
960
|
this.output.write(src.cursor.show), this.output.off("resize", this.render), dist_m(this.input, !1), u(this.value);
|
|
962
961
|
}), this.once("cancel", ()=>{
|
|
963
962
|
this.output.write(src.cursor.show), this.output.off("resize", this.render), dist_m(this.input, !1), u(dist_S);
|
|
@@ -966,7 +965,7 @@ class x {
|
|
|
966
965
|
}
|
|
967
966
|
onKeypress(u, t) {
|
|
968
967
|
if ("error" === this.state && (this.state = "active"), t?.name && (!this._track && dist_B.aliases.has(t.name) && this.emit("cursor", dist_B.aliases.get(t.name)), dist_B.actions.has(t.name) && this.emit("cursor", t.name)), u && ("y" === u.toLowerCase() || "n" === u.toLowerCase()) && this.emit("confirm", "y" === u.toLowerCase()), " " === u && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u && this.emit("key", u.toLowerCase()), t?.name === "return") {
|
|
969
|
-
if (
|
|
968
|
+
if (this.opts.validate) {
|
|
970
969
|
const F = this.opts.validate(this.value);
|
|
971
970
|
F && (this.error = F instanceof Error ? F.message : F, this.state = "error", this.rl?.write(this.value));
|
|
972
971
|
}
|
|
@@ -1110,7 +1109,7 @@ class RD extends x {
|
|
|
1110
1109
|
}
|
|
1111
1110
|
}
|
|
1112
1111
|
function ce() {
|
|
1113
|
-
return "win32" !==
|
|
1112
|
+
return "win32" !== node_process.platform ? "linux" !== node_process.env.TERM : !!node_process.env.CI || !!node_process.env.WT_SESSION || !!node_process.env.TERMINUS_SUBLIME || "{cmd::Cmder}" === node_process.env.ConEmuTask || "Terminus-Sublime" === node_process.env.TERM_PROGRAM || "vscode" === node_process.env.TERM_PROGRAM || "xterm-256color" === node_process.env.TERM || "alacritty" === node_process.env.TERM || "JetBrains-JediTerm" === node_process.env.TERMINAL_EMULATOR;
|
|
1114
1113
|
}
|
|
1115
1114
|
const dist_V = ce(), dist_u = (t, n)=>dist_V ? t : n, le = dist_u("\u25C6", "*"), dist_L = dist_u("\u25A0", "x"), dist_W = dist_u("\u25B2", "x"), dist_C = dist_u("\u25C7", "o"), dist_o = (dist_u("\u250C", "T"), dist_u("\u2502", "|")), dist_d = dist_u("\u2514", "\u2014"), dist_k = dist_u("\u25CF", ">"), dist_P = dist_u("\u25CB", " "), dist_A = dist_u("\u25FB", "[\u2022]"), dist_T = dist_u("\u25FC", "[+]"), dist_F = dist_u("\u25FB", "[ ]"), dist_ = (dist_u("\u25AA", "\u2022"), dist_u("\u2500", "-")), me = dist_u("\u256E", "+"), de = dist_u("\u251C", "+"), pe = dist_u("\u256F", "+"), dist_b = (dist_u("\u25CF", "\u2022"), dist_u("\u25C6", "*"), dist_u("\u25B2", "!"), dist_u("\u25A0", "x"), (t)=>{
|
|
1116
1115
|
switch(t){
|
|
@@ -1261,10 +1260,10 @@ ${picocolors.cyan(dist_d)}
|
|
|
1261
1260
|
const r = `
|
|
1262
1261
|
${t}
|
|
1263
1262
|
`.split(`
|
|
1264
|
-
`), i =
|
|
1265
|
-
const $ =
|
|
1263
|
+
`), i = stripVTControlCharacters(n).length, s = Math.max(r.reduce((a, l)=>{
|
|
1264
|
+
const $ = stripVTControlCharacters(l);
|
|
1266
1265
|
return $.length > a ? $.length : a;
|
|
1267
|
-
}, 0), i) + 2, c = r.map((a)=>`${picocolors.gray(dist_o)} ${picocolors.dim(a)}${" ".repeat(s -
|
|
1266
|
+
}, 0), i) + 2, c = r.map((a)=>`${picocolors.gray(dist_o)} ${picocolors.dim(a)}${" ".repeat(s - stripVTControlCharacters(a).length)}${picocolors.gray(dist_o)}`).join(`
|
|
1268
1267
|
`);
|
|
1269
1268
|
process.stdout.write(`${picocolors.gray(dist_o)}
|
|
1270
1269
|
${picocolors.green(dist_C)} ${picocolors.reset(n)} ${picocolors.gray(dist_.repeat(Math.max(s - i - 1, 1)) + me)}
|
|
@@ -1286,22 +1285,29 @@ var cjs = __webpack_require__("./node_modules/.pnpm/deepmerge@4.3.1/node_modules
|
|
|
1286
1285
|
var cjs_default = /*#__PURE__*/ __webpack_require__.n(cjs);
|
|
1287
1286
|
var minimist = __webpack_require__("./node_modules/.pnpm/minimist@1.2.8/node_modules/minimist/index.js");
|
|
1288
1287
|
var minimist_default = /*#__PURE__*/ __webpack_require__.n(minimist);
|
|
1289
|
-
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args :
|
|
1290
|
-
const prefix = flag.startsWith(
|
|
1288
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : node_process.argv) {
|
|
1289
|
+
const prefix = flag.startsWith('-') ? '' : 1 === flag.length ? '-' : '--';
|
|
1291
1290
|
const position = argv.indexOf(prefix + flag);
|
|
1292
|
-
const terminatorPosition = argv.indexOf(
|
|
1291
|
+
const terminatorPosition = argv.indexOf('--');
|
|
1293
1292
|
return -1 !== position && (-1 === terminatorPosition || position < terminatorPosition);
|
|
1294
1293
|
}
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
if (hasFlag(
|
|
1298
|
-
else if (hasFlag(
|
|
1294
|
+
const { env } = node_process;
|
|
1295
|
+
let flagForceColor;
|
|
1296
|
+
if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false') || hasFlag('color=never')) flagForceColor = 0;
|
|
1297
|
+
else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) flagForceColor = 1;
|
|
1299
1298
|
function envForceColor() {
|
|
1300
|
-
if (
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1299
|
+
if (!('FORCE_COLOR' in env)) return;
|
|
1300
|
+
if ('true' === env.FORCE_COLOR) return 1;
|
|
1301
|
+
if ('false' === env.FORCE_COLOR) return 0;
|
|
1302
|
+
if (0 === env.FORCE_COLOR.length) return 1;
|
|
1303
|
+
const level = Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
1304
|
+
if (![
|
|
1305
|
+
0,
|
|
1306
|
+
1,
|
|
1307
|
+
2,
|
|
1308
|
+
3
|
|
1309
|
+
].includes(level)) return;
|
|
1310
|
+
return level;
|
|
1305
1311
|
}
|
|
1306
1312
|
function translateLevel(level) {
|
|
1307
1313
|
if (0 === level) return false;
|
|
@@ -1318,45 +1324,48 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
|
1318
1324
|
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
1319
1325
|
if (0 === forceColor) return 0;
|
|
1320
1326
|
if (sniffFlags) {
|
|
1321
|
-
if (hasFlag(
|
|
1322
|
-
if (hasFlag(
|
|
1327
|
+
if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) return 3;
|
|
1328
|
+
if (hasFlag('color=256')) return 2;
|
|
1323
1329
|
}
|
|
1324
|
-
if (
|
|
1330
|
+
if ('TF_BUILD' in env && 'AGENT_NAME' in env) return 1;
|
|
1325
1331
|
if (haveStream && !streamIsTTY && void 0 === forceColor) return 0;
|
|
1326
1332
|
const min = forceColor || 0;
|
|
1327
|
-
if (
|
|
1328
|
-
if (
|
|
1329
|
-
const osRelease =
|
|
1333
|
+
if ('dumb' === env.TERM) return min;
|
|
1334
|
+
if ('win32' === node_process.platform) {
|
|
1335
|
+
const osRelease = node_os.release().split('.');
|
|
1330
1336
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
1331
1337
|
return 1;
|
|
1332
1338
|
}
|
|
1333
|
-
if (
|
|
1334
|
-
if (
|
|
1339
|
+
if ('CI' in env) {
|
|
1340
|
+
if ([
|
|
1341
|
+
'GITHUB_ACTIONS',
|
|
1342
|
+
'GITEA_ACTIONS',
|
|
1343
|
+
'CIRCLECI'
|
|
1344
|
+
].some((key)=>key in env)) return 3;
|
|
1335
1345
|
if ([
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
].some((sign)=>sign in env) || "codeship" === env.CI_NAME) return 1;
|
|
1346
|
+
'TRAVIS',
|
|
1347
|
+
'APPVEYOR',
|
|
1348
|
+
'GITLAB_CI',
|
|
1349
|
+
'BUILDKITE',
|
|
1350
|
+
'DRONE'
|
|
1351
|
+
].some((sign)=>sign in env) || 'codeship' === env.CI_NAME) return 1;
|
|
1343
1352
|
return min;
|
|
1344
1353
|
}
|
|
1345
|
-
if (
|
|
1346
|
-
if (
|
|
1347
|
-
if (
|
|
1348
|
-
if (
|
|
1349
|
-
const version = Number.parseInt((env.TERM_PROGRAM_VERSION ||
|
|
1354
|
+
if ('TEAMCITY_VERSION' in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
1355
|
+
if ('truecolor' === env.COLORTERM) return 3;
|
|
1356
|
+
if ('xterm-kitty' === env.TERM) return 3;
|
|
1357
|
+
if ('TERM_PROGRAM' in env) {
|
|
1358
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
|
1350
1359
|
switch(env.TERM_PROGRAM){
|
|
1351
|
-
case
|
|
1360
|
+
case 'iTerm.app':
|
|
1352
1361
|
return version >= 3 ? 3 : 2;
|
|
1353
|
-
case
|
|
1362
|
+
case 'Apple_Terminal':
|
|
1354
1363
|
return 2;
|
|
1355
1364
|
}
|
|
1356
1365
|
}
|
|
1357
1366
|
if (/-256(color)?$/i.test(env.TERM)) return 2;
|
|
1358
1367
|
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
|
|
1359
|
-
if (
|
|
1368
|
+
if ('COLORTERM' in env) return 1;
|
|
1360
1369
|
return min;
|
|
1361
1370
|
}
|
|
1362
1371
|
function createSupportsColor(stream, options = {}) {
|
|
@@ -1366,49 +1375,49 @@ function createSupportsColor(stream, options = {}) {
|
|
|
1366
1375
|
});
|
|
1367
1376
|
return translateLevel(level);
|
|
1368
1377
|
}
|
|
1369
|
-
|
|
1378
|
+
const supportsColor = {
|
|
1370
1379
|
stdout: createSupportsColor({
|
|
1371
|
-
isTTY:
|
|
1380
|
+
isTTY: node_tty.isatty(1)
|
|
1372
1381
|
}),
|
|
1373
1382
|
stderr: createSupportsColor({
|
|
1374
|
-
isTTY:
|
|
1383
|
+
isTTY: node_tty.isatty(2)
|
|
1375
1384
|
})
|
|
1376
1385
|
};
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
let string =
|
|
1386
|
+
const supports_color = supportsColor;
|
|
1387
|
+
const colorLevel = supports_color.stdout ? supports_color.stdout.level : 0;
|
|
1388
|
+
let errorStackRegExp = /at\s.*:\d+:\d+[\s\)]*$/;
|
|
1389
|
+
let anonymousErrorStackRegExp = /at\s.*\(<anonymous>\)$/;
|
|
1390
|
+
let isErrorStackMessage = (message)=>errorStackRegExp.test(message) || anonymousErrorStackRegExp.test(message);
|
|
1391
|
+
let formatter = (open, close, replace = open)=>colorLevel >= 2 ? (input)=>{
|
|
1392
|
+
let string = '' + input;
|
|
1384
1393
|
let index = string.indexOf(close, open.length);
|
|
1385
1394
|
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
1386
1395
|
} : String;
|
|
1387
|
-
|
|
1396
|
+
let replaceClose = (string, close, replace, index)=>{
|
|
1388
1397
|
let start = string.substring(0, index) + replace;
|
|
1389
1398
|
let end = string.substring(index + close.length);
|
|
1390
1399
|
let nextIndex = end.indexOf(close);
|
|
1391
1400
|
return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end;
|
|
1392
1401
|
};
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1402
|
+
const bold = formatter('\x1b[1m', '\x1b[22m', '\x1b[22m\x1b[1m');
|
|
1403
|
+
const red = formatter('\x1b[31m', '\x1b[39m');
|
|
1404
|
+
const green = formatter('\x1b[32m', '\x1b[39m');
|
|
1405
|
+
const yellow = formatter('\x1b[33m', '\x1b[39m');
|
|
1406
|
+
const magenta = formatter('\x1b[35m', '\x1b[39m');
|
|
1407
|
+
const cyan = formatter('\x1b[36m', '\x1b[39m');
|
|
1408
|
+
const gray = formatter('\x1b[90m', '\x1b[39m');
|
|
1409
|
+
let startColor = [
|
|
1401
1410
|
189,
|
|
1402
1411
|
255,
|
|
1403
1412
|
243
|
|
1404
1413
|
];
|
|
1405
|
-
|
|
1414
|
+
let endColor = [
|
|
1406
1415
|
74,
|
|
1407
1416
|
194,
|
|
1408
1417
|
154
|
|
1409
1418
|
];
|
|
1410
|
-
|
|
1411
|
-
|
|
1419
|
+
let isWord = (char)=>!/[\s\n]/.test(char);
|
|
1420
|
+
let gradient = (message)=>{
|
|
1412
1421
|
if (colorLevel < 3) return 2 === colorLevel ? bold(cyan(message)) : message;
|
|
1413
1422
|
let chars = [
|
|
1414
1423
|
...message
|
|
@@ -1420,108 +1429,108 @@ var gradient = (message)=>{
|
|
|
1420
1429
|
let rStep = (endColor[0] - r) / steps;
|
|
1421
1430
|
let gStep = (endColor[1] - g) / steps;
|
|
1422
1431
|
let bStep = (endColor[2] - b) / steps;
|
|
1423
|
-
let output =
|
|
1432
|
+
let output = '';
|
|
1424
1433
|
for (let char of chars){
|
|
1425
1434
|
if (isWord(char)) {
|
|
1426
1435
|
r += rStep;
|
|
1427
1436
|
g += gStep;
|
|
1428
1437
|
b += bStep;
|
|
1429
1438
|
}
|
|
1430
|
-
output += `\
|
|
1439
|
+
output += `\x1b[38;2;${Math.round(r)};${Math.round(g)};${Math.round(b)}m${char}\x1b[39m`;
|
|
1431
1440
|
}
|
|
1432
1441
|
return bold(output);
|
|
1433
1442
|
};
|
|
1434
|
-
|
|
1443
|
+
let LOG_LEVEL = {
|
|
1444
|
+
silent: -1,
|
|
1435
1445
|
error: 0,
|
|
1436
1446
|
warn: 1,
|
|
1437
1447
|
info: 2,
|
|
1438
|
-
log:
|
|
1439
|
-
verbose:
|
|
1448
|
+
log: 2,
|
|
1449
|
+
verbose: 3
|
|
1440
1450
|
};
|
|
1441
|
-
|
|
1451
|
+
let LOG_TYPES = {
|
|
1442
1452
|
error: {
|
|
1443
|
-
label:
|
|
1444
|
-
level:
|
|
1453
|
+
label: 'error',
|
|
1454
|
+
level: 'error',
|
|
1445
1455
|
color: red
|
|
1446
1456
|
},
|
|
1447
1457
|
warn: {
|
|
1448
|
-
label:
|
|
1449
|
-
level:
|
|
1458
|
+
label: 'warn',
|
|
1459
|
+
level: 'warn',
|
|
1450
1460
|
color: yellow
|
|
1451
1461
|
},
|
|
1452
1462
|
info: {
|
|
1453
|
-
label:
|
|
1454
|
-
level:
|
|
1463
|
+
label: 'info',
|
|
1464
|
+
level: 'info',
|
|
1455
1465
|
color: cyan
|
|
1456
1466
|
},
|
|
1457
1467
|
start: {
|
|
1458
|
-
label:
|
|
1459
|
-
level:
|
|
1468
|
+
label: 'start',
|
|
1469
|
+
level: 'info',
|
|
1460
1470
|
color: cyan
|
|
1461
1471
|
},
|
|
1462
1472
|
ready: {
|
|
1463
|
-
label:
|
|
1464
|
-
level:
|
|
1473
|
+
label: 'ready',
|
|
1474
|
+
level: 'info',
|
|
1465
1475
|
color: green
|
|
1466
1476
|
},
|
|
1467
1477
|
success: {
|
|
1468
|
-
label:
|
|
1469
|
-
level:
|
|
1478
|
+
label: 'success',
|
|
1479
|
+
level: 'info',
|
|
1470
1480
|
color: green
|
|
1471
1481
|
},
|
|
1472
1482
|
log: {
|
|
1473
|
-
level:
|
|
1483
|
+
level: 'info'
|
|
1474
1484
|
},
|
|
1475
1485
|
debug: {
|
|
1476
|
-
label:
|
|
1477
|
-
level:
|
|
1486
|
+
label: 'debug',
|
|
1487
|
+
level: 'verbose',
|
|
1478
1488
|
color: magenta
|
|
1479
1489
|
}
|
|
1480
1490
|
};
|
|
1481
|
-
|
|
1482
|
-
let maxLevel = options.level ||
|
|
1491
|
+
let createLogger = (options = {})=>{
|
|
1492
|
+
let maxLevel = options.level || 'info';
|
|
1483
1493
|
let log = (type, message, ...args)=>{
|
|
1484
1494
|
if (LOG_LEVEL[LOG_TYPES[type].level] > LOG_LEVEL[maxLevel]) return;
|
|
1485
1495
|
if (null == message) return console.log();
|
|
1486
1496
|
let logType = LOG_TYPES[type];
|
|
1487
|
-
let label =
|
|
1488
|
-
let text =
|
|
1489
|
-
if (
|
|
1490
|
-
label = (logType.label ||
|
|
1497
|
+
let label = '';
|
|
1498
|
+
let text = '';
|
|
1499
|
+
if ('label' in logType) {
|
|
1500
|
+
label = (logType.label || '').padEnd(7);
|
|
1491
1501
|
label = bold(logType.color ? logType.color(label) : label);
|
|
1492
1502
|
}
|
|
1493
1503
|
if (message instanceof Error) if (message.stack) {
|
|
1494
|
-
let [name, ...rest] = message.stack.split(
|
|
1495
|
-
if (name.startsWith(
|
|
1496
|
-
text = `${name}
|
|
1497
|
-
${gray(rest.join("\n"))}`;
|
|
1504
|
+
let [name, ...rest] = message.stack.split('\n');
|
|
1505
|
+
if (name.startsWith('Error: ')) name = name.slice(7);
|
|
1506
|
+
text = `${name}\n${gray(rest.join('\n'))}`;
|
|
1498
1507
|
} else text = message.message;
|
|
1499
|
-
else if (
|
|
1500
|
-
let lines = message.split(
|
|
1501
|
-
text = lines.map((line)=>isErrorStackMessage(line) ? gray(line) : line).join(
|
|
1508
|
+
else if ('error' === logType.level && 'string' == typeof message) {
|
|
1509
|
+
let lines = message.split('\n');
|
|
1510
|
+
text = lines.map((line)=>isErrorStackMessage(line) ? gray(line) : line).join('\n');
|
|
1502
1511
|
} else text = `${message}`;
|
|
1503
1512
|
console.log(label.length ? `${label} ${text}` : text, ...args);
|
|
1504
1513
|
};
|
|
1505
|
-
let
|
|
1506
|
-
greet: (message)=>log(
|
|
1514
|
+
let logger = {
|
|
1515
|
+
greet: (message)=>log('log', gradient(message))
|
|
1507
1516
|
};
|
|
1508
1517
|
Object.keys(LOG_TYPES).forEach((key)=>{
|
|
1509
|
-
|
|
1518
|
+
logger[key] = (...args)=>log(key, ...args);
|
|
1510
1519
|
});
|
|
1511
|
-
Object.defineProperty(
|
|
1520
|
+
Object.defineProperty(logger, 'level', {
|
|
1512
1521
|
get: ()=>maxLevel,
|
|
1513
1522
|
set (val) {
|
|
1514
1523
|
maxLevel = val;
|
|
1515
1524
|
}
|
|
1516
1525
|
});
|
|
1517
|
-
|
|
1518
|
-
Object.assign(
|
|
1526
|
+
logger.override = (customLogger)=>{
|
|
1527
|
+
Object.assign(logger, customLogger);
|
|
1519
1528
|
};
|
|
1520
|
-
return
|
|
1529
|
+
return logger;
|
|
1521
1530
|
};
|
|
1522
|
-
|
|
1523
|
-
const src_filename =
|
|
1524
|
-
const src_dirname =
|
|
1531
|
+
let src_logger = createLogger();
|
|
1532
|
+
const src_filename = fileURLToPath(import.meta.url);
|
|
1533
|
+
const src_dirname = dirname(src_filename);
|
|
1525
1534
|
function cancelAndExit() {
|
|
1526
1535
|
xe('Operation cancelled.');
|
|
1527
1536
|
process.exit(0);
|
|
@@ -1533,7 +1542,7 @@ function checkCancel(value) {
|
|
|
1533
1542
|
function formatProjectName(input) {
|
|
1534
1543
|
const formatted = input.trim().replace(/\/+$/g, '');
|
|
1535
1544
|
return {
|
|
1536
|
-
packageName: formatted.startsWith('@') ? formatted :
|
|
1545
|
+
packageName: formatted.startsWith('@') ? formatted : node_path.basename(formatted),
|
|
1537
1546
|
targetDir: formatted
|
|
1538
1547
|
};
|
|
1539
1548
|
}
|
|
@@ -1547,11 +1556,11 @@ function pkgFromUserAgent(userAgent) {
|
|
|
1547
1556
|
};
|
|
1548
1557
|
}
|
|
1549
1558
|
function isEmptyDir(path) {
|
|
1550
|
-
const files =
|
|
1559
|
+
const files = node_fs.readdirSync(path);
|
|
1551
1560
|
return 0 === files.length || 1 === files.length && '.git' === files[0];
|
|
1552
1561
|
}
|
|
1553
1562
|
function logHelpMessage(name, templates) {
|
|
1554
|
-
|
|
1563
|
+
src_logger.log(`
|
|
1555
1564
|
Usage: create-${name} [options]
|
|
1556
1565
|
|
|
1557
1566
|
Options:
|
|
@@ -1596,8 +1605,8 @@ async function getTools({ tools, dir, template }) {
|
|
|
1596
1605
|
function upperFirst(str) {
|
|
1597
1606
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
1598
1607
|
}
|
|
1599
|
-
const readJSON = async (path)=>JSON.parse(await
|
|
1600
|
-
const readPackageJson = async (filePath)=>readJSON(
|
|
1608
|
+
const readJSON = async (path)=>JSON.parse(await node_fs.promises.readFile(path, 'utf-8'));
|
|
1609
|
+
const readPackageJson = async (filePath)=>readJSON(node_path.join(filePath, 'package.json'));
|
|
1601
1610
|
async function create({ name, root, templates, skipFiles, getTemplateName, mapESLintTemplate, version, noteInformation }) {
|
|
1602
1611
|
const argv = minimist_default()(process.argv.slice(2), {
|
|
1603
1612
|
alias: {
|
|
@@ -1607,7 +1616,7 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
|
|
|
1607
1616
|
}
|
|
1608
1617
|
});
|
|
1609
1618
|
console.log('');
|
|
1610
|
-
|
|
1619
|
+
src_logger.greet(`\u{25C6} Create ${upperFirst(name)} Project`);
|
|
1611
1620
|
if (argv.help) return void logHelpMessage(name, templates);
|
|
1612
1621
|
const cwd = process.cwd();
|
|
1613
1622
|
const pkgInfo = pkgFromUserAgent(process.env.npm_config_user_agent);
|
|
@@ -1615,8 +1624,8 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
|
|
|
1615
1624
|
if (!version) version = (await readPackageJson(root)).version;
|
|
1616
1625
|
const projectName = argv.dir ?? checkCancel(await he({
|
|
1617
1626
|
message: 'Project name or path',
|
|
1618
|
-
placeholder: `${name}-project`,
|
|
1619
|
-
defaultValue: `${name}-project`,
|
|
1627
|
+
placeholder: `${name.toLowerCase()}-project`,
|
|
1628
|
+
defaultValue: `${name.toLowerCase()}-project`,
|
|
1620
1629
|
validate (value) {
|
|
1621
1630
|
if (0 === value.length) return 'Project name is required';
|
|
1622
1631
|
}
|
|
@@ -1624,8 +1633,8 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
|
|
|
1624
1633
|
const formatted = formatProjectName(projectName);
|
|
1625
1634
|
const { targetDir } = formatted;
|
|
1626
1635
|
const packageName = argv['package-name'] || formatted.packageName;
|
|
1627
|
-
const distFolder =
|
|
1628
|
-
if (!argv.override &&
|
|
1636
|
+
const distFolder = node_path.isAbsolute(targetDir) ? targetDir : node_path.join(cwd, targetDir);
|
|
1637
|
+
if (!argv.override && node_fs.existsSync(distFolder) && !isEmptyDir(distFolder)) {
|
|
1629
1638
|
const option = checkCancel(await ve({
|
|
1630
1639
|
message: `"${targetDir}" is not empty, please choose:`,
|
|
1631
1640
|
options: [
|
|
@@ -1643,9 +1652,9 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
|
|
|
1643
1652
|
}
|
|
1644
1653
|
const templateName = await getTemplateName(argv);
|
|
1645
1654
|
const tools = await getTools(argv);
|
|
1646
|
-
const srcFolder =
|
|
1647
|
-
const commonFolder =
|
|
1648
|
-
if (!
|
|
1655
|
+
const srcFolder = node_path.join(root, `template-${templateName}`);
|
|
1656
|
+
const commonFolder = node_path.join(root, 'template-common');
|
|
1657
|
+
if (!node_fs.existsSync(srcFolder)) throw new Error(`Invalid input: template "${templateName}" not found.`);
|
|
1649
1658
|
copyFolder({
|
|
1650
1659
|
from: commonFolder,
|
|
1651
1660
|
to: distFolder,
|
|
@@ -1659,13 +1668,13 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
|
|
|
1659
1668
|
packageName,
|
|
1660
1669
|
skipFiles
|
|
1661
1670
|
});
|
|
1662
|
-
const packageRoot =
|
|
1671
|
+
const packageRoot = node_path.resolve(src_dirname, '..');
|
|
1663
1672
|
for (const tool of tools){
|
|
1664
|
-
const toolFolder =
|
|
1673
|
+
const toolFolder = node_path.join(packageRoot, `template-${tool}`);
|
|
1665
1674
|
if ('eslint' === tool) {
|
|
1666
1675
|
const eslintTemplateName = mapESLintTemplate(templateName);
|
|
1667
1676
|
if (!eslintTemplateName) continue;
|
|
1668
|
-
const subFolder =
|
|
1677
|
+
const subFolder = node_path.join(toolFolder, eslintTemplateName);
|
|
1669
1678
|
copyFolder({
|
|
1670
1679
|
from: subFolder,
|
|
1671
1680
|
to: distFolder,
|
|
@@ -1684,12 +1693,13 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
|
|
|
1684
1693
|
});
|
|
1685
1694
|
if ('biome' === tool) {
|
|
1686
1695
|
const packageJson = await readPackageJson(distFolder);
|
|
1687
|
-
let biomeVersion = packageJson.devDependencies?.['@biomejs/biome'] ?? '
|
|
1696
|
+
let biomeVersion = packageJson.devDependencies?.['@biomejs/biome'] ?? '2.0.0';
|
|
1688
1697
|
biomeVersion = biomeVersion.replace(/\^/, '');
|
|
1689
|
-
const
|
|
1690
|
-
const
|
|
1698
|
+
const biomeJsonTemplatePath = node_path.join(distFolder, 'biome.json.template');
|
|
1699
|
+
const biomeJsonPath = node_path.join(distFolder, 'biome.json');
|
|
1700
|
+
const biomeJson = await readJSON(biomeJsonTemplatePath);
|
|
1691
1701
|
biomeJson.$schema = biomeJson.$schema.replace('{version}', biomeVersion);
|
|
1692
|
-
await
|
|
1702
|
+
await node_fs.promises.writeFile(biomeJsonPath, `${JSON.stringify(biomeJson, null, 2)}\n`, 'utf-8');
|
|
1693
1703
|
}
|
|
1694
1704
|
}
|
|
1695
1705
|
const nextSteps = noteInformation ? noteInformation : [
|
|
@@ -1708,9 +1718,9 @@ function sortObjectKeys(obj) {
|
|
|
1708
1718
|
return sortedObj;
|
|
1709
1719
|
}
|
|
1710
1720
|
function mergePackageJson(targetPackage, extraPackage) {
|
|
1711
|
-
if (!
|
|
1712
|
-
const targetJson = JSON.parse(
|
|
1713
|
-
const extraJson = JSON.parse(
|
|
1721
|
+
if (!node_fs.existsSync(targetPackage)) return;
|
|
1722
|
+
const targetJson = JSON.parse(node_fs.readFileSync(targetPackage, 'utf-8'));
|
|
1723
|
+
const extraJson = JSON.parse(node_fs.readFileSync(extraPackage, 'utf-8'));
|
|
1714
1724
|
const mergedJson = cjs_default()(targetJson, extraJson);
|
|
1715
1725
|
mergedJson.name = targetJson.name || extraJson.name;
|
|
1716
1726
|
for (const key of [
|
|
@@ -1718,7 +1728,7 @@ function mergePackageJson(targetPackage, extraPackage) {
|
|
|
1718
1728
|
'dependencies',
|
|
1719
1729
|
'devDependencies'
|
|
1720
1730
|
])if (key in mergedJson) mergedJson[key] = sortObjectKeys(mergedJson[key]);
|
|
1721
|
-
|
|
1731
|
+
node_fs.writeFileSync(targetPackage, `${JSON.stringify(mergedJson, null, 2)}\n`);
|
|
1722
1732
|
}
|
|
1723
1733
|
function copyFolder({ from, to, version, packageName, isMergePackageJson, skipFiles = [] }) {
|
|
1724
1734
|
const renameFiles = {
|
|
@@ -1729,14 +1739,14 @@ function copyFolder({ from, to, version, packageName, isMergePackageJson, skipFi
|
|
|
1729
1739
|
'dist',
|
|
1730
1740
|
...skipFiles
|
|
1731
1741
|
];
|
|
1732
|
-
|
|
1742
|
+
node_fs.mkdirSync(to, {
|
|
1733
1743
|
recursive: true
|
|
1734
1744
|
});
|
|
1735
|
-
for (const file of
|
|
1745
|
+
for (const file of node_fs.readdirSync(from)){
|
|
1736
1746
|
if (allSkipFiles.includes(file)) continue;
|
|
1737
|
-
const srcFile =
|
|
1738
|
-
const distFile = renameFiles[file] ?
|
|
1739
|
-
const stat =
|
|
1747
|
+
const srcFile = node_path.resolve(from, file);
|
|
1748
|
+
const distFile = renameFiles[file] ? node_path.resolve(to, renameFiles[file]) : node_path.resolve(to, file);
|
|
1749
|
+
const stat = node_fs.statSync(srcFile);
|
|
1740
1750
|
if (stat.isDirectory()) copyFolder({
|
|
1741
1751
|
from: srcFile,
|
|
1742
1752
|
to: distFile,
|
|
@@ -1744,13 +1754,13 @@ function copyFolder({ from, to, version, packageName, isMergePackageJson, skipFi
|
|
|
1744
1754
|
skipFiles
|
|
1745
1755
|
});
|
|
1746
1756
|
else if ('package.json' === file) {
|
|
1747
|
-
const targetPackage =
|
|
1748
|
-
if (isMergePackageJson &&
|
|
1757
|
+
const targetPackage = node_path.resolve(to, 'package.json');
|
|
1758
|
+
if (isMergePackageJson && node_fs.existsSync(targetPackage)) mergePackageJson(targetPackage, srcFile);
|
|
1749
1759
|
else {
|
|
1750
|
-
|
|
1760
|
+
node_fs.copyFileSync(srcFile, distFile);
|
|
1751
1761
|
updatePackageJson(distFile, version, packageName);
|
|
1752
1762
|
}
|
|
1753
|
-
} else
|
|
1763
|
+
} else node_fs.copyFileSync(srcFile, distFile);
|
|
1754
1764
|
}
|
|
1755
1765
|
}
|
|
1756
1766
|
const isStableVersion = (version)=>[
|
|
@@ -1761,7 +1771,7 @@ const isStableVersion = (version)=>[
|
|
|
1761
1771
|
'nightly'
|
|
1762
1772
|
].every((tag)=>!version.includes(tag));
|
|
1763
1773
|
const updatePackageJson = (pkgJsonPath, version, name)=>{
|
|
1764
|
-
let content =
|
|
1774
|
+
let content = node_fs.readFileSync(pkgJsonPath, 'utf-8');
|
|
1765
1775
|
if ('string' == typeof version) {
|
|
1766
1776
|
const targetVersion = isStableVersion(version) ? `^${version}` : version;
|
|
1767
1777
|
content = content.replace(/workspace:\*/g, targetVersion);
|
|
@@ -1772,6 +1782,6 @@ const updatePackageJson = (pkgJsonPath, version, name)=>{
|
|
|
1772
1782
|
if (pkg.devDependencies?.[name]) pkg.devDependencies[name] = ver;
|
|
1773
1783
|
}
|
|
1774
1784
|
if (name && '.' !== name) pkg.name = name;
|
|
1775
|
-
|
|
1785
|
+
node_fs.writeFileSync(pkgJsonPath, `${JSON.stringify(pkg, null, 2)}\n`);
|
|
1776
1786
|
};
|
|
1777
1787
|
export { checkCancel, copyFolder, create, mergePackageJson, fe as multiselect, ve as select, he as text };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-rstack",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Create a new Rstack project",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"lint": "biome check .",
|
|
29
29
|
"lint:write": "biome check . --write",
|
|
30
30
|
"prepare": "simple-git-hooks && npm run build",
|
|
31
|
-
"test": "
|
|
31
|
+
"test": "rstest run",
|
|
32
32
|
"bump": "npx bumpp"
|
|
33
33
|
},
|
|
34
34
|
"simple-git-hooks": {
|
|
@@ -40,20 +40,21 @@
|
|
|
40
40
|
]
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@biomejs/biome": "^
|
|
44
|
-
"@clack/prompts": "^0.
|
|
45
|
-
"@microsoft/api-extractor": "^7.52.
|
|
46
|
-
"@rslib/core": "0.
|
|
43
|
+
"@biomejs/biome": "^2.0.0",
|
|
44
|
+
"@clack/prompts": "^0.11.0",
|
|
45
|
+
"@microsoft/api-extractor": "^7.52.8",
|
|
46
|
+
"@rslib/core": "0.10.1",
|
|
47
|
+
"@rstest/core": "0.0.1",
|
|
47
48
|
"@types/minimist": "^1.2.5",
|
|
48
|
-
"@types/node": "22.15.
|
|
49
|
+
"@types/node": "22.15.32",
|
|
49
50
|
"deepmerge": "^4.3.1",
|
|
50
51
|
"minimist": "^1.2.8",
|
|
51
52
|
"picocolors": "^1.1.1",
|
|
52
|
-
"rslog": "^1.2.
|
|
53
|
+
"rslog": "^1.2.7",
|
|
53
54
|
"simple-git-hooks": "^2.13.0",
|
|
54
55
|
"typescript": "^5.8.3"
|
|
55
56
|
},
|
|
56
|
-
"packageManager": "pnpm@10.
|
|
57
|
+
"packageManager": "pnpm@10.12.1",
|
|
57
58
|
"publishConfig": {
|
|
58
59
|
"access": "public",
|
|
59
60
|
"provenance": true,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { fixupConfigRules } from '@eslint/compat';
|
|
2
2
|
import js from '@eslint/js';
|
|
3
|
-
import reactHooks from 'eslint-plugin-react-hooks';
|
|
4
3
|
import reactJsx from 'eslint-plugin-react/configs/jsx-runtime.js';
|
|
5
4
|
import react from 'eslint-plugin-react/configs/recommended.js';
|
|
5
|
+
import reactHooks from 'eslint-plugin-react-hooks';
|
|
6
6
|
import globals from 'globals';
|
|
7
7
|
|
|
8
8
|
export default [
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
"lint": "eslint ."
|
|
7
7
|
},
|
|
8
8
|
"devDependencies": {
|
|
9
|
-
"@eslint/compat": "^1.
|
|
10
|
-
"@eslint/js": "^9.
|
|
11
|
-
"eslint": "^9.
|
|
9
|
+
"@eslint/compat": "^1.3.0",
|
|
10
|
+
"@eslint/js": "^9.29.0",
|
|
11
|
+
"eslint": "^9.29.0",
|
|
12
12
|
"eslint-plugin-react": "^7.37.5",
|
|
13
13
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
14
|
-
"globals": "^16.
|
|
14
|
+
"globals": "^16.2.0"
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { fixupConfigRules } from '@eslint/compat';
|
|
2
2
|
import js from '@eslint/js';
|
|
3
|
-
import reactHooks from 'eslint-plugin-react-hooks';
|
|
4
3
|
import reactJsx from 'eslint-plugin-react/configs/jsx-runtime.js';
|
|
5
4
|
import react from 'eslint-plugin-react/configs/recommended.js';
|
|
5
|
+
import reactHooks from 'eslint-plugin-react-hooks';
|
|
6
6
|
import globals from 'globals';
|
|
7
7
|
import ts from 'typescript-eslint';
|
|
8
8
|
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"lint": "eslint ."
|
|
7
7
|
},
|
|
8
8
|
"devDependencies": {
|
|
9
|
-
"@eslint/compat": "^1.
|
|
10
|
-
"@eslint/js": "^9.
|
|
11
|
-
"eslint": "^9.
|
|
9
|
+
"@eslint/compat": "^1.3.0",
|
|
10
|
+
"@eslint/js": "^9.29.0",
|
|
11
|
+
"eslint": "^9.29.0",
|
|
12
12
|
"eslint-plugin-react": "^7.37.5",
|
|
13
13
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
14
|
-
"globals": "^16.
|
|
15
|
-
"typescript-eslint": "^8.
|
|
14
|
+
"globals": "^16.2.0",
|
|
15
|
+
"typescript-eslint": "^8.34.1"
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
"lint": "eslint ."
|
|
7
7
|
},
|
|
8
8
|
"devDependencies": {
|
|
9
|
-
"@eslint/js": "^9.
|
|
10
|
-
"eslint": "^9.
|
|
11
|
-
"eslint-plugin-svelte": "^3.
|
|
12
|
-
"globals": "^16.
|
|
9
|
+
"@eslint/js": "^9.29.0",
|
|
10
|
+
"eslint": "^9.29.0",
|
|
11
|
+
"eslint-plugin-svelte": "^3.9.2",
|
|
12
|
+
"globals": "^16.2.0"
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
"lint": "eslint ."
|
|
7
7
|
},
|
|
8
8
|
"devDependencies": {
|
|
9
|
-
"@eslint/js": "^9.
|
|
10
|
-
"eslint": "^9.
|
|
11
|
-
"eslint-plugin-svelte": "^3.
|
|
12
|
-
"globals": "^16.
|
|
13
|
-
"typescript-eslint": "^8.
|
|
9
|
+
"@eslint/js": "^9.29.0",
|
|
10
|
+
"eslint": "^9.29.0",
|
|
11
|
+
"eslint-plugin-svelte": "^3.9.2",
|
|
12
|
+
"globals": "^16.2.0",
|
|
13
|
+
"typescript-eslint": "^8.34.1"
|
|
14
14
|
},
|
|
15
15
|
"type": "module"
|
|
16
16
|
}
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
"lint": "eslint ."
|
|
7
7
|
},
|
|
8
8
|
"devDependencies": {
|
|
9
|
-
"@eslint/js": "^9.
|
|
10
|
-
"eslint": "^9.
|
|
11
|
-
"globals": "^16.
|
|
12
|
-
"typescript-eslint": "^8.
|
|
9
|
+
"@eslint/js": "^9.29.0",
|
|
10
|
+
"eslint": "^9.29.0",
|
|
11
|
+
"globals": "^16.2.0",
|
|
12
|
+
"typescript-eslint": "^8.34.1"
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
"lint": "eslint ."
|
|
7
7
|
},
|
|
8
8
|
"devDependencies": {
|
|
9
|
-
"@eslint/js": "^9.
|
|
10
|
-
"eslint": "^9.
|
|
11
|
-
"eslint-plugin-vue": "^10.
|
|
12
|
-
"globals": "^16.
|
|
9
|
+
"@eslint/js": "^9.29.0",
|
|
10
|
+
"eslint": "^9.29.0",
|
|
11
|
+
"eslint-plugin-vue": "^10.2.0",
|
|
12
|
+
"globals": "^16.2.0"
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
defineConfigWithVueTs,
|
|
3
3
|
vueTsConfigs,
|
|
4
4
|
} from '@vue/eslint-config-typescript';
|
|
5
|
-
import pluginVue from 'eslint-plugin-vue';
|
|
6
5
|
import { globalIgnores } from 'eslint/config';
|
|
6
|
+
import pluginVue from 'eslint-plugin-vue';
|
|
7
7
|
import globals from 'globals';
|
|
8
8
|
|
|
9
9
|
// To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
"lint": "eslint ."
|
|
7
7
|
},
|
|
8
8
|
"devDependencies": {
|
|
9
|
-
"@vue/eslint-config-typescript": "^14.5.
|
|
10
|
-
"eslint": "^9.
|
|
11
|
-
"eslint-plugin-vue": "^10.
|
|
12
|
-
"globals": "^16.
|
|
13
|
-
"typescript-eslint": "^8.
|
|
9
|
+
"@vue/eslint-config-typescript": "^14.5.1",
|
|
10
|
+
"eslint": "^9.29.0",
|
|
11
|
+
"eslint-plugin-vue": "^10.2.0",
|
|
12
|
+
"globals": "^16.2.0",
|
|
13
|
+
"typescript-eslint": "^8.34.1"
|
|
14
14
|
}
|
|
15
15
|
}
|