create-vuetify 2.4.0 → 2.5.2
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/README.md +10 -3
- package/dist/index.mjs +683 -86
- package/package.json +4 -3
- package/template/javascript/base/eslint.config.js +3 -1
- package/template/javascript/base/package.json +1 -1
- package/template/javascript/base/src/router/index.js +3 -3
- package/template/javascript/base/vite.config.mjs +11 -8
- package/template/javascript/default/package.json +2 -2
- package/template/javascript/default/src/main.js +3 -0
- package/template/javascript/default/vite.config.mjs +12 -9
- package/template/javascript/essentials/src/router/index.js +3 -3
- package/template/javascript/essentials/vite.config.mjs +2 -2
- package/template/typescript/base/eslint.config.js +3 -1
- package/template/typescript/base/package.json +1 -1
- package/template/typescript/base/src/router/index.ts +3 -3
- package/template/typescript/base/vite.config.mts +17 -10
- package/template/typescript/default/package.json +1 -1
- package/template/typescript/default/src/main.ts +3 -0
- package/template/typescript/default/vite.config.mts +11 -8
- package/template/typescript/essentials/src/router/index.ts +3 -3
- package/template/typescript/essentials/vite.config.mts +10 -7
- package/template/typescript/nuxt/modules/vuetify.ts +21 -25
- package/template/typescript/nuxt/plugins/vuetify.ts +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
import { dirname as dirname3, join as join3, resolve as
|
|
3
|
-
import { fileURLToPath } from "url";
|
|
4
|
-
import { mkdirSync as mkdirSync2, rmSync, writeFileSync as writeFileSync2 } from "fs";
|
|
2
|
+
import { dirname as dirname3, join as join3, resolve as resolve5 } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { mkdirSync as mkdirSync2, rmSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
5
5
|
|
|
6
6
|
// src/utils/prompts.ts
|
|
7
|
-
import { join as join2, resolve as
|
|
8
|
-
import { existsSync as existsSync2, readdirSync } from "fs";
|
|
7
|
+
import { join as join2, resolve as resolve3 } from "node:path";
|
|
8
|
+
import { existsSync as existsSync2, readdirSync } from "node:fs";
|
|
9
9
|
|
|
10
10
|
// src/utils/presets.ts
|
|
11
11
|
var defaultContext = {
|
|
@@ -927,22 +927,594 @@ async function installDependencies(options = {}) {
|
|
|
927
927
|
});
|
|
928
928
|
}
|
|
929
929
|
|
|
930
|
-
//
|
|
931
|
-
import {
|
|
932
|
-
|
|
933
|
-
|
|
930
|
+
// node_modules/.pnpm/tinyexec@1.0.1/node_modules/tinyexec/dist/main.js
|
|
931
|
+
import { createRequire as __tinyexec_cr2 } from "node:module";
|
|
932
|
+
import { spawn as de2 } from "child_process";
|
|
933
|
+
import { normalize as fe2 } from "path";
|
|
934
|
+
import { cwd as he2 } from "process";
|
|
935
|
+
import {
|
|
936
|
+
delimiter as N2,
|
|
937
|
+
resolve as qt2,
|
|
938
|
+
dirname as It2
|
|
939
|
+
} from "path";
|
|
940
|
+
import { PassThrough as zt2 } from "stream";
|
|
941
|
+
import me2 from "readline";
|
|
942
|
+
var require3 = __tinyexec_cr2(import.meta.url);
|
|
943
|
+
var St2 = Object.create;
|
|
944
|
+
var $2 = Object.defineProperty;
|
|
945
|
+
var kt2 = Object.getOwnPropertyDescriptor;
|
|
946
|
+
var Tt2 = Object.getOwnPropertyNames;
|
|
947
|
+
var At2 = Object.getPrototypeOf;
|
|
948
|
+
var Rt2 = Object.prototype.hasOwnProperty;
|
|
949
|
+
var h2 = /* @__PURE__ */ ((t) => typeof require3 < "u" ? require3 : typeof Proxy < "u" ? new Proxy(t, {
|
|
950
|
+
get: (e, n) => (typeof require3 < "u" ? require3 : e)[n]
|
|
951
|
+
}) : t)(function(t) {
|
|
952
|
+
if (typeof require3 < "u") return require3.apply(this, arguments);
|
|
953
|
+
throw Error('Dynamic require of "' + t + '" is not supported');
|
|
954
|
+
});
|
|
955
|
+
var l2 = (t, e) => () => (e || t((e = { exports: {} }).exports, e), e.exports);
|
|
956
|
+
var $t2 = (t, e, n, r) => {
|
|
957
|
+
if (e && typeof e == "object" || typeof e == "function")
|
|
958
|
+
for (let s of Tt2(e))
|
|
959
|
+
!Rt2.call(t, s) && s !== n && $2(t, s, { get: () => e[s], enumerable: !(r = kt2(e, s)) || r.enumerable });
|
|
960
|
+
return t;
|
|
961
|
+
};
|
|
962
|
+
var Nt2 = (t, e, n) => (n = t != null ? St2(At2(t)) : {}, $t2(
|
|
963
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
964
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
965
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
966
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
967
|
+
e || !t || !t.__esModule ? $2(n, "default", { value: t, enumerable: true }) : n,
|
|
968
|
+
t
|
|
969
|
+
));
|
|
970
|
+
var W2 = l2((Se, H) => {
|
|
971
|
+
"use strict";
|
|
972
|
+
H.exports = z;
|
|
973
|
+
z.sync = Wt;
|
|
974
|
+
var j = h2("fs");
|
|
975
|
+
function Ht(t, e) {
|
|
976
|
+
var n = e.pathExt !== void 0 ? e.pathExt : process.env.PATHEXT;
|
|
977
|
+
if (!n || (n = n.split(";"), n.indexOf("") !== -1))
|
|
978
|
+
return true;
|
|
979
|
+
for (var r = 0; r < n.length; r++) {
|
|
980
|
+
var s = n[r].toLowerCase();
|
|
981
|
+
if (s && t.substr(-s.length).toLowerCase() === s)
|
|
982
|
+
return true;
|
|
983
|
+
}
|
|
984
|
+
return false;
|
|
985
|
+
}
|
|
986
|
+
function F(t, e, n) {
|
|
987
|
+
return !t.isSymbolicLink() && !t.isFile() ? false : Ht(e, n);
|
|
988
|
+
}
|
|
989
|
+
function z(t, e, n) {
|
|
990
|
+
j.stat(t, function(r, s) {
|
|
991
|
+
n(r, r ? false : F(s, t, e));
|
|
992
|
+
});
|
|
993
|
+
}
|
|
994
|
+
function Wt(t, e) {
|
|
995
|
+
return F(j.statSync(t), t, e);
|
|
996
|
+
}
|
|
997
|
+
});
|
|
998
|
+
var X2 = l2((ke, B) => {
|
|
999
|
+
"use strict";
|
|
1000
|
+
B.exports = K;
|
|
1001
|
+
K.sync = Dt;
|
|
1002
|
+
var D = h2("fs");
|
|
1003
|
+
function K(t, e, n) {
|
|
1004
|
+
D.stat(t, function(r, s) {
|
|
1005
|
+
n(r, r ? false : M(s, e));
|
|
1006
|
+
});
|
|
1007
|
+
}
|
|
1008
|
+
function Dt(t, e) {
|
|
1009
|
+
return M(D.statSync(t), e);
|
|
1010
|
+
}
|
|
1011
|
+
function M(t, e) {
|
|
1012
|
+
return t.isFile() && Kt(t, e);
|
|
1013
|
+
}
|
|
1014
|
+
function Kt(t, e) {
|
|
1015
|
+
var n = t.mode, r = t.uid, s = t.gid, o = e.uid !== void 0 ? e.uid : process.getuid && process.getuid(), i = e.gid !== void 0 ? e.gid : process.getgid && process.getgid(), a = parseInt("100", 8), c = parseInt("010", 8), u = parseInt("001", 8), f = a | c, p = n & u || n & c && s === i || n & a && r === o || n & f && o === 0;
|
|
1016
|
+
return p;
|
|
1017
|
+
}
|
|
1018
|
+
});
|
|
1019
|
+
var U2 = l2((Ae, G) => {
|
|
1020
|
+
"use strict";
|
|
1021
|
+
var Te = h2("fs"), v;
|
|
1022
|
+
process.platform === "win32" || global.TESTING_WINDOWS ? v = W2() : v = X2();
|
|
1023
|
+
G.exports = y;
|
|
1024
|
+
y.sync = Mt;
|
|
1025
|
+
function y(t, e, n) {
|
|
1026
|
+
if (typeof e == "function" && (n = e, e = {}), !n) {
|
|
1027
|
+
if (typeof Promise != "function")
|
|
1028
|
+
throw new TypeError("callback not provided");
|
|
1029
|
+
return new Promise(function(r, s) {
|
|
1030
|
+
y(t, e || {}, function(o, i) {
|
|
1031
|
+
o ? s(o) : r(i);
|
|
1032
|
+
});
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1035
|
+
v(t, e || {}, function(r, s) {
|
|
1036
|
+
r && (r.code === "EACCES" || e && e.ignoreErrors) && (r = null, s = false), n(r, s);
|
|
1037
|
+
});
|
|
1038
|
+
}
|
|
1039
|
+
function Mt(t, e) {
|
|
1040
|
+
try {
|
|
1041
|
+
return v.sync(t, e || {});
|
|
1042
|
+
} catch (n) {
|
|
1043
|
+
if (e && e.ignoreErrors || n.code === "EACCES")
|
|
1044
|
+
return false;
|
|
1045
|
+
throw n;
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
});
|
|
1049
|
+
var et2 = l2((Re, tt) => {
|
|
1050
|
+
"use strict";
|
|
1051
|
+
var g = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys", Y = h2("path"), Bt = g ? ";" : ":", V = U2(), J = (t) => Object.assign(new Error(`not found: ${t}`), { code: "ENOENT" }), Q = (t, e) => {
|
|
1052
|
+
let n = e.colon || Bt, r = t.match(/\//) || g && t.match(/\\/) ? [""] : [
|
|
1053
|
+
// windows always checks the cwd first
|
|
1054
|
+
...g ? [process.cwd()] : [],
|
|
1055
|
+
...(e.path || process.env.PATH || /* istanbul ignore next: very unusual */
|
|
1056
|
+
"").split(n)
|
|
1057
|
+
], s = g ? e.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "", o = g ? s.split(n) : [""];
|
|
1058
|
+
return g && t.indexOf(".") !== -1 && o[0] !== "" && o.unshift(""), {
|
|
1059
|
+
pathEnv: r,
|
|
1060
|
+
pathExt: o,
|
|
1061
|
+
pathExtExe: s
|
|
1062
|
+
};
|
|
1063
|
+
}, Z = (t, e, n) => {
|
|
1064
|
+
typeof e == "function" && (n = e, e = {}), e || (e = {});
|
|
1065
|
+
let { pathEnv: r, pathExt: s, pathExtExe: o } = Q(t, e), i = [], a = (u) => new Promise((f, p) => {
|
|
1066
|
+
if (u === r.length)
|
|
1067
|
+
return e.all && i.length ? f(i) : p(J(t));
|
|
1068
|
+
let d = r[u], w = /^".*"$/.test(d) ? d.slice(1, -1) : d, m = Y.join(w, t), b = !w && /^\.[\\\/]/.test(t) ? t.slice(0, 2) + m : m;
|
|
1069
|
+
f(c(b, u, 0));
|
|
1070
|
+
}), c = (u, f, p) => new Promise((d, w) => {
|
|
1071
|
+
if (p === s.length)
|
|
1072
|
+
return d(a(f + 1));
|
|
1073
|
+
let m = s[p];
|
|
1074
|
+
V(u + m, { pathExt: o }, (b, Ot) => {
|
|
1075
|
+
if (!b && Ot)
|
|
1076
|
+
if (e.all)
|
|
1077
|
+
i.push(u + m);
|
|
1078
|
+
else
|
|
1079
|
+
return d(u + m);
|
|
1080
|
+
return d(c(u, f, p + 1));
|
|
1081
|
+
});
|
|
1082
|
+
});
|
|
1083
|
+
return n ? a(0).then((u) => n(null, u), n) : a(0);
|
|
1084
|
+
}, Xt = (t, e) => {
|
|
1085
|
+
e = e || {};
|
|
1086
|
+
let { pathEnv: n, pathExt: r, pathExtExe: s } = Q(t, e), o = [];
|
|
1087
|
+
for (let i = 0; i < n.length; i++) {
|
|
1088
|
+
let a = n[i], c = /^".*"$/.test(a) ? a.slice(1, -1) : a, u = Y.join(c, t), f = !c && /^\.[\\\/]/.test(t) ? t.slice(0, 2) + u : u;
|
|
1089
|
+
for (let p = 0; p < r.length; p++) {
|
|
1090
|
+
let d = f + r[p];
|
|
1091
|
+
try {
|
|
1092
|
+
if (V.sync(d, { pathExt: s }))
|
|
1093
|
+
if (e.all)
|
|
1094
|
+
o.push(d);
|
|
1095
|
+
else
|
|
1096
|
+
return d;
|
|
1097
|
+
} catch {
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
if (e.all && o.length)
|
|
1102
|
+
return o;
|
|
1103
|
+
if (e.nothrow)
|
|
1104
|
+
return null;
|
|
1105
|
+
throw J(t);
|
|
1106
|
+
};
|
|
1107
|
+
tt.exports = Z;
|
|
1108
|
+
Z.sync = Xt;
|
|
1109
|
+
});
|
|
1110
|
+
var rt2 = l2(($e, _) => {
|
|
1111
|
+
"use strict";
|
|
1112
|
+
var nt = (t = {}) => {
|
|
1113
|
+
let e = t.env || process.env;
|
|
1114
|
+
return (t.platform || process.platform) !== "win32" ? "PATH" : Object.keys(e).reverse().find((r) => r.toUpperCase() === "PATH") || "Path";
|
|
1115
|
+
};
|
|
1116
|
+
_.exports = nt;
|
|
1117
|
+
_.exports.default = nt;
|
|
1118
|
+
});
|
|
1119
|
+
var ct2 = l2((Ne, it) => {
|
|
1120
|
+
"use strict";
|
|
1121
|
+
var st = h2("path"), Gt = et2(), Ut = rt2();
|
|
1122
|
+
function ot(t, e) {
|
|
1123
|
+
let n = t.options.env || process.env, r = process.cwd(), s = t.options.cwd != null, o = s && process.chdir !== void 0 && !process.chdir.disabled;
|
|
1124
|
+
if (o)
|
|
1125
|
+
try {
|
|
1126
|
+
process.chdir(t.options.cwd);
|
|
1127
|
+
} catch {
|
|
1128
|
+
}
|
|
1129
|
+
let i;
|
|
1130
|
+
try {
|
|
1131
|
+
i = Gt.sync(t.command, {
|
|
1132
|
+
path: n[Ut({ env: n })],
|
|
1133
|
+
pathExt: e ? st.delimiter : void 0
|
|
1134
|
+
});
|
|
1135
|
+
} catch {
|
|
1136
|
+
} finally {
|
|
1137
|
+
o && process.chdir(r);
|
|
1138
|
+
}
|
|
1139
|
+
return i && (i = st.resolve(s ? t.options.cwd : "", i)), i;
|
|
1140
|
+
}
|
|
1141
|
+
function Yt(t) {
|
|
1142
|
+
return ot(t) || ot(t, true);
|
|
1143
|
+
}
|
|
1144
|
+
it.exports = Yt;
|
|
1145
|
+
});
|
|
1146
|
+
var ut2 = l2((qe, P) => {
|
|
1147
|
+
"use strict";
|
|
1148
|
+
var C = /([()\][%!^"`<>&|;, *?])/g;
|
|
1149
|
+
function Vt(t) {
|
|
1150
|
+
return t = t.replace(C, "^$1"), t;
|
|
1151
|
+
}
|
|
1152
|
+
function Jt(t, e) {
|
|
1153
|
+
return t = `${t}`, t = t.replace(/(\\*)"/g, '$1$1\\"'), t = t.replace(/(\\*)$/, "$1$1"), t = `"${t}"`, t = t.replace(C, "^$1"), e && (t = t.replace(C, "^$1")), t;
|
|
1154
|
+
}
|
|
1155
|
+
P.exports.command = Vt;
|
|
1156
|
+
P.exports.argument = Jt;
|
|
1157
|
+
});
|
|
1158
|
+
var lt2 = l2((Ie, at) => {
|
|
1159
|
+
"use strict";
|
|
1160
|
+
at.exports = /^#!(.*)/;
|
|
1161
|
+
});
|
|
1162
|
+
var dt2 = l2((Le, pt) => {
|
|
1163
|
+
"use strict";
|
|
1164
|
+
var Qt = lt2();
|
|
1165
|
+
pt.exports = (t = "") => {
|
|
1166
|
+
let e = t.match(Qt);
|
|
1167
|
+
if (!e)
|
|
1168
|
+
return null;
|
|
1169
|
+
let [n, r] = e[0].replace(/#! ?/, "").split(" "), s = n.split("/").pop();
|
|
1170
|
+
return s === "env" ? r : r ? `${s} ${r}` : s;
|
|
1171
|
+
};
|
|
1172
|
+
});
|
|
1173
|
+
var ht2 = l2((je, ft) => {
|
|
1174
|
+
"use strict";
|
|
1175
|
+
var O = h2("fs"), Zt = dt2();
|
|
1176
|
+
function te(t) {
|
|
1177
|
+
let n = Buffer.alloc(150), r;
|
|
1178
|
+
try {
|
|
1179
|
+
r = O.openSync(t, "r"), O.readSync(r, n, 0, 150, 0), O.closeSync(r);
|
|
1180
|
+
} catch {
|
|
1181
|
+
}
|
|
1182
|
+
return Zt(n.toString());
|
|
1183
|
+
}
|
|
1184
|
+
ft.exports = te;
|
|
1185
|
+
});
|
|
1186
|
+
var wt2 = l2((Fe, Et) => {
|
|
1187
|
+
"use strict";
|
|
1188
|
+
var ee = h2("path"), mt = ct2(), gt = ut2(), ne = ht2(), re = process.platform === "win32", se = /\.(?:com|exe)$/i, oe = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
1189
|
+
function ie(t) {
|
|
1190
|
+
t.file = mt(t);
|
|
1191
|
+
let e = t.file && ne(t.file);
|
|
1192
|
+
return e ? (t.args.unshift(t.file), t.command = e, mt(t)) : t.file;
|
|
1193
|
+
}
|
|
1194
|
+
function ce(t) {
|
|
1195
|
+
if (!re)
|
|
1196
|
+
return t;
|
|
1197
|
+
let e = ie(t), n = !se.test(e);
|
|
1198
|
+
if (t.options.forceShell || n) {
|
|
1199
|
+
let r = oe.test(e);
|
|
1200
|
+
t.command = ee.normalize(t.command), t.command = gt.command(t.command), t.args = t.args.map((o) => gt.argument(o, r));
|
|
1201
|
+
let s = [t.command].concat(t.args).join(" ");
|
|
1202
|
+
t.args = ["/d", "/s", "/c", `"${s}"`], t.command = process.env.comspec || "cmd.exe", t.options.windowsVerbatimArguments = true;
|
|
1203
|
+
}
|
|
1204
|
+
return t;
|
|
1205
|
+
}
|
|
1206
|
+
function ue(t, e, n) {
|
|
1207
|
+
e && !Array.isArray(e) && (n = e, e = null), e = e ? e.slice(0) : [], n = Object.assign({}, n);
|
|
1208
|
+
let r = {
|
|
1209
|
+
command: t,
|
|
1210
|
+
args: e,
|
|
1211
|
+
options: n,
|
|
1212
|
+
file: void 0,
|
|
1213
|
+
original: {
|
|
1214
|
+
command: t,
|
|
1215
|
+
args: e
|
|
1216
|
+
}
|
|
1217
|
+
};
|
|
1218
|
+
return n.shell ? r : ce(r);
|
|
1219
|
+
}
|
|
1220
|
+
Et.exports = ue;
|
|
1221
|
+
});
|
|
1222
|
+
var bt2 = l2((ze, vt) => {
|
|
1223
|
+
"use strict";
|
|
1224
|
+
var S = process.platform === "win32";
|
|
1225
|
+
function k(t, e) {
|
|
1226
|
+
return Object.assign(new Error(`${e} ${t.command} ENOENT`), {
|
|
1227
|
+
code: "ENOENT",
|
|
1228
|
+
errno: "ENOENT",
|
|
1229
|
+
syscall: `${e} ${t.command}`,
|
|
1230
|
+
path: t.command,
|
|
1231
|
+
spawnargs: t.args
|
|
1232
|
+
});
|
|
1233
|
+
}
|
|
1234
|
+
function ae(t, e) {
|
|
1235
|
+
if (!S)
|
|
1236
|
+
return;
|
|
1237
|
+
let n = t.emit;
|
|
1238
|
+
t.emit = function(r, s) {
|
|
1239
|
+
if (r === "exit") {
|
|
1240
|
+
let o = xt(s, e, "spawn");
|
|
1241
|
+
if (o)
|
|
1242
|
+
return n.call(t, "error", o);
|
|
1243
|
+
}
|
|
1244
|
+
return n.apply(t, arguments);
|
|
1245
|
+
};
|
|
1246
|
+
}
|
|
1247
|
+
function xt(t, e) {
|
|
1248
|
+
return S && t === 1 && !e.file ? k(e.original, "spawn") : null;
|
|
1249
|
+
}
|
|
1250
|
+
function le(t, e) {
|
|
1251
|
+
return S && t === 1 && !e.file ? k(e.original, "spawnSync") : null;
|
|
1252
|
+
}
|
|
1253
|
+
vt.exports = {
|
|
1254
|
+
hookChildProcess: ae,
|
|
1255
|
+
verifyENOENT: xt,
|
|
1256
|
+
verifyENOENTSync: le,
|
|
1257
|
+
notFoundError: k
|
|
1258
|
+
};
|
|
1259
|
+
});
|
|
1260
|
+
var Ct2 = l2((He, E) => {
|
|
1261
|
+
"use strict";
|
|
1262
|
+
var yt = h2("child_process"), T = wt2(), A = bt2();
|
|
1263
|
+
function _t(t, e, n) {
|
|
1264
|
+
let r = T(t, e, n), s = yt.spawn(r.command, r.args, r.options);
|
|
1265
|
+
return A.hookChildProcess(s, r), s;
|
|
1266
|
+
}
|
|
1267
|
+
function pe(t, e, n) {
|
|
1268
|
+
let r = T(t, e, n), s = yt.spawnSync(r.command, r.args, r.options);
|
|
1269
|
+
return s.error = s.error || A.verifyENOENTSync(s.status, r), s;
|
|
1270
|
+
}
|
|
1271
|
+
E.exports = _t;
|
|
1272
|
+
E.exports.spawn = _t;
|
|
1273
|
+
E.exports.sync = pe;
|
|
1274
|
+
E.exports._parse = T;
|
|
1275
|
+
E.exports._enoent = A;
|
|
1276
|
+
});
|
|
1277
|
+
var Lt2 = /^path$/i;
|
|
1278
|
+
var q2 = { key: "PATH", value: "" };
|
|
1279
|
+
function jt2(t) {
|
|
1280
|
+
for (let e in t) {
|
|
1281
|
+
if (!Object.prototype.hasOwnProperty.call(t, e) || !Lt2.test(e))
|
|
1282
|
+
continue;
|
|
1283
|
+
let n = t[e];
|
|
1284
|
+
return n ? { key: e, value: n } : q2;
|
|
1285
|
+
}
|
|
1286
|
+
return q2;
|
|
1287
|
+
}
|
|
1288
|
+
function Ft2(t, e) {
|
|
1289
|
+
let n = e.value.split(N2), r = t, s;
|
|
1290
|
+
do
|
|
1291
|
+
n.push(qt2(r, "node_modules", ".bin")), s = r, r = It2(r);
|
|
1292
|
+
while (r !== s);
|
|
1293
|
+
return { key: e.key, value: n.join(N2) };
|
|
1294
|
+
}
|
|
1295
|
+
function I2(t, e) {
|
|
1296
|
+
let n = {
|
|
1297
|
+
...process.env,
|
|
1298
|
+
...e
|
|
1299
|
+
}, r = Ft2(t, jt2(n));
|
|
1300
|
+
return n[r.key] = r.value, n;
|
|
1301
|
+
}
|
|
1302
|
+
var L2 = (t) => {
|
|
1303
|
+
let e = t.length, n = new zt2(), r = () => {
|
|
1304
|
+
--e === 0 && n.emit("end");
|
|
1305
|
+
};
|
|
1306
|
+
for (let s of t)
|
|
1307
|
+
s.pipe(n, { end: false }), s.on("end", r);
|
|
1308
|
+
return n;
|
|
1309
|
+
};
|
|
1310
|
+
var Pt2 = Nt2(Ct2(), 1);
|
|
1311
|
+
var x2 = class extends Error {
|
|
1312
|
+
result;
|
|
1313
|
+
output;
|
|
1314
|
+
get exitCode() {
|
|
1315
|
+
if (this.result.exitCode !== null)
|
|
1316
|
+
return this.result.exitCode;
|
|
1317
|
+
}
|
|
1318
|
+
constructor(e, n) {
|
|
1319
|
+
super(`Process exited with non-zero status (${e.exitCode})`), this.result = e, this.output = n;
|
|
1320
|
+
}
|
|
1321
|
+
};
|
|
1322
|
+
var ge2 = {
|
|
1323
|
+
timeout: void 0,
|
|
1324
|
+
persist: false
|
|
1325
|
+
};
|
|
1326
|
+
var Ee2 = {
|
|
1327
|
+
windowsHide: true
|
|
1328
|
+
};
|
|
1329
|
+
function we2(t, e) {
|
|
1330
|
+
return {
|
|
1331
|
+
command: fe2(t),
|
|
1332
|
+
args: e ?? []
|
|
1333
|
+
};
|
|
1334
|
+
}
|
|
1335
|
+
function xe2(t) {
|
|
1336
|
+
let e = new AbortController();
|
|
1337
|
+
for (let n of t) {
|
|
1338
|
+
if (n.aborted)
|
|
1339
|
+
return e.abort(), n;
|
|
1340
|
+
let r = () => {
|
|
1341
|
+
e.abort(n.reason);
|
|
1342
|
+
};
|
|
1343
|
+
n.addEventListener("abort", r, {
|
|
1344
|
+
signal: e.signal
|
|
1345
|
+
});
|
|
1346
|
+
}
|
|
1347
|
+
return e.signal;
|
|
1348
|
+
}
|
|
1349
|
+
var R2 = class {
|
|
1350
|
+
_process;
|
|
1351
|
+
_aborted = false;
|
|
1352
|
+
_options;
|
|
1353
|
+
_command;
|
|
1354
|
+
_args;
|
|
1355
|
+
_resolveClose;
|
|
1356
|
+
_processClosed;
|
|
1357
|
+
_thrownError;
|
|
1358
|
+
get process() {
|
|
1359
|
+
return this._process;
|
|
1360
|
+
}
|
|
1361
|
+
get pid() {
|
|
1362
|
+
return this._process?.pid;
|
|
1363
|
+
}
|
|
1364
|
+
get exitCode() {
|
|
1365
|
+
if (this._process && this._process.exitCode !== null)
|
|
1366
|
+
return this._process.exitCode;
|
|
1367
|
+
}
|
|
1368
|
+
constructor(e, n, r) {
|
|
1369
|
+
this._options = {
|
|
1370
|
+
...ge2,
|
|
1371
|
+
...r
|
|
1372
|
+
}, this._command = e, this._args = n ?? [], this._processClosed = new Promise((s) => {
|
|
1373
|
+
this._resolveClose = s;
|
|
1374
|
+
});
|
|
1375
|
+
}
|
|
1376
|
+
kill(e) {
|
|
1377
|
+
return this._process?.kill(e) === true;
|
|
1378
|
+
}
|
|
1379
|
+
get aborted() {
|
|
1380
|
+
return this._aborted;
|
|
1381
|
+
}
|
|
1382
|
+
get killed() {
|
|
1383
|
+
return this._process?.killed === true;
|
|
1384
|
+
}
|
|
1385
|
+
pipe(e, n, r) {
|
|
1386
|
+
return be2(e, n, {
|
|
1387
|
+
...r,
|
|
1388
|
+
stdin: this
|
|
1389
|
+
});
|
|
1390
|
+
}
|
|
1391
|
+
async *[Symbol.asyncIterator]() {
|
|
1392
|
+
let e = this._process;
|
|
1393
|
+
if (!e)
|
|
1394
|
+
return;
|
|
1395
|
+
let n = [];
|
|
1396
|
+
this._streamErr && n.push(this._streamErr), this._streamOut && n.push(this._streamOut);
|
|
1397
|
+
let r = L2(n), s = me2.createInterface({
|
|
1398
|
+
input: r
|
|
1399
|
+
});
|
|
1400
|
+
for await (let o of s)
|
|
1401
|
+
yield o.toString();
|
|
1402
|
+
if (await this._processClosed, e.removeAllListeners(), this._thrownError)
|
|
1403
|
+
throw this._thrownError;
|
|
1404
|
+
if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0)
|
|
1405
|
+
throw new x2(this);
|
|
1406
|
+
}
|
|
1407
|
+
async _waitForOutput() {
|
|
1408
|
+
let e = this._process;
|
|
1409
|
+
if (!e)
|
|
1410
|
+
throw new Error("No process was started");
|
|
1411
|
+
let n = "", r = "";
|
|
1412
|
+
if (this._streamOut)
|
|
1413
|
+
for await (let o of this._streamOut)
|
|
1414
|
+
r += o.toString();
|
|
1415
|
+
if (this._streamErr)
|
|
1416
|
+
for await (let o of this._streamErr)
|
|
1417
|
+
n += o.toString();
|
|
1418
|
+
if (await this._processClosed, this._options?.stdin && await this._options.stdin, e.removeAllListeners(), this._thrownError)
|
|
1419
|
+
throw this._thrownError;
|
|
1420
|
+
let s = {
|
|
1421
|
+
stderr: n,
|
|
1422
|
+
stdout: r,
|
|
1423
|
+
exitCode: this.exitCode
|
|
1424
|
+
};
|
|
1425
|
+
if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0)
|
|
1426
|
+
throw new x2(this, s);
|
|
1427
|
+
return s;
|
|
1428
|
+
}
|
|
1429
|
+
then(e, n) {
|
|
1430
|
+
return this._waitForOutput().then(e, n);
|
|
1431
|
+
}
|
|
1432
|
+
_streamOut;
|
|
1433
|
+
_streamErr;
|
|
1434
|
+
spawn() {
|
|
1435
|
+
let e = he2(), n = this._options, r = {
|
|
1436
|
+
...Ee2,
|
|
1437
|
+
...n.nodeOptions
|
|
1438
|
+
}, s = [];
|
|
1439
|
+
this._resetState(), n.timeout !== void 0 && s.push(AbortSignal.timeout(n.timeout)), n.signal !== void 0 && s.push(n.signal), n.persist === true && (r.detached = true), s.length > 0 && (r.signal = xe2(s)), r.env = I2(e, r.env);
|
|
1440
|
+
let { command: o, args: i } = we2(this._command, this._args), a = (0, Pt2._parse)(o, i, r), c = de2(
|
|
1441
|
+
a.command,
|
|
1442
|
+
a.args,
|
|
1443
|
+
a.options
|
|
1444
|
+
);
|
|
1445
|
+
if (c.stderr && (this._streamErr = c.stderr), c.stdout && (this._streamOut = c.stdout), this._process = c, c.once("error", this._onError), c.once("close", this._onClose), n.stdin !== void 0 && c.stdin && n.stdin.process) {
|
|
1446
|
+
let { stdout: u } = n.stdin.process;
|
|
1447
|
+
u && u.pipe(c.stdin);
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
_resetState() {
|
|
1451
|
+
this._aborted = false, this._processClosed = new Promise((e) => {
|
|
1452
|
+
this._resolveClose = e;
|
|
1453
|
+
}), this._thrownError = void 0;
|
|
1454
|
+
}
|
|
1455
|
+
_onError = (e) => {
|
|
1456
|
+
if (e.name === "AbortError" && (!(e.cause instanceof Error) || e.cause.name !== "TimeoutError")) {
|
|
1457
|
+
this._aborted = true;
|
|
1458
|
+
return;
|
|
1459
|
+
}
|
|
1460
|
+
this._thrownError = e;
|
|
1461
|
+
};
|
|
1462
|
+
_onClose = () => {
|
|
1463
|
+
this._resolveClose && this._resolveClose();
|
|
1464
|
+
};
|
|
1465
|
+
};
|
|
1466
|
+
var ve2 = (t, e, n) => {
|
|
1467
|
+
let r = new R2(t, e, n);
|
|
1468
|
+
return r.spawn(), r;
|
|
1469
|
+
};
|
|
1470
|
+
var be2 = ve2;
|
|
1471
|
+
|
|
1472
|
+
// src/utils/cli/postinstall/pnpm.ts
|
|
1473
|
+
async function pnpmIgnored(root) {
|
|
1474
|
+
const pnpmVersion = (await ve2(`pnpm`, ["-v"], { nodeOptions: { cwd: root } })).stdout.trim();
|
|
934
1475
|
const [major] = pnpmVersion.split(".").map(Number);
|
|
935
1476
|
if (major && major >= 10) {
|
|
936
|
-
const detect2 =
|
|
937
|
-
if (detect2.startsWith("Automatically ignored builds during installation:\n None"))
|
|
1477
|
+
const detect2 = (await ve2("pnpm", ["ignored-builds"], { nodeOptions: { cwd: root } })).stdout;
|
|
1478
|
+
if (detect2.startsWith("Automatically ignored builds during installation:\n None")) {
|
|
1479
|
+
return;
|
|
1480
|
+
}
|
|
938
1481
|
return detect2;
|
|
939
1482
|
}
|
|
940
1483
|
}
|
|
1484
|
+
async function pnpm(root) {
|
|
1485
|
+
const detect2 = await pnpmIgnored(root);
|
|
1486
|
+
if (detect2) {
|
|
1487
|
+
console.warn(detect2);
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
// src/utils/cli/preinstall/yarn.ts
|
|
1492
|
+
import { appendFileSync } from "node:fs";
|
|
1493
|
+
import { resolve as resolve2 } from "node:path";
|
|
1494
|
+
var templateToAppend = `
|
|
1495
|
+
packageExtensions:
|
|
1496
|
+
unplugin-vue-router@*:
|
|
1497
|
+
dependencies:
|
|
1498
|
+
"@vue/compiler-sfc": "*"
|
|
1499
|
+
`;
|
|
1500
|
+
async function yarnFile(root) {
|
|
1501
|
+
const pnpmVersion = (await ve2("yarn", ["-v"], { nodeOptions: { cwd: root } })).stdout.trim();
|
|
1502
|
+
const [major] = pnpmVersion.split(".").map(Number);
|
|
1503
|
+
if (major && major >= 2) {
|
|
1504
|
+
appendFileSync(resolve2(root, ".yarnrc.yml"), templateToAppend);
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
async function yarn(root) {
|
|
1508
|
+
await yarnFile(root);
|
|
1509
|
+
}
|
|
941
1510
|
|
|
942
1511
|
// src/utils/installDependencies.ts
|
|
943
1512
|
var userAgent = process.env.npm_config_user_agent ?? "";
|
|
944
1513
|
var packageManager = /bun/.test(userAgent) ? "bun" : "pnpm";
|
|
945
1514
|
async function installDependencies2(root = process.cwd(), manager = packageManager) {
|
|
1515
|
+
if (manager === "yarn") {
|
|
1516
|
+
await yarn(root);
|
|
1517
|
+
}
|
|
946
1518
|
await installDependencies({
|
|
947
1519
|
packageManager: manager,
|
|
948
1520
|
cwd: root,
|
|
@@ -951,12 +1523,10 @@ async function installDependencies2(root = process.cwd(), manager = packageManag
|
|
|
951
1523
|
console.error(
|
|
952
1524
|
`Failed to install dependencies using ${manager}.`
|
|
953
1525
|
);
|
|
954
|
-
}).then(() => {
|
|
955
|
-
if (manager === "pnpm") {
|
|
956
|
-
const detect2 = pnpmIgnored(root);
|
|
957
|
-
if (detect2) console.warn(detect2);
|
|
958
|
-
}
|
|
959
1526
|
});
|
|
1527
|
+
if (manager === "pnpm") {
|
|
1528
|
+
await pnpm(root);
|
|
1529
|
+
}
|
|
960
1530
|
}
|
|
961
1531
|
|
|
962
1532
|
// src/utils/prompts.ts
|
|
@@ -967,14 +1537,13 @@ var promptOptions = {
|
|
|
967
1537
|
}
|
|
968
1538
|
};
|
|
969
1539
|
var initPrompts = async (context) => {
|
|
970
|
-
let answers;
|
|
971
1540
|
if (context.usePreset) {
|
|
972
1541
|
context = {
|
|
973
1542
|
...context,
|
|
974
1543
|
...presets[context.usePreset]
|
|
975
1544
|
};
|
|
976
1545
|
}
|
|
977
|
-
answers = await prompts([
|
|
1546
|
+
const answers = await prompts([
|
|
978
1547
|
{
|
|
979
1548
|
name: "projectName",
|
|
980
1549
|
type: "text",
|
|
@@ -1005,7 +1574,7 @@ var initPrompts = async (context) => {
|
|
|
1005
1574
|
process.exit(1);
|
|
1006
1575
|
}
|
|
1007
1576
|
},
|
|
1008
|
-
message: (prev) => `The project path: ${
|
|
1577
|
+
message: (prev) => `The project path: ${resolve3(context.cwd, prev)} already exists, would you like to overwrite this directory?`
|
|
1009
1578
|
},
|
|
1010
1579
|
{
|
|
1011
1580
|
name: "usePreset",
|
|
@@ -1118,15 +1687,15 @@ import { red as red2 } from "kolorist";
|
|
|
1118
1687
|
import minimist from "minimist";
|
|
1119
1688
|
|
|
1120
1689
|
// src/utils/renderTemplate.ts
|
|
1121
|
-
import { copyFileSync, mkdirSync, readdirSync as readdirSync2, readFileSync, statSync, writeFileSync } from "fs";
|
|
1122
|
-
import { basename as basename2, dirname as dirname2, resolve as
|
|
1690
|
+
import { copyFileSync, mkdirSync, readdirSync as readdirSync2, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
1691
|
+
import { basename as basename2, dirname as dirname2, resolve as resolve4 } from "node:path";
|
|
1123
1692
|
|
|
1124
1693
|
// src/utils/deepMerge.ts
|
|
1125
1694
|
var isObject = (v) => {
|
|
1126
1695
|
return v === Object(v) && v !== null && !Array.isArray(v);
|
|
1127
1696
|
};
|
|
1128
1697
|
var deepMerge = (...sources) => sources.reduce((acc, curr) => {
|
|
1129
|
-
Object.keys(curr)
|
|
1698
|
+
for (const key of Object.keys(curr)) {
|
|
1130
1699
|
if (Array.isArray(acc[key]) && Array.isArray(curr[key])) {
|
|
1131
1700
|
acc[key] = Array.from(new Set(acc[key].concat(curr[key])));
|
|
1132
1701
|
} else if (isObject(acc[key]) && isObject(curr[key])) {
|
|
@@ -1134,7 +1703,7 @@ var deepMerge = (...sources) => sources.reduce((acc, curr) => {
|
|
|
1134
1703
|
} else {
|
|
1135
1704
|
acc[key] = curr[key];
|
|
1136
1705
|
}
|
|
1137
|
-
}
|
|
1706
|
+
}
|
|
1138
1707
|
return acc;
|
|
1139
1708
|
}, {});
|
|
1140
1709
|
|
|
@@ -1144,20 +1713,27 @@ function mergePkg(source, destination) {
|
|
|
1144
1713
|
const src = JSON.parse(readFileSync(source, "utf8"));
|
|
1145
1714
|
const mergedPkg = deepMerge(target, src);
|
|
1146
1715
|
const keysToSort = ["devDependencies", "dependencies"];
|
|
1147
|
-
|
|
1716
|
+
for (const k of keysToSort) {
|
|
1148
1717
|
mergedPkg[k] = Object.keys(mergedPkg[k]).sort().reduce((a, c) => (a[c] = mergedPkg[k][c], a), {});
|
|
1149
|
-
}
|
|
1718
|
+
}
|
|
1150
1719
|
writeFileSync(destination, JSON.stringify(mergedPkg, null, 2) + "\n");
|
|
1151
1720
|
}
|
|
1152
1721
|
function renderDirectory(source, destination) {
|
|
1153
1722
|
mkdirSync(destination, { recursive: true });
|
|
1154
|
-
|
|
1723
|
+
for (const path4 of readdirSync2(source)) {
|
|
1724
|
+
renderTemplate(resolve4(source, path4), resolve4(destination, path4));
|
|
1725
|
+
}
|
|
1155
1726
|
}
|
|
1156
1727
|
function renderFile(source, destination) {
|
|
1157
1728
|
const filename = basename2(source);
|
|
1158
|
-
if (filename.startsWith("_"))
|
|
1159
|
-
|
|
1160
|
-
|
|
1729
|
+
if (filename.startsWith("_")) {
|
|
1730
|
+
destination = resolve4(dirname2(destination), filename.replace("_", "."));
|
|
1731
|
+
}
|
|
1732
|
+
if (filename === "package.json") {
|
|
1733
|
+
mergePkg(source, destination);
|
|
1734
|
+
} else {
|
|
1735
|
+
copyFileSync(source, destination);
|
|
1736
|
+
}
|
|
1161
1737
|
}
|
|
1162
1738
|
function renderTemplate(source, destination) {
|
|
1163
1739
|
if (statSync(source).isDirectory()) {
|
|
@@ -1168,17 +1744,17 @@ function renderTemplate(source, destination) {
|
|
|
1168
1744
|
}
|
|
1169
1745
|
|
|
1170
1746
|
// src/utils/nuxt/renderNuxtTemplate.ts
|
|
1171
|
-
import fs3 from "fs";
|
|
1172
|
-
import path3 from "path";
|
|
1173
|
-
import { spawnSync as spawnSync2 } from "child_process";
|
|
1747
|
+
import fs3 from "node:fs";
|
|
1748
|
+
import path3 from "node:path";
|
|
1749
|
+
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
1174
1750
|
|
|
1175
1751
|
// src/utils/nuxt/utils.ts
|
|
1176
|
-
import process2 from "process";
|
|
1177
|
-
import path from "path";
|
|
1178
|
-
import { spawnSync } from "child_process";
|
|
1179
|
-
import fs from "fs";
|
|
1752
|
+
import process2 from "node:process";
|
|
1753
|
+
import path from "node:path";
|
|
1754
|
+
import { spawnSync } from "node:child_process";
|
|
1755
|
+
import fs from "node:fs";
|
|
1180
1756
|
|
|
1181
|
-
// node_modules/.pnpm/package-manager-detector@1.
|
|
1757
|
+
// node_modules/.pnpm/package-manager-detector@1.2.0/node_modules/package-manager-detector/dist/commands.mjs
|
|
1182
1758
|
function npmRun(agent) {
|
|
1183
1759
|
return (args) => {
|
|
1184
1760
|
if (args.length > 1) {
|
|
@@ -1207,7 +1783,7 @@ var npm = {
|
|
|
1207
1783
|
"uninstall": ["npm", "uninstall", 0],
|
|
1208
1784
|
"global_uninstall": ["npm", "uninstall", "-g", 0]
|
|
1209
1785
|
};
|
|
1210
|
-
var
|
|
1786
|
+
var yarn2 = {
|
|
1211
1787
|
"agent": ["yarn", 0],
|
|
1212
1788
|
"run": ["yarn", "run", 0],
|
|
1213
1789
|
"install": ["yarn", "install", 0],
|
|
@@ -1222,7 +1798,7 @@ var yarn = {
|
|
|
1222
1798
|
"global_uninstall": ["yarn", "global", "remove", 0]
|
|
1223
1799
|
};
|
|
1224
1800
|
var yarnBerry = {
|
|
1225
|
-
...
|
|
1801
|
+
...yarn2,
|
|
1226
1802
|
"frozen": ["yarn", "install", "--immutable", 0],
|
|
1227
1803
|
"upgrade": ["yarn", "up", 0],
|
|
1228
1804
|
"upgrade-interactive": ["yarn", "up", "-i", 0],
|
|
@@ -1232,7 +1808,7 @@ var yarnBerry = {
|
|
|
1232
1808
|
"global": ["npm", "i", "-g", 0],
|
|
1233
1809
|
"global_uninstall": ["npm", "uninstall", "-g", 0]
|
|
1234
1810
|
};
|
|
1235
|
-
var
|
|
1811
|
+
var pnpm2 = {
|
|
1236
1812
|
"agent": ["pnpm", 0],
|
|
1237
1813
|
"run": ["pnpm", "run", 0],
|
|
1238
1814
|
"install": ["pnpm", "i", 0],
|
|
@@ -1276,12 +1852,12 @@ var deno = {
|
|
|
1276
1852
|
};
|
|
1277
1853
|
var COMMANDS = {
|
|
1278
1854
|
"npm": npm,
|
|
1279
|
-
"yarn":
|
|
1855
|
+
"yarn": yarn2,
|
|
1280
1856
|
"yarn@berry": yarnBerry,
|
|
1281
|
-
"pnpm":
|
|
1857
|
+
"pnpm": pnpm2,
|
|
1282
1858
|
// pnpm v6.x or below
|
|
1283
1859
|
"pnpm@6": {
|
|
1284
|
-
...
|
|
1860
|
+
...pnpm2,
|
|
1285
1861
|
run: npmRun("pnpm")
|
|
1286
1862
|
},
|
|
1287
1863
|
"bun": bun,
|
|
@@ -1308,8 +1884,9 @@ function constructCommand(value, args) {
|
|
|
1308
1884
|
// src/utils/nuxt/utils.ts
|
|
1309
1885
|
function detectPkgInfo() {
|
|
1310
1886
|
const userAgent2 = process2.env.npm_config_user_agent;
|
|
1311
|
-
if (!userAgent2)
|
|
1887
|
+
if (!userAgent2) {
|
|
1312
1888
|
return void 0;
|
|
1889
|
+
}
|
|
1313
1890
|
const pkgSpec = userAgent2.split(" ")[0];
|
|
1314
1891
|
const pkgSpecArr = pkgSpec.split("/");
|
|
1315
1892
|
return {
|
|
@@ -1320,18 +1897,19 @@ function detectPkgInfo() {
|
|
|
1320
1897
|
function addPackageObject(key, entry, pkg, sort = true) {
|
|
1321
1898
|
pkg[key] ??= {};
|
|
1322
1899
|
if (!sort) {
|
|
1323
|
-
for (const [name, value] of entry)
|
|
1900
|
+
for (const [name, value] of entry) {
|
|
1324
1901
|
pkg[key][name] = value;
|
|
1902
|
+
}
|
|
1325
1903
|
return;
|
|
1326
1904
|
}
|
|
1327
1905
|
const entries = Object.entries(pkg[key]);
|
|
1328
1906
|
pkg[key] = {};
|
|
1329
|
-
|
|
1907
|
+
for (const [name, value] of entry) {
|
|
1330
1908
|
entries.push([name, value]);
|
|
1331
|
-
}
|
|
1332
|
-
entries.sort(([a], [b]) => a.localeCompare(b))
|
|
1909
|
+
}
|
|
1910
|
+
for (const [k, v] of entries.sort(([a], [b]) => a.localeCompare(b))) {
|
|
1333
1911
|
pkg[key][k] = v;
|
|
1334
|
-
}
|
|
1912
|
+
}
|
|
1335
1913
|
}
|
|
1336
1914
|
function runCommand(pmDetection, command, args, cwd2) {
|
|
1337
1915
|
let runCommand2 = "npm";
|
|
@@ -1355,8 +1933,8 @@ function runCommand(pmDetection, command, args, cwd2) {
|
|
|
1355
1933
|
}
|
|
1356
1934
|
}
|
|
1357
1935
|
function editFile(file, callback, destination) {
|
|
1358
|
-
const content = fs.readFileSync(file, "
|
|
1359
|
-
fs.writeFileSync(destination ?? file, callback(content), "
|
|
1936
|
+
const content = fs.readFileSync(file, "utf8");
|
|
1937
|
+
fs.writeFileSync(destination ?? file, callback(content), "utf8");
|
|
1360
1938
|
}
|
|
1361
1939
|
function getPaths(rootPath, templateDir, v4) {
|
|
1362
1940
|
return v4 ? [path.join(rootPath, "app"), templateDir] : [rootPath, templateDir];
|
|
@@ -1376,7 +1954,7 @@ var versions = {
|
|
|
1376
1954
|
"@nuxt/fonts": "^0.11.1"
|
|
1377
1955
|
};
|
|
1378
1956
|
|
|
1379
|
-
// node_modules/.pnpm/package-manager-detector@1.
|
|
1957
|
+
// node_modules/.pnpm/package-manager-detector@1.2.0/node_modules/package-manager-detector/dist/constants.mjs
|
|
1380
1958
|
var AGENTS = [
|
|
1381
1959
|
"npm",
|
|
1382
1960
|
"yarn",
|
|
@@ -1391,6 +1969,7 @@ var LOCKS = {
|
|
|
1391
1969
|
"bun.lockb": "bun",
|
|
1392
1970
|
"deno.lock": "deno",
|
|
1393
1971
|
"pnpm-lock.yaml": "pnpm",
|
|
1972
|
+
"pnpm-workspace.yaml": "pnpm",
|
|
1394
1973
|
"yarn.lock": "yarn",
|
|
1395
1974
|
"package-lock.json": "npm",
|
|
1396
1975
|
"npm-shrinkwrap.json": "npm"
|
|
@@ -1411,13 +1990,13 @@ var INSTALL_METADATA = {
|
|
|
1411
1990
|
"bun.lockb": "bun"
|
|
1412
1991
|
};
|
|
1413
1992
|
|
|
1414
|
-
// node_modules/.pnpm/package-manager-detector@1.
|
|
1415
|
-
import fs2 from "node:fs";
|
|
1993
|
+
// node_modules/.pnpm/package-manager-detector@1.2.0/node_modules/package-manager-detector/dist/detect.mjs
|
|
1994
|
+
import fs2 from "node:fs/promises";
|
|
1416
1995
|
import path2 from "node:path";
|
|
1417
1996
|
import process3 from "node:process";
|
|
1418
|
-
function pathExists(path22, type) {
|
|
1997
|
+
async function pathExists(path22, type) {
|
|
1419
1998
|
try {
|
|
1420
|
-
const stat = fs2.
|
|
1999
|
+
const stat = await fs2.stat(path22);
|
|
1421
2000
|
return type === "file" ? stat.isFile() : stat.isDirectory();
|
|
1422
2001
|
} catch {
|
|
1423
2002
|
return false;
|
|
@@ -1435,7 +2014,7 @@ async function parsePackageJson(filepath, onUnknown) {
|
|
|
1435
2014
|
return !filepath || !pathExists(filepath, "file") ? null : await handlePackageManager(filepath, onUnknown);
|
|
1436
2015
|
}
|
|
1437
2016
|
async function detect(options = {}) {
|
|
1438
|
-
const { cwd: cwd2, strategies = ["lockfile", "packageManager-field"], onUnknown } = options;
|
|
2017
|
+
const { cwd: cwd2, strategies = ["lockfile", "packageManager-field", "devEngines-field"], onUnknown } = options;
|
|
1439
2018
|
for (const directory of lookup(cwd2)) {
|
|
1440
2019
|
for (const strategy of strategies) {
|
|
1441
2020
|
switch (strategy) {
|
|
@@ -1452,7 +2031,8 @@ async function detect(options = {}) {
|
|
|
1452
2031
|
}
|
|
1453
2032
|
break;
|
|
1454
2033
|
}
|
|
1455
|
-
case "packageManager-field":
|
|
2034
|
+
case "packageManager-field":
|
|
2035
|
+
case "devEngines-field": {
|
|
1456
2036
|
const result = await parsePackageJson(path2.join(directory, "package.json"), onUnknown);
|
|
1457
2037
|
if (result)
|
|
1458
2038
|
return result;
|
|
@@ -1474,18 +2054,34 @@ async function detect(options = {}) {
|
|
|
1474
2054
|
}
|
|
1475
2055
|
return null;
|
|
1476
2056
|
}
|
|
2057
|
+
function getNameAndVer(pkg) {
|
|
2058
|
+
const handelVer = (version) => version?.match(/\d+(\.\d+){0,2}/)?.[0] ?? version;
|
|
2059
|
+
if (typeof pkg.packageManager === "string") {
|
|
2060
|
+
const [name, ver] = pkg.packageManager.replace(/^\^/, "").split("@");
|
|
2061
|
+
return { name, ver: handelVer(ver) };
|
|
2062
|
+
}
|
|
2063
|
+
if (typeof pkg.devEngines?.packageManager?.name === "string") {
|
|
2064
|
+
return {
|
|
2065
|
+
name: pkg.devEngines.packageManager.name,
|
|
2066
|
+
ver: handelVer(pkg.devEngines.packageManager.version)
|
|
2067
|
+
};
|
|
2068
|
+
}
|
|
2069
|
+
return void 0;
|
|
2070
|
+
}
|
|
1477
2071
|
async function handlePackageManager(filepath, onUnknown) {
|
|
1478
2072
|
try {
|
|
1479
|
-
const pkg = JSON.parse(await fs2.
|
|
2073
|
+
const pkg = JSON.parse(await fs2.readFile(filepath, "utf8"));
|
|
1480
2074
|
let agent;
|
|
1481
|
-
|
|
1482
|
-
|
|
2075
|
+
const nameAndVer = getNameAndVer(pkg);
|
|
2076
|
+
if (nameAndVer) {
|
|
2077
|
+
const name = nameAndVer.name;
|
|
2078
|
+
const ver = nameAndVer.ver;
|
|
1483
2079
|
let version = ver;
|
|
1484
|
-
if (name === "yarn" && Number.parseInt(ver) > 1) {
|
|
2080
|
+
if (name === "yarn" && ver && Number.parseInt(ver) > 1) {
|
|
1485
2081
|
agent = "yarn@berry";
|
|
1486
2082
|
version = "berry";
|
|
1487
2083
|
return { name, agent, version };
|
|
1488
|
-
} else if (name === "pnpm" && Number.parseInt(ver) < 7) {
|
|
2084
|
+
} else if (name === "pnpm" && ver && Number.parseInt(ver) < 7) {
|
|
1489
2085
|
agent = "pnpm@6";
|
|
1490
2086
|
return { name, agent, version };
|
|
1491
2087
|
} else if (AGENTS.includes(name)) {
|
|
@@ -1519,12 +2115,15 @@ async function renderNuxtTemplate(ctx) {
|
|
|
1519
2115
|
const isYarn1 = pkgManager === "yarn" && pkgInfo?.version.startsWith("1.");
|
|
1520
2116
|
const customCommand = useNuxtV4Compat ? `npx nuxi@latest init -t v4-compat ${projectName}` : `npm exec nuxi init ${projectName}`;
|
|
1521
2117
|
const fullCustomCommand = customCommand.replace("@latest", () => isYarn1 ? "" : "@latest").replace(/^npm exec/, () => {
|
|
1522
|
-
if (pkgManager === "pnpm")
|
|
2118
|
+
if (pkgManager === "pnpm") {
|
|
1523
2119
|
return "pnpm dlx";
|
|
1524
|
-
|
|
2120
|
+
}
|
|
2121
|
+
if (pkgManager === "yarn" && !isYarn1) {
|
|
1525
2122
|
return "yarn dlx";
|
|
1526
|
-
|
|
2123
|
+
}
|
|
2124
|
+
if (pkgManager === "bun") {
|
|
1527
2125
|
return "bun x";
|
|
2126
|
+
}
|
|
1528
2127
|
return "npm exec";
|
|
1529
2128
|
});
|
|
1530
2129
|
const [command, ...args] = fullCustomCommand.split(" ");
|
|
@@ -1551,7 +2150,7 @@ function configurePackageJson({
|
|
|
1551
2150
|
nuxtPreset
|
|
1552
2151
|
}) {
|
|
1553
2152
|
const packageJson = path3.join(projectRoot, "package.json");
|
|
1554
|
-
const pkg = JSON.parse(fs3.readFileSync(path3.join(projectRoot, "package.json"), "
|
|
2153
|
+
const pkg = JSON.parse(fs3.readFileSync(path3.join(projectRoot, "package.json"), "utf8"));
|
|
1555
2154
|
pkg.name = projectName;
|
|
1556
2155
|
const scripts = [
|
|
1557
2156
|
["prepare", "nuxt prepare"],
|
|
@@ -1564,7 +2163,7 @@ function configurePackageJson({
|
|
|
1564
2163
|
const dependencies = [
|
|
1565
2164
|
["vuetify", versions.vuetify]
|
|
1566
2165
|
];
|
|
1567
|
-
if (dependencies.length) {
|
|
2166
|
+
if (dependencies.length > 0) {
|
|
1568
2167
|
addPackageObject("dependencies", dependencies, pkg);
|
|
1569
2168
|
}
|
|
1570
2169
|
const devDependencies = [
|
|
@@ -1581,11 +2180,11 @@ function configurePackageJson({
|
|
|
1581
2180
|
devDependencies.push(["@vuetify/loader-shared", versions["@vuetify/loader-shared"]]);
|
|
1582
2181
|
devDependencies.push(["vite-plugin-vuetify", versions["vite-plugin-vuetify"]]);
|
|
1583
2182
|
}
|
|
1584
|
-
if (devDependencies.length) {
|
|
2183
|
+
if (devDependencies.length > 0) {
|
|
1585
2184
|
addPackageObject("devDependencies", devDependencies, pkg);
|
|
1586
2185
|
}
|
|
1587
2186
|
addPackageObject("scripts", scripts, pkg, false);
|
|
1588
|
-
fs3.writeFileSync(packageJson, JSON.stringify(pkg, null, 2), "
|
|
2187
|
+
fs3.writeFileSync(packageJson, JSON.stringify(pkg, null, 2), "utf8");
|
|
1589
2188
|
}
|
|
1590
2189
|
function configureVuetify(ctx, nuxtConfig) {
|
|
1591
2190
|
const config = getDefaultExportOptions(nuxtConfig);
|
|
@@ -1718,9 +2317,9 @@ function prepareNuxtModule(ctx, nuxtConfig) {
|
|
|
1718
2317
|
}
|
|
1719
2318
|
function prepareVuetifyModule(ctx, nuxtConfig) {
|
|
1720
2319
|
const config = configureVuetify(ctx, nuxtConfig);
|
|
1721
|
-
const styles = ctx.nuxtPreset
|
|
2320
|
+
const styles = ctx.nuxtPreset === "nuxt-essentials" ? {
|
|
1722
2321
|
configFile: "assets/settings.scss"
|
|
1723
|
-
};
|
|
2322
|
+
} : true;
|
|
1724
2323
|
config.vuetify = { autoImport: true, styles };
|
|
1725
2324
|
}
|
|
1726
2325
|
function prepareProject(ctx) {
|
|
@@ -1732,7 +2331,7 @@ function prepareProject(ctx) {
|
|
|
1732
2331
|
} = ctx;
|
|
1733
2332
|
const [rootPath, templateDir] = getPaths(projectRoot, templatePath, useNuxtV4Compat);
|
|
1734
2333
|
const nuxtConfigFile = path3.join(rootPath, useNuxtV4Compat ? "../nuxt.config.ts" : "nuxt.config.ts");
|
|
1735
|
-
const nuxtConfig = parseModule(fs3.readFileSync(nuxtConfigFile, "
|
|
2334
|
+
const nuxtConfig = parseModule(fs3.readFileSync(nuxtConfigFile, "utf8"));
|
|
1736
2335
|
if (useNuxtModule) {
|
|
1737
2336
|
prepareNuxtModule(ctx, nuxtConfig);
|
|
1738
2337
|
} else {
|
|
@@ -1767,7 +2366,7 @@ function prepareProject(ctx) {
|
|
|
1767
2366
|
fs3.writeFileSync(
|
|
1768
2367
|
nuxtConfigFile,
|
|
1769
2368
|
code,
|
|
1770
|
-
"
|
|
2369
|
+
"utf8"
|
|
1771
2370
|
);
|
|
1772
2371
|
copyResources(ctx, rootPath, templateDir);
|
|
1773
2372
|
}
|
|
@@ -1777,7 +2376,7 @@ var validPresets = ["base", "custom", "default", "essentials"];
|
|
|
1777
2376
|
async function run() {
|
|
1778
2377
|
const argv = minimist(process.argv.slice(2), {
|
|
1779
2378
|
alias: {
|
|
1780
|
-
|
|
2379
|
+
typescript: ["ts"]
|
|
1781
2380
|
}
|
|
1782
2381
|
});
|
|
1783
2382
|
if (argv.preset && !validPresets.includes(argv.preset)) {
|
|
@@ -1805,8 +2404,6 @@ ${banner}
|
|
|
1805
2404
|
usePackageManager,
|
|
1806
2405
|
installDependencies: installDeps,
|
|
1807
2406
|
usePreset,
|
|
1808
|
-
useStore,
|
|
1809
|
-
useEslint,
|
|
1810
2407
|
useNuxtV4Compat,
|
|
1811
2408
|
useNuxtModule,
|
|
1812
2409
|
useNuxtSSR,
|
|
@@ -1818,8 +2415,8 @@ ${banner}
|
|
|
1818
2415
|
}
|
|
1819
2416
|
const preset = context.usePreset ?? usePreset;
|
|
1820
2417
|
if (preset.startsWith("nuxt-")) {
|
|
1821
|
-
const templateRoot =
|
|
1822
|
-
const templatePath =
|
|
2418
|
+
const templateRoot = resolve5(dirname3(fileURLToPath(import.meta.url)), "../template/typescript");
|
|
2419
|
+
const templatePath = resolve5(dirname3(fileURLToPath(import.meta.url)), "../template/typescript/nuxt");
|
|
1823
2420
|
await renderNuxtTemplate({
|
|
1824
2421
|
cwd: cwd2,
|
|
1825
2422
|
projectName,
|
|
@@ -1834,16 +2431,16 @@ ${banner}
|
|
|
1834
2431
|
});
|
|
1835
2432
|
} else {
|
|
1836
2433
|
mkdirSync2(projectRoot);
|
|
1837
|
-
writeFileSync2(
|
|
2434
|
+
writeFileSync2(resolve5(projectRoot, "package.json"), JSON.stringify({ name: projectName }, null, 2));
|
|
1838
2435
|
console.log("\n\u25CC Generating scaffold...");
|
|
1839
2436
|
const jsOrTs = useTypeScript ? "typescript" : "javascript";
|
|
1840
|
-
const templatePath =
|
|
1841
|
-
renderTemplate(
|
|
2437
|
+
const templatePath = resolve5(dirname3(fileURLToPath(import.meta.url)), "../template", jsOrTs);
|
|
2438
|
+
renderTemplate(resolve5(templatePath, "default"), projectRoot);
|
|
1842
2439
|
if (["base", "essentials"].includes(usePreset)) {
|
|
1843
|
-
renderTemplate(
|
|
2440
|
+
renderTemplate(resolve5(templatePath, "base"), projectRoot);
|
|
1844
2441
|
}
|
|
1845
2442
|
if (["essentials", "recommended"].includes(usePreset)) {
|
|
1846
|
-
renderTemplate(
|
|
2443
|
+
renderTemplate(resolve5(templatePath, "essentials"), projectRoot);
|
|
1847
2444
|
}
|
|
1848
2445
|
if (usePackageManager && installDeps) {
|
|
1849
2446
|
console.log(`\u25CC Installing dependencies with ${usePackageManager}...
|
|
@@ -1860,9 +2457,9 @@ run().then(() => {
|
|
|
1860
2457
|
console.log("Github: https://github.com/vuetifyjs/vuetify");
|
|
1861
2458
|
console.log("Support Vuetify: https://github.com/sponsors/johnleider");
|
|
1862
2459
|
process.exit(0);
|
|
1863
|
-
}).catch((
|
|
2460
|
+
}).catch((error) => {
|
|
1864
2461
|
console.error(`
|
|
1865
|
-
${red2("\u2716")} ${
|
|
2462
|
+
${red2("\u2716")} ${error}
|
|
1866
2463
|
`);
|
|
1867
2464
|
process.exit(1);
|
|
1868
2465
|
});
|