create-vuetify 2.6.0 → 2.7.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/bin/index.js +3 -0
- package/dist/index.mjs +449 -721
- package/package.json +43 -24
- package/template/javascript/base/package.json +6 -4
- package/template/javascript/base/src/router/index.js +1 -1
- package/template/javascript/base/vite.config.mjs +0 -10
- package/template/javascript/default/package.json +9 -9
- package/template/javascript/default/vite.config.mjs +0 -10
- package/template/javascript/essentials/src/router/index.js +1 -1
- package/template/javascript/essentials/vite.config.mjs +0 -10
- package/template/typescript/base/package.json +6 -4
- package/template/typescript/base/src/router/index.ts +1 -1
- package/template/typescript/base/vite.config.mts +0 -10
- package/template/typescript/default/package.json +13 -13
- package/template/typescript/default/vite.config.mts +0 -10
- package/template/typescript/essentials/package.json +1 -1
- package/template/typescript/essentials/src/router/index.ts +1 -1
- package/template/typescript/essentials/vite.config.mts +0 -10
- package/template/typescript/nuxt/modules/vuetify.ts +1 -10
- package/index.js +0 -3
package/dist/index.mjs
CHANGED
|
@@ -1,26 +1,19 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
import { dirname as dirname3, join as
|
|
2
|
+
import { dirname as dirname3, join as join4, resolve as resolve6 } from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
-
import { mkdirSync as mkdirSync2, rmSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
4
|
+
import { mkdirSync as mkdirSync2, rmSync, writeFileSync as writeFileSync2, existsSync as existsSync5 } from "node:fs";
|
|
5
5
|
|
|
6
6
|
// src/utils/prompts.ts
|
|
7
7
|
import { join as join2, resolve as resolve3 } from "node:path";
|
|
8
8
|
import { existsSync as existsSync2, readdirSync } from "node:fs";
|
|
9
9
|
|
|
10
10
|
// src/utils/presets.ts
|
|
11
|
-
var defaultContext = {
|
|
12
|
-
useEslint: false,
|
|
13
|
-
useRouter: false,
|
|
14
|
-
useStore: false
|
|
15
|
-
};
|
|
11
|
+
var defaultContext = {};
|
|
16
12
|
var baseContext = {
|
|
17
|
-
...defaultContext
|
|
18
|
-
useEslint: true,
|
|
19
|
-
useRouter: true
|
|
13
|
+
...defaultContext
|
|
20
14
|
};
|
|
21
15
|
var essentialsContext = {
|
|
22
|
-
...baseContext
|
|
23
|
-
useStore: true
|
|
16
|
+
...baseContext
|
|
24
17
|
};
|
|
25
18
|
var presets = {
|
|
26
19
|
"base": baseContext,
|
|
@@ -184,7 +177,7 @@ var isAbsolute = function(p) {
|
|
|
184
177
|
return _IS_ABSOLUTE_RE.test(p);
|
|
185
178
|
};
|
|
186
179
|
|
|
187
|
-
// node_modules/.pnpm/tinyexec@0.
|
|
180
|
+
// node_modules/.pnpm/tinyexec@1.0.1/node_modules/tinyexec/dist/main.js
|
|
188
181
|
import { createRequire as __tinyexec_cr } from "node:module";
|
|
189
182
|
import { spawn as de } from "child_process";
|
|
190
183
|
import { normalize as fe } from "path";
|
|
@@ -726,7 +719,7 @@ var ve = (t, e, n) => {
|
|
|
726
719
|
};
|
|
727
720
|
var be = ve;
|
|
728
721
|
|
|
729
|
-
// node_modules/.pnpm/nypm@0.6.
|
|
722
|
+
// node_modules/.pnpm/nypm@0.6.2/node_modules/nypm/dist/shared/nypm.CLjaS_sz.mjs
|
|
730
723
|
import { existsSync } from "node:fs";
|
|
731
724
|
import { readFile } from "node:fs/promises";
|
|
732
725
|
async function findup(cwd2, match, options = {}) {
|
|
@@ -768,6 +761,7 @@ async function executeCommand(command, args, options = {}) {
|
|
|
768
761
|
const { exitCode, stdout, stderr } = await ve(xArgs[0], xArgs[1], {
|
|
769
762
|
nodeOptions: {
|
|
770
763
|
cwd: resolve(options.cwd || process.cwd()),
|
|
764
|
+
env: options.env,
|
|
771
765
|
stdio: options.silent ? "pipe" : "inherit"
|
|
772
766
|
}
|
|
773
767
|
});
|
|
@@ -780,17 +774,20 @@ async function executeCommand(command, args, options = {}) {
|
|
|
780
774
|
var NO_PACKAGE_MANAGER_DETECTED_ERROR_MSG = "No package manager auto-detected.";
|
|
781
775
|
async function resolveOperationOptions(options = {}) {
|
|
782
776
|
const cwd2 = options.cwd || process.cwd();
|
|
777
|
+
const env = { ...process.env, ...options.env };
|
|
783
778
|
const packageManager2 = (typeof options.packageManager === "string" ? packageManagers.find((pm) => pm.name === options.packageManager) : options.packageManager) || await detectPackageManager(options.cwd || process.cwd());
|
|
784
779
|
if (!packageManager2) {
|
|
785
780
|
throw new Error(NO_PACKAGE_MANAGER_DETECTED_ERROR_MSG);
|
|
786
781
|
}
|
|
787
782
|
return {
|
|
788
783
|
cwd: cwd2,
|
|
784
|
+
env,
|
|
789
785
|
silent: options.silent ?? false,
|
|
790
786
|
packageManager: packageManager2,
|
|
791
787
|
dev: options.dev ?? false,
|
|
792
788
|
workspace: options.workspace,
|
|
793
|
-
global: options.global ?? false
|
|
789
|
+
global: options.global ?? false,
|
|
790
|
+
dry: options.dry ?? false
|
|
794
791
|
};
|
|
795
792
|
}
|
|
796
793
|
function parsePackageManagerField(packageManager2) {
|
|
@@ -921,642 +918,108 @@ async function installDependencies(options = {}) {
|
|
|
921
918
|
deno: ["install", "--frozen"]
|
|
922
919
|
};
|
|
923
920
|
const commandArgs = options.frozenLockFile ? pmToFrozenLockfileInstallCommand[resolvedOptions.packageManager.name] : ["install"];
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
921
|
+
if (!resolvedOptions.dry) {
|
|
922
|
+
await executeCommand(resolvedOptions.packageManager.command, commandArgs, {
|
|
923
|
+
cwd: resolvedOptions.cwd,
|
|
924
|
+
silent: resolvedOptions.silent
|
|
925
|
+
});
|
|
926
|
+
}
|
|
927
|
+
return {
|
|
928
|
+
exec: {
|
|
929
|
+
command: resolvedOptions.packageManager.command,
|
|
930
|
+
args: commandArgs
|
|
931
|
+
}
|
|
932
|
+
};
|
|
928
933
|
}
|
|
929
934
|
|
|
930
|
-
//
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
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;
|
|
935
|
+
// src/utils/cli/postinstall/pnpm.ts
|
|
936
|
+
async function pnpmIgnored(root) {
|
|
937
|
+
const pnpmVersion = (await ve(`pnpm`, ["-v"], { nodeOptions: { cwd: root } })).stdout.trim();
|
|
938
|
+
const [major] = pnpmVersion.split(".").map(Number);
|
|
939
|
+
if (major && major >= 10) {
|
|
940
|
+
const detect2 = (await ve("pnpm", ["ignored-builds"], { nodeOptions: { cwd: root } })).stdout;
|
|
941
|
+
if (detect2.startsWith("Automatically ignored builds during installation:\n None")) {
|
|
942
|
+
return;
|
|
983
943
|
}
|
|
984
|
-
return
|
|
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
|
-
});
|
|
944
|
+
return detect2;
|
|
1007
945
|
}
|
|
1008
|
-
|
|
1009
|
-
|
|
946
|
+
}
|
|
947
|
+
async function pnpm(root) {
|
|
948
|
+
const detect2 = await pnpmIgnored(root);
|
|
949
|
+
if (detect2) {
|
|
950
|
+
console.warn(detect2);
|
|
1010
951
|
}
|
|
1011
|
-
|
|
1012
|
-
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
// src/utils/cli/preinstall/yarn.ts
|
|
955
|
+
import { appendFileSync } from "node:fs";
|
|
956
|
+
import { resolve as resolve2 } from "node:path";
|
|
957
|
+
var templateToAppend = `
|
|
958
|
+
packageExtensions:
|
|
959
|
+
unplugin-vue-router@*:
|
|
960
|
+
dependencies:
|
|
961
|
+
"@vue/compiler-sfc": "*"
|
|
962
|
+
`;
|
|
963
|
+
async function yarnFile(root) {
|
|
964
|
+
const pnpmVersion = (await ve("yarn", ["-v"], { nodeOptions: { cwd: root } })).stdout.trim();
|
|
965
|
+
const [major] = pnpmVersion.split(".").map(Number);
|
|
966
|
+
if (major && major >= 2) {
|
|
967
|
+
appendFileSync(resolve2(root, ".yarnrc.yml"), templateToAppend);
|
|
1013
968
|
}
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
969
|
+
}
|
|
970
|
+
async function yarn(root) {
|
|
971
|
+
await yarnFile(root);
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
// src/utils/installDependencies.ts
|
|
975
|
+
var userAgent = process.env.npm_config_user_agent ?? "";
|
|
976
|
+
var packageManager = /bun/.test(userAgent) ? "bun" : /pnpm/.test(userAgent) ? "pnpm" : "npm";
|
|
977
|
+
async function installDependencies2(root = process.cwd(), manager = packageManager) {
|
|
978
|
+
if (manager === "yarn") {
|
|
979
|
+
await yarn(root);
|
|
1017
980
|
}
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
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
|
-
});
|
|
981
|
+
await installDependencies({
|
|
982
|
+
packageManager: manager,
|
|
983
|
+
cwd: root,
|
|
984
|
+
silent: true
|
|
985
|
+
}).catch(() => {
|
|
986
|
+
console.error(
|
|
987
|
+
`Failed to install dependencies using ${manager}.`
|
|
988
|
+
);
|
|
989
|
+
});
|
|
990
|
+
if (manager === "pnpm") {
|
|
991
|
+
await pnpm(root);
|
|
1038
992
|
}
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
}
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
// src/utils/prompts.ts
|
|
996
|
+
import validate from "validate-npm-package-name";
|
|
997
|
+
var promptOptions = {
|
|
998
|
+
onCancel: () => {
|
|
999
|
+
throw new Error(red("\u2716") + " Operation cancelled");
|
|
1047
1000
|
}
|
|
1048
|
-
}
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
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
|
|
1001
|
+
};
|
|
1002
|
+
async function initPrompts(context) {
|
|
1003
|
+
if (context.usePreset) {
|
|
1004
|
+
context = {
|
|
1005
|
+
...context,
|
|
1006
|
+
...presets[context.usePreset]
|
|
1062
1007
|
};
|
|
1063
|
-
}
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
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 {
|
|
1008
|
+
}
|
|
1009
|
+
const answers = await prompts([
|
|
1010
|
+
{
|
|
1011
|
+
name: "projectName",
|
|
1012
|
+
type: "text",
|
|
1013
|
+
message: "Project name:",
|
|
1014
|
+
initial: "vuetify-project",
|
|
1015
|
+
format: (v) => v.trim(),
|
|
1016
|
+
validate: (v) => {
|
|
1017
|
+
const { errors, warnings, validForNewPackages: isValid } = validate(String(v).trim());
|
|
1018
|
+
const error = isValid ? null : errors ? errors[0] : warnings[0];
|
|
1019
|
+
if (!isValid) {
|
|
1020
|
+
return `Package ${error}`;
|
|
1098
1021
|
}
|
|
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();
|
|
1475
|
-
const [major] = pnpmVersion.split(".").map(Number);
|
|
1476
|
-
if (major && major >= 10) {
|
|
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
|
-
}
|
|
1481
|
-
return detect2;
|
|
1482
|
-
}
|
|
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
|
-
}
|
|
1510
|
-
|
|
1511
|
-
// src/utils/installDependencies.ts
|
|
1512
|
-
var userAgent = process.env.npm_config_user_agent ?? "";
|
|
1513
|
-
var packageManager = /bun/.test(userAgent) ? "bun" : "pnpm";
|
|
1514
|
-
async function installDependencies2(root = process.cwd(), manager = packageManager) {
|
|
1515
|
-
if (manager === "yarn") {
|
|
1516
|
-
await yarn(root);
|
|
1517
|
-
}
|
|
1518
|
-
await installDependencies({
|
|
1519
|
-
packageManager: manager,
|
|
1520
|
-
cwd: root,
|
|
1521
|
-
silent: true
|
|
1522
|
-
}).catch(() => {
|
|
1523
|
-
console.error(
|
|
1524
|
-
`Failed to install dependencies using ${manager}.`
|
|
1525
|
-
);
|
|
1526
|
-
});
|
|
1527
|
-
if (manager === "pnpm") {
|
|
1528
|
-
await pnpm(root);
|
|
1529
|
-
}
|
|
1530
|
-
}
|
|
1531
|
-
|
|
1532
|
-
// src/utils/prompts.ts
|
|
1533
|
-
import validate from "validate-npm-package-name";
|
|
1534
|
-
var promptOptions = {
|
|
1535
|
-
onCancel: () => {
|
|
1536
|
-
throw new Error(red("\u2716") + " Operation cancelled");
|
|
1537
|
-
}
|
|
1538
|
-
};
|
|
1539
|
-
var initPrompts = async (context) => {
|
|
1540
|
-
if (context.usePreset) {
|
|
1541
|
-
context = {
|
|
1542
|
-
...context,
|
|
1543
|
-
...presets[context.usePreset]
|
|
1544
|
-
};
|
|
1545
|
-
}
|
|
1546
|
-
const answers = await prompts([
|
|
1547
|
-
{
|
|
1548
|
-
name: "projectName",
|
|
1549
|
-
type: "text",
|
|
1550
|
-
message: "Project name:",
|
|
1551
|
-
initial: "vuetify-project",
|
|
1552
|
-
format: (v) => v.trim(),
|
|
1553
|
-
validate: (v) => {
|
|
1554
|
-
const { errors, warnings, validForNewPackages: isValid } = validate(String(v).trim());
|
|
1555
|
-
const error = isValid ? null : errors ? errors[0] : warnings[0];
|
|
1556
|
-
if (!isValid) {
|
|
1557
|
-
return `Package ${error}`;
|
|
1558
|
-
}
|
|
1559
|
-
return true;
|
|
1022
|
+
return true;
|
|
1560
1023
|
}
|
|
1561
1024
|
},
|
|
1562
1025
|
{
|
|
@@ -1628,17 +1091,6 @@ var initPrompts = async (context) => {
|
|
|
1628
1091
|
inactive: "No",
|
|
1629
1092
|
initial: "Yes"
|
|
1630
1093
|
},
|
|
1631
|
-
{
|
|
1632
|
-
name: "useNuxtV4Compat",
|
|
1633
|
-
type: (_, { usePreset }) => {
|
|
1634
|
-
const p = context.usePreset ?? usePreset;
|
|
1635
|
-
return p.startsWith("nuxt-") ? "toggle" : null;
|
|
1636
|
-
},
|
|
1637
|
-
message: "Use Nuxt v4 compatibility?",
|
|
1638
|
-
active: "Yes",
|
|
1639
|
-
inactive: "No",
|
|
1640
|
-
initial: "Yes"
|
|
1641
|
-
},
|
|
1642
1094
|
{
|
|
1643
1095
|
name: "useNuxtModule",
|
|
1644
1096
|
type: (_, { usePreset }) => {
|
|
@@ -1680,15 +1132,262 @@ var initPrompts = async (context) => {
|
|
|
1680
1132
|
...context,
|
|
1681
1133
|
...answers
|
|
1682
1134
|
};
|
|
1683
|
-
}
|
|
1135
|
+
}
|
|
1684
1136
|
|
|
1685
|
-
// src/
|
|
1137
|
+
// src/utils/nonInteractivePrompts.ts
|
|
1138
|
+
import { join as join3, resolve as resolve4 } from "node:path";
|
|
1139
|
+
import { existsSync as existsSync3, readdirSync as readdirSync2 } from "node:fs";
|
|
1686
1140
|
import { red as red2 } from "kolorist";
|
|
1141
|
+
function resolveNonInteractiveContext(context) {
|
|
1142
|
+
if (context.usePreset) {
|
|
1143
|
+
context = {
|
|
1144
|
+
...context,
|
|
1145
|
+
...presets[context.usePreset]
|
|
1146
|
+
};
|
|
1147
|
+
}
|
|
1148
|
+
const projectName = context.projectName || "vuetify-project";
|
|
1149
|
+
const projectPath = join3(context.cwd, projectName);
|
|
1150
|
+
const directoryExists = existsSync3(projectPath);
|
|
1151
|
+
const directoryNotEmpty = directoryExists && readdirSync2(projectPath).length > 0;
|
|
1152
|
+
if (directoryNotEmpty && !context.canOverwrite) {
|
|
1153
|
+
console.error("\n\n", red2("\u2716") + ` Target directory ${resolve4(context.cwd, projectName)} exists and is not empty.`);
|
|
1154
|
+
console.error("Use --force or --overwrite flag to overwrite the directory.");
|
|
1155
|
+
process.exit(1);
|
|
1156
|
+
}
|
|
1157
|
+
let useTypeScript = context.useTypeScript;
|
|
1158
|
+
if (useTypeScript === void 0) {
|
|
1159
|
+
const preset = context.usePreset;
|
|
1160
|
+
useTypeScript = preset ? preset.startsWith("nuxt-") : false;
|
|
1161
|
+
}
|
|
1162
|
+
let usePackageManager = context.usePackageManager;
|
|
1163
|
+
if (usePackageManager === void 0) {
|
|
1164
|
+
const preset = context.usePreset;
|
|
1165
|
+
if (!preset || !preset.startsWith("nuxt-")) {
|
|
1166
|
+
usePackageManager = packageManager;
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
let installDependencies3 = context.installDependencies;
|
|
1170
|
+
if (installDependencies3 === void 0) {
|
|
1171
|
+
const preset = context.usePreset;
|
|
1172
|
+
installDependencies3 = preset ? !preset.startsWith("nuxt-") : true;
|
|
1173
|
+
}
|
|
1174
|
+
const usePreset = context.usePreset || "default";
|
|
1175
|
+
const useNuxtModule = context.useNuxtModule;
|
|
1176
|
+
const useNuxtSSR = context.useNuxtSSR;
|
|
1177
|
+
const useNuxtSSRClientHints = context.useNuxtSSRClientHints;
|
|
1178
|
+
return {
|
|
1179
|
+
cwd: context.cwd,
|
|
1180
|
+
projectName,
|
|
1181
|
+
canOverwrite: context.canOverwrite || false,
|
|
1182
|
+
useTypeScript: useTypeScript || false,
|
|
1183
|
+
usePackageManager: usePackageManager || "npm",
|
|
1184
|
+
installDependencies: installDependencies3 || false,
|
|
1185
|
+
usePreset,
|
|
1186
|
+
useNuxtModule: useNuxtModule || false,
|
|
1187
|
+
useNuxtSSR: useNuxtSSR || false,
|
|
1188
|
+
useNuxtSSRClientHints: useNuxtSSRClientHints || false
|
|
1189
|
+
};
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
// package.json
|
|
1193
|
+
var package_default = {
|
|
1194
|
+
name: "create-vuetify",
|
|
1195
|
+
version: "2.7.0",
|
|
1196
|
+
author: "Elijah Kotyluk <elijah@elijahkotyluk.com>",
|
|
1197
|
+
license: "MIT",
|
|
1198
|
+
type: "module",
|
|
1199
|
+
bin: {
|
|
1200
|
+
"create-vuetify": "bin/index.js"
|
|
1201
|
+
},
|
|
1202
|
+
files: [
|
|
1203
|
+
"bin/index.js",
|
|
1204
|
+
"template",
|
|
1205
|
+
"dist"
|
|
1206
|
+
],
|
|
1207
|
+
repository: {
|
|
1208
|
+
type: "git",
|
|
1209
|
+
url: "git+https://github.com/vuetifyjs/create.git"
|
|
1210
|
+
},
|
|
1211
|
+
bugs: {
|
|
1212
|
+
url: "https://github.com/vuetifyjs/create/issues"
|
|
1213
|
+
},
|
|
1214
|
+
keywords: [
|
|
1215
|
+
"vuetify",
|
|
1216
|
+
"vue",
|
|
1217
|
+
"vue3",
|
|
1218
|
+
"ui",
|
|
1219
|
+
"scaffolding",
|
|
1220
|
+
"cli",
|
|
1221
|
+
"template",
|
|
1222
|
+
"create",
|
|
1223
|
+
"boilerplate",
|
|
1224
|
+
"starter",
|
|
1225
|
+
"typescript",
|
|
1226
|
+
"javascript",
|
|
1227
|
+
"vite",
|
|
1228
|
+
"pinia",
|
|
1229
|
+
"vue-router",
|
|
1230
|
+
"nuxt",
|
|
1231
|
+
"material-design",
|
|
1232
|
+
"material-ui",
|
|
1233
|
+
"components"
|
|
1234
|
+
],
|
|
1235
|
+
scripts: {
|
|
1236
|
+
build: "node ./scripts/build.js",
|
|
1237
|
+
start: "node ./index.js",
|
|
1238
|
+
dev: "node --run build && node --run start",
|
|
1239
|
+
lint: "eslint --fix .",
|
|
1240
|
+
prepublishOnly: "node --run build",
|
|
1241
|
+
release: "bumpp"
|
|
1242
|
+
},
|
|
1243
|
+
dependencies: {
|
|
1244
|
+
kolorist: "^1.8.0",
|
|
1245
|
+
magicast: "^0.3.5",
|
|
1246
|
+
minimist: "^1.2.8",
|
|
1247
|
+
"package-manager-detector": "^1.3.0",
|
|
1248
|
+
prompts: "^2.4.2",
|
|
1249
|
+
tinyexec: "^1.0.1",
|
|
1250
|
+
"validate-npm-package-name": "^6.0.2"
|
|
1251
|
+
},
|
|
1252
|
+
devDependencies: {
|
|
1253
|
+
"@types/minimist": "^1.2.5",
|
|
1254
|
+
"@types/node": "^22.18.5",
|
|
1255
|
+
"@types/prompts": "^2.4.9",
|
|
1256
|
+
"@types/validate-npm-package-name": "^4.0.2",
|
|
1257
|
+
bumpp: "^10.2.3",
|
|
1258
|
+
esbuild: "^0.25.9",
|
|
1259
|
+
eslint: "^9.35.0",
|
|
1260
|
+
"eslint-config-vuetify": "^4.2.0",
|
|
1261
|
+
nypm: "^0.6.2",
|
|
1262
|
+
typescript: "^5.9.2"
|
|
1263
|
+
},
|
|
1264
|
+
packageManager: "pnpm@9.15.9"
|
|
1265
|
+
};
|
|
1266
|
+
|
|
1267
|
+
// src/utils/cli/helpText.ts
|
|
1268
|
+
function getHelpText() {
|
|
1269
|
+
return `
|
|
1270
|
+
Usage: create-vuetify [project-name] [options]
|
|
1271
|
+
|
|
1272
|
+
Options:
|
|
1273
|
+
-p, --preset <preset> Choose a preset (base, default, essentials, nuxt-base, nuxt-default, nuxt-essentials)
|
|
1274
|
+
--ts, --typescript Use TypeScript
|
|
1275
|
+
--pm, --package-manager <manager> Package manager to use (npm, pnpm, yarn, bun, none)
|
|
1276
|
+
-i, --install Install dependencies
|
|
1277
|
+
-f, --force, --overwrite Overwrite existing directory
|
|
1278
|
+
--nuxt-module Use vuetify-nuxt-module (for Nuxt presets)
|
|
1279
|
+
--nuxt-ssr, --ssr Enable Nuxt SSR (for Nuxt presets)
|
|
1280
|
+
--nuxt-ssr-client-hints Enable Nuxt SSR Client Hints (for Nuxt presets)
|
|
1281
|
+
-h, --help Show help
|
|
1282
|
+
-v, --version Show version
|
|
1283
|
+
|
|
1284
|
+
Examples:
|
|
1285
|
+
create-vuetify # Interactive mode
|
|
1286
|
+
create-vuetify my-app --preset default --typescript # Non-interactive with TypeScript
|
|
1287
|
+
create-vuetify my-app --preset nuxt-essentials --ssr # Nuxt project with SSR
|
|
1288
|
+
create-vuetify my-app --force --install --pm pnpm # Force overwrite and install with pnpm
|
|
1289
|
+
|
|
1290
|
+
Presets:
|
|
1291
|
+
default - Barebones (Only Vue & Vuetify)
|
|
1292
|
+
base - Default (Adds routing, ESLint & SASS variables)
|
|
1293
|
+
essentials - Recommended (Everything from Default. Adds auto importing, layouts & pinia)
|
|
1294
|
+
nuxt-base - Nuxt Default (Adds Nuxt ESLint & SASS variables)
|
|
1295
|
+
nuxt-default - Nuxt Barebones (Only Vuetify)
|
|
1296
|
+
nuxt-essentials - Nuxt Recommended (Everything from Default. Enables auto importing & layouts)
|
|
1297
|
+
`.trim();
|
|
1298
|
+
}
|
|
1299
|
+
function getVersionText() {
|
|
1300
|
+
return `${package_default.version}`;
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
// src/utils/cli/parseArgs.ts
|
|
1687
1304
|
import minimist from "minimist";
|
|
1305
|
+
var validPresets = ["base", "default", "essentials", "nuxt-base", "nuxt-default", "nuxt-essentials"];
|
|
1306
|
+
var validPackageManagers = ["npm", "pnpm", "yarn", "bun", "none"];
|
|
1307
|
+
function parseCliArgs(args) {
|
|
1308
|
+
const argv = minimist(args, {
|
|
1309
|
+
alias: {
|
|
1310
|
+
typescript: ["ts"],
|
|
1311
|
+
preset: ["p"],
|
|
1312
|
+
packageManager: ["pm", "package-manager"],
|
|
1313
|
+
installDependencies: ["install", "i"],
|
|
1314
|
+
overwrite: ["force", "f"],
|
|
1315
|
+
nuxtModule: ["nuxt-module"],
|
|
1316
|
+
nuxtSSR: ["nuxt-ssr", "ssr"],
|
|
1317
|
+
nuxtSSRClientHints: ["nuxt-ssr-client-hints", "client-hints"],
|
|
1318
|
+
help: ["h"],
|
|
1319
|
+
version: ["v"]
|
|
1320
|
+
},
|
|
1321
|
+
boolean: [
|
|
1322
|
+
"typescript",
|
|
1323
|
+
"installDependencies",
|
|
1324
|
+
"overwrite",
|
|
1325
|
+
"nuxtModule",
|
|
1326
|
+
"nuxtSSR",
|
|
1327
|
+
"nuxtSSRClientHints",
|
|
1328
|
+
"help",
|
|
1329
|
+
"version"
|
|
1330
|
+
],
|
|
1331
|
+
string: [
|
|
1332
|
+
"preset",
|
|
1333
|
+
"packageManager"
|
|
1334
|
+
]
|
|
1335
|
+
});
|
|
1336
|
+
if (argv.preset && !validPresets.includes(argv.preset)) {
|
|
1337
|
+
throw new Error(`'${argv.preset}' is not a valid preset. Valid presets are: ${validPresets.join(", ")}.`);
|
|
1338
|
+
}
|
|
1339
|
+
if (argv.packageManager && !validPackageManagers.includes(argv.packageManager)) {
|
|
1340
|
+
throw new Error(`'${argv.packageManager}' is not a valid package manager. Valid options are: ${validPackageManagers.join(", ")}.`);
|
|
1341
|
+
}
|
|
1342
|
+
const projectName = argv._[0];
|
|
1343
|
+
return {
|
|
1344
|
+
projectName,
|
|
1345
|
+
preset: argv.preset,
|
|
1346
|
+
typescript: argv.typescript,
|
|
1347
|
+
packageManager: argv.packageManager,
|
|
1348
|
+
installDependencies: argv.installDependencies,
|
|
1349
|
+
overwrite: argv.overwrite,
|
|
1350
|
+
nuxtModule: argv.nuxtModule,
|
|
1351
|
+
nuxtSSR: argv.nuxtSSR,
|
|
1352
|
+
nuxtSSRClientHints: argv.nuxtSSRClientHints,
|
|
1353
|
+
help: argv.help,
|
|
1354
|
+
version: argv.version
|
|
1355
|
+
};
|
|
1356
|
+
}
|
|
1357
|
+
function cliOptionsToContext(cliOptions, cwd2) {
|
|
1358
|
+
return {
|
|
1359
|
+
cwd: cwd2,
|
|
1360
|
+
projectName: cliOptions.projectName || "vuetify-project",
|
|
1361
|
+
useTypeScript: cliOptions.typescript,
|
|
1362
|
+
usePreset: cliOptions.preset ?? "default",
|
|
1363
|
+
usePackageManager: cliOptions.packageManager === "none" ? void 0 : cliOptions.packageManager,
|
|
1364
|
+
installDependencies: cliOptions.installDependencies,
|
|
1365
|
+
canOverwrite: cliOptions.overwrite ?? false,
|
|
1366
|
+
useNuxtModule: cliOptions.nuxtModule ?? true,
|
|
1367
|
+
useNuxtSSR: cliOptions.nuxtSSR ?? true,
|
|
1368
|
+
useNuxtSSRClientHints: cliOptions.nuxtSSRClientHints ?? (cliOptions.nuxtModule && cliOptions.nuxtSSR)
|
|
1369
|
+
};
|
|
1370
|
+
}
|
|
1688
1371
|
|
|
1689
|
-
// src/
|
|
1690
|
-
import {
|
|
1691
|
-
|
|
1372
|
+
// src/index.ts
|
|
1373
|
+
import { red as red3 } from "kolorist";
|
|
1374
|
+
|
|
1375
|
+
// src/utils/banner.ts
|
|
1376
|
+
import { blue } from "kolorist";
|
|
1377
|
+
function supportsColor() {
|
|
1378
|
+
const testText = "test";
|
|
1379
|
+
const coloredText = blue(testText);
|
|
1380
|
+
return coloredText !== testText;
|
|
1381
|
+
}
|
|
1382
|
+
function createBanner() {
|
|
1383
|
+
if (!supportsColor()) {
|
|
1384
|
+
return createPlainBanner();
|
|
1385
|
+
}
|
|
1386
|
+
return "\x1B[38;2;22;151;246mV\x1B[39m\x1B[38;2;22;147;242mu\x1B[39m\x1B[38;2;22;144;238me\x1B[39m\x1B[38;2;22;140;234mt\x1B[39m\x1B[38;2;23;136;229mi\x1B[39m\x1B[38;2;23;133;225mf\x1B[39m\x1B[38;2;23;129;221my\x1B[39m\x1B[38;2;23;125;217m.\x1B[39m\x1B[38;2;23;121;213mj\x1B[39m\x1B[38;2;23;118;209ms\x1B[39m \x1B[38;2;24;114;204m-\x1B[39m \x1B[38;2;24;110;200mM\x1B[39m\x1B[38;2;24;107;196ma\x1B[39m\x1B[38;2;24;103;192mt\x1B[39m\x1B[38;2;32;110;197me\x1B[39m\x1B[38;2;39;118;202mr\x1B[39m\x1B[38;2;47;125;207mi\x1B[39m\x1B[38;2;54;132;211ma\x1B[39m\x1B[38;2;62;140;216ml\x1B[39m \x1B[38;2;70;147;221mC\x1B[39m\x1B[38;2;77;154;226mo\x1B[39m\x1B[38;2;85;161;231mm\x1B[39m\x1B[38;2;93;169;236mp\x1B[39m\x1B[38;2;100;176;240mo\x1B[39m\x1B[38;2;108;183;245mn\x1B[39m\x1B[38;2;115;191;250me\x1B[39m\x1B[38;2;123;198;255mn\x1B[39m\x1B[38;2;126;199;255mt\x1B[39m \x1B[38;2;129;201;255mF\x1B[39m\x1B[38;2;133;202;255mr\x1B[39m\x1B[38;2;136;204;255ma\x1B[39m\x1B[38;2;139;205;255mm\x1B[39m\x1B[38;2;142;207;255me\x1B[39m\x1B[38;2;145;208;255mw\x1B[39m\x1B[38;2;149;210;255mo\x1B[39m\x1B[38;2;152;211;255mr\x1B[39m\x1B[38;2;155;212;255mk\x1B[39m \x1B[38;2;158;214;255mf\x1B[39m\x1B[38;2;161;215;255mo\x1B[39m\x1B[38;2;164;217;255mr\x1B[39m \x1B[38;2;168;218;255mV\x1B[39m\x1B[38;2;171;220;255mu\x1B[39m\x1B[38;2;174;221;255me\x1B[39m";
|
|
1387
|
+
}
|
|
1388
|
+
function createPlainBanner() {
|
|
1389
|
+
return "Vuetify - Vue Component Framework";
|
|
1390
|
+
}
|
|
1692
1391
|
|
|
1693
1392
|
// src/utils/deepMerge.ts
|
|
1694
1393
|
var isObject = (v) => {
|
|
@@ -1708,26 +1407,30 @@ var deepMerge = (...sources) => sources.reduce((acc, curr) => {
|
|
|
1708
1407
|
}, {});
|
|
1709
1408
|
|
|
1710
1409
|
// src/utils/renderTemplate.ts
|
|
1410
|
+
import { copyFileSync, mkdirSync, readdirSync as readdirSync3, readFileSync, statSync, writeFileSync, existsSync as existsSync4 } from "node:fs";
|
|
1411
|
+
import { basename as basename2, dirname as dirname2, resolve as resolve5 } from "node:path";
|
|
1711
1412
|
function mergePkg(source, destination) {
|
|
1712
|
-
const target = JSON.parse(readFileSync(destination, "utf8"));
|
|
1413
|
+
const target = existsSync4(destination) ? JSON.parse(readFileSync(destination, "utf8")) : {};
|
|
1713
1414
|
const src = JSON.parse(readFileSync(source, "utf8"));
|
|
1714
1415
|
const mergedPkg = deepMerge(target, src);
|
|
1715
1416
|
const keysToSort = ["devDependencies", "dependencies"];
|
|
1716
1417
|
for (const k of keysToSort) {
|
|
1717
|
-
|
|
1418
|
+
if (mergedPkg[k]) {
|
|
1419
|
+
mergedPkg[k] = Object.keys(mergedPkg[k]).toSorted().reduce((a, c) => (a[c] = mergedPkg[k][c], a), {});
|
|
1420
|
+
}
|
|
1718
1421
|
}
|
|
1719
1422
|
writeFileSync(destination, JSON.stringify(mergedPkg, null, 2) + "\n");
|
|
1720
1423
|
}
|
|
1721
1424
|
function renderDirectory(source, destination) {
|
|
1722
1425
|
mkdirSync(destination, { recursive: true });
|
|
1723
|
-
for (const path4 of
|
|
1724
|
-
renderTemplate(
|
|
1426
|
+
for (const path4 of readdirSync3(source)) {
|
|
1427
|
+
renderTemplate(resolve5(source, path4), resolve5(destination, path4));
|
|
1725
1428
|
}
|
|
1726
1429
|
}
|
|
1727
1430
|
function renderFile(source, destination) {
|
|
1728
1431
|
const filename = basename2(source);
|
|
1729
1432
|
if (filename.startsWith("_")) {
|
|
1730
|
-
destination =
|
|
1433
|
+
destination = resolve5(dirname2(destination), filename.replace("_", "."));
|
|
1731
1434
|
}
|
|
1732
1435
|
if (filename === "package.json") {
|
|
1733
1436
|
mergePkg(source, destination);
|
|
@@ -1754,13 +1457,13 @@ import path from "node:path";
|
|
|
1754
1457
|
import { spawnSync } from "node:child_process";
|
|
1755
1458
|
import fs from "node:fs";
|
|
1756
1459
|
|
|
1757
|
-
// node_modules/.pnpm/package-manager-detector@1.
|
|
1758
|
-
function
|
|
1460
|
+
// node_modules/.pnpm/package-manager-detector@1.3.0/node_modules/package-manager-detector/dist/commands.mjs
|
|
1461
|
+
function dashDashArg(agent, agentCommand) {
|
|
1759
1462
|
return (args) => {
|
|
1760
1463
|
if (args.length > 1) {
|
|
1761
|
-
return [agent,
|
|
1464
|
+
return [agent, agentCommand, args[0], "--", ...args.slice(1)];
|
|
1762
1465
|
} else {
|
|
1763
|
-
return [agent,
|
|
1466
|
+
return [agent, agentCommand, args[0]];
|
|
1764
1467
|
}
|
|
1765
1468
|
};
|
|
1766
1469
|
}
|
|
@@ -1771,7 +1474,7 @@ function denoExecute() {
|
|
|
1771
1474
|
}
|
|
1772
1475
|
var npm = {
|
|
1773
1476
|
"agent": ["npm", 0],
|
|
1774
|
-
"run":
|
|
1477
|
+
"run": dashDashArg("npm", "run"),
|
|
1775
1478
|
"install": ["npm", "i", 0],
|
|
1776
1479
|
"frozen": ["npm", "ci", 0],
|
|
1777
1480
|
"global": ["npm", "i", "-g", 0],
|
|
@@ -1793,7 +1496,7 @@ var yarn2 = {
|
|
|
1793
1496
|
"upgrade": ["yarn", "upgrade", 0],
|
|
1794
1497
|
"upgrade-interactive": ["yarn", "upgrade-interactive", 0],
|
|
1795
1498
|
"execute": ["npx", 0],
|
|
1796
|
-
"execute-local":
|
|
1499
|
+
"execute-local": dashDashArg("yarn", "exec"),
|
|
1797
1500
|
"uninstall": ["yarn", "remove", 0],
|
|
1798
1501
|
"global_uninstall": ["yarn", "global", "remove", 0]
|
|
1799
1502
|
};
|
|
@@ -1858,7 +1561,7 @@ var COMMANDS = {
|
|
|
1858
1561
|
// pnpm v6.x or below
|
|
1859
1562
|
"pnpm@6": {
|
|
1860
1563
|
...pnpm2,
|
|
1861
|
-
run:
|
|
1564
|
+
run: dashDashArg("pnpm", "run")
|
|
1862
1565
|
},
|
|
1863
1566
|
"bun": bun,
|
|
1864
1567
|
"deno": deno
|
|
@@ -1907,7 +1610,7 @@ function addPackageObject(key, entry, pkg, sort = true) {
|
|
|
1907
1610
|
for (const [name, value] of entry) {
|
|
1908
1611
|
entries.push([name, value]);
|
|
1909
1612
|
}
|
|
1910
|
-
for (const [k, v] of entries.
|
|
1613
|
+
for (const [k, v] of entries.toSorted(([a], [b]) => a.localeCompare(b))) {
|
|
1911
1614
|
pkg[key][k] = v;
|
|
1912
1615
|
}
|
|
1913
1616
|
}
|
|
@@ -1936,8 +1639,8 @@ function editFile(file, callback, destination) {
|
|
|
1936
1639
|
const content = fs.readFileSync(file, "utf8");
|
|
1937
1640
|
fs.writeFileSync(destination ?? file, callback(content), "utf8");
|
|
1938
1641
|
}
|
|
1939
|
-
function getPaths(rootPath, templateDir
|
|
1940
|
-
return
|
|
1642
|
+
function getPaths(rootPath, templateDir) {
|
|
1643
|
+
return [path.join(rootPath, "app"), templateDir];
|
|
1941
1644
|
}
|
|
1942
1645
|
|
|
1943
1646
|
// src/utils/nuxt/versions.ts
|
|
@@ -1954,7 +1657,7 @@ var versions = {
|
|
|
1954
1657
|
"@nuxt/fonts": "^0.11.4"
|
|
1955
1658
|
};
|
|
1956
1659
|
|
|
1957
|
-
// node_modules/.pnpm/package-manager-detector@1.
|
|
1660
|
+
// node_modules/.pnpm/package-manager-detector@1.3.0/node_modules/package-manager-detector/dist/constants.mjs
|
|
1958
1661
|
var AGENTS = [
|
|
1959
1662
|
"npm",
|
|
1960
1663
|
"yarn",
|
|
@@ -1990,7 +1693,7 @@ var INSTALL_METADATA = {
|
|
|
1990
1693
|
"bun.lockb": "bun"
|
|
1991
1694
|
};
|
|
1992
1695
|
|
|
1993
|
-
// node_modules/.pnpm/package-manager-detector@1.
|
|
1696
|
+
// node_modules/.pnpm/package-manager-detector@1.3.0/node_modules/package-manager-detector/dist/detect.mjs
|
|
1994
1697
|
import fs2 from "node:fs/promises";
|
|
1995
1698
|
import path2 from "node:path";
|
|
1996
1699
|
import process3 from "node:process";
|
|
@@ -2014,7 +1717,18 @@ async function parsePackageJson(filepath, onUnknown) {
|
|
|
2014
1717
|
return !filepath || !pathExists(filepath, "file") ? null : await handlePackageManager(filepath, onUnknown);
|
|
2015
1718
|
}
|
|
2016
1719
|
async function detect(options = {}) {
|
|
2017
|
-
const {
|
|
1720
|
+
const {
|
|
1721
|
+
cwd: cwd2,
|
|
1722
|
+
strategies = ["lockfile", "packageManager-field", "devEngines-field"],
|
|
1723
|
+
onUnknown
|
|
1724
|
+
} = options;
|
|
1725
|
+
let stopDir;
|
|
1726
|
+
if (typeof options.stopDir === "string") {
|
|
1727
|
+
const resolved = path2.resolve(options.stopDir);
|
|
1728
|
+
stopDir = (dir) => dir === resolved;
|
|
1729
|
+
} else {
|
|
1730
|
+
stopDir = options.stopDir;
|
|
1731
|
+
}
|
|
2018
1732
|
for (const directory of lookup(cwd2)) {
|
|
2019
1733
|
for (const strategy of strategies) {
|
|
2020
1734
|
switch (strategy) {
|
|
@@ -2051,6 +1765,8 @@ async function detect(options = {}) {
|
|
|
2051
1765
|
}
|
|
2052
1766
|
}
|
|
2053
1767
|
}
|
|
1768
|
+
if (stopDir?.(directory))
|
|
1769
|
+
break;
|
|
2054
1770
|
}
|
|
2055
1771
|
return null;
|
|
2056
1772
|
}
|
|
@@ -2107,13 +1823,12 @@ async function renderNuxtTemplate(ctx) {
|
|
|
2107
1823
|
cwd: cwd2,
|
|
2108
1824
|
projectName,
|
|
2109
1825
|
projectRoot,
|
|
2110
|
-
useNuxtV4Compat,
|
|
2111
1826
|
nuxtPreset
|
|
2112
1827
|
} = ctx;
|
|
2113
1828
|
const pkgInfo = detectPkgInfo();
|
|
2114
1829
|
const pkgManager = pkgInfo ? pkgInfo.name : "npm";
|
|
2115
1830
|
const isYarn1 = pkgManager === "yarn" && pkgInfo?.version.startsWith("1.");
|
|
2116
|
-
const customCommand =
|
|
1831
|
+
const customCommand = `npm exec nuxi init ${projectName}`;
|
|
2117
1832
|
const fullCustomCommand = customCommand.replace("@latest", () => isYarn1 ? "" : "@latest").replace(/^npm exec/, () => {
|
|
2118
1833
|
if (pkgManager === "pnpm") {
|
|
2119
1834
|
return "pnpm dlx";
|
|
@@ -2157,8 +1872,7 @@ function configurePackageJson({
|
|
|
2157
1872
|
["typecheck", "nuxt typecheck"]
|
|
2158
1873
|
];
|
|
2159
1874
|
if (nuxtPreset !== "nuxt-default") {
|
|
2160
|
-
scripts.push(["lint", "eslint ."]);
|
|
2161
|
-
scripts.push(["lint:fix", "eslint . --fix"]);
|
|
1875
|
+
scripts.push(["lint", "eslint ."], ["lint:fix", "eslint . --fix"]);
|
|
2162
1876
|
}
|
|
2163
1877
|
const dependencies = [
|
|
2164
1878
|
["vuetify", versions.vuetify]
|
|
@@ -2176,9 +1890,7 @@ function configurePackageJson({
|
|
|
2176
1890
|
if (useNuxtModule) {
|
|
2177
1891
|
devDependencies.push(["vuetify-nuxt-module", versions["vuetify-nuxt-module"]]);
|
|
2178
1892
|
} else {
|
|
2179
|
-
devDependencies.push(["upath", versions["upath"]]);
|
|
2180
|
-
devDependencies.push(["@vuetify/loader-shared", versions["@vuetify/loader-shared"]]);
|
|
2181
|
-
devDependencies.push(["vite-plugin-vuetify", versions["vite-plugin-vuetify"]]);
|
|
1893
|
+
devDependencies.push(["upath", versions["upath"]], ["@vuetify/loader-shared", versions["@vuetify/loader-shared"]], ["vite-plugin-vuetify", versions["vite-plugin-vuetify"]]);
|
|
2182
1894
|
}
|
|
2183
1895
|
if (devDependencies.length > 0) {
|
|
2184
1896
|
addPackageObject("devDependencies", devDependencies, pkg);
|
|
@@ -2201,8 +1913,7 @@ function configureVuetify(ctx, nuxtConfig) {
|
|
|
2201
1913
|
};
|
|
2202
1914
|
config.css = [];
|
|
2203
1915
|
if (!ctx.useNuxtModule) {
|
|
2204
|
-
config.css.push("@mdi/font/css/materialdesignicons.css");
|
|
2205
|
-
config.css.push("vuetify/styles");
|
|
1916
|
+
config.css.push("@mdi/font/css/materialdesignicons.css", "vuetify/styles");
|
|
2206
1917
|
}
|
|
2207
1918
|
addNuxtModule(nuxtConfig, "@nuxt/fonts");
|
|
2208
1919
|
return config;
|
|
@@ -2210,7 +1921,6 @@ function configureVuetify(ctx, nuxtConfig) {
|
|
|
2210
1921
|
function copyResources(ctx, rootPath, templateDir) {
|
|
2211
1922
|
const {
|
|
2212
1923
|
useNuxtSSR,
|
|
2213
|
-
useNuxtV4Compat,
|
|
2214
1924
|
nuxtPreset,
|
|
2215
1925
|
useNuxtModule,
|
|
2216
1926
|
templateRoot
|
|
@@ -2239,14 +1949,14 @@ function copyResources(ctx, rootPath, templateDir) {
|
|
|
2239
1949
|
if (useNuxtModule) {
|
|
2240
1950
|
fs3.copyFileSync(
|
|
2241
1951
|
path3.join(templateDir, "vuetify.config.ts"),
|
|
2242
|
-
path3.join(rootPath,
|
|
1952
|
+
path3.join(rootPath, "../vuetify.config.ts")
|
|
2243
1953
|
);
|
|
2244
1954
|
fs3.copyFileSync(
|
|
2245
1955
|
path3.join(templatePluginsDir, "vuetify-nuxt.ts"),
|
|
2246
1956
|
path3.join(pluginsDir, "vuetify.ts")
|
|
2247
1957
|
);
|
|
2248
1958
|
} else {
|
|
2249
|
-
const modulesDir = path3.join(rootPath,
|
|
1959
|
+
const modulesDir = path3.join(rootPath, "../modules");
|
|
2250
1960
|
const templateModulesDir = path3.join(templateDir, "modules");
|
|
2251
1961
|
fs3.mkdirSync(modulesDir);
|
|
2252
1962
|
fs3.copyFileSync(
|
|
@@ -2326,11 +2036,10 @@ function prepareProject(ctx) {
|
|
|
2326
2036
|
const {
|
|
2327
2037
|
projectRoot,
|
|
2328
2038
|
templatePath,
|
|
2329
|
-
useNuxtV4Compat,
|
|
2330
2039
|
useNuxtModule
|
|
2331
2040
|
} = ctx;
|
|
2332
|
-
const [rootPath, templateDir] = getPaths(projectRoot, templatePath
|
|
2333
|
-
const nuxtConfigFile = path3.join(rootPath,
|
|
2041
|
+
const [rootPath, templateDir] = getPaths(projectRoot, templatePath);
|
|
2042
|
+
const nuxtConfigFile = path3.join(rootPath, "../nuxt.config.ts");
|
|
2334
2043
|
const nuxtConfig = parseModule(fs3.readFileSync(nuxtConfigFile, "utf8"));
|
|
2335
2044
|
if (useNuxtModule) {
|
|
2336
2045
|
prepareNuxtModule(ctx, nuxtConfig);
|
|
@@ -2372,30 +2081,51 @@ function prepareProject(ctx) {
|
|
|
2372
2081
|
}
|
|
2373
2082
|
|
|
2374
2083
|
// src/index.ts
|
|
2375
|
-
var validPresets = ["base", "custom", "default", "essentials"];
|
|
2376
2084
|
async function run() {
|
|
2377
|
-
const
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2085
|
+
const args = process.argv.slice(2).slice();
|
|
2086
|
+
const banner = createBanner();
|
|
2087
|
+
if (args.length === 0) {
|
|
2088
|
+
console.log(`
|
|
2089
|
+
${banner}
|
|
2090
|
+
`);
|
|
2091
|
+
const initialContext2 = {
|
|
2092
|
+
canOverwrite: false,
|
|
2093
|
+
cwd: process.cwd(),
|
|
2094
|
+
projectName: "vuetify-project"
|
|
2095
|
+
};
|
|
2096
|
+
const finalContext2 = await initPrompts(initialContext2);
|
|
2097
|
+
await createProject(finalContext2);
|
|
2098
|
+
return;
|
|
2099
|
+
}
|
|
2100
|
+
const cliOptions = parseCliArgs(args);
|
|
2101
|
+
if (cliOptions.help) {
|
|
2102
|
+
console.log(getHelpText());
|
|
2103
|
+
process.exit(0);
|
|
2104
|
+
}
|
|
2105
|
+
if (cliOptions.version) {
|
|
2106
|
+
console.log(getVersionText());
|
|
2107
|
+
process.exit(0);
|
|
2384
2108
|
}
|
|
2385
|
-
const banner = "\x1B[38;2;22;151;246mV\x1B[39m\x1B[38;2;22;147;242mu\x1B[39m\x1B[38;2;22;144;238me\x1B[39m\x1B[38;2;22;140;234mt\x1B[39m\x1B[38;2;23;136;229mi\x1B[39m\x1B[38;2;23;133;225mf\x1B[39m\x1B[38;2;23;129;221my\x1B[39m\x1B[38;2;23;125;217m.\x1B[39m\x1B[38;2;23;121;213mj\x1B[39m\x1B[38;2;23;118;209ms\x1B[39m \x1B[38;2;24;114;204m-\x1B[39m \x1B[38;2;24;110;200mM\x1B[39m\x1B[38;2;24;107;196ma\x1B[39m\x1B[38;2;24;103;192mt\x1B[39m\x1B[38;2;32;110;197me\x1B[39m\x1B[38;2;39;118;202mr\x1B[39m\x1B[38;2;47;125;207mi\x1B[39m\x1B[38;2;54;132;211ma\x1B[39m\x1B[38;2;62;140;216ml\x1B[39m \x1B[38;2;70;147;221mC\x1B[39m\x1B[38;2;77;154;226mo\x1B[39m\x1B[38;2;85;161;231mm\x1B[39m\x1B[38;2;93;169;236mp\x1B[39m\x1B[38;2;100;176;240mo\x1B[39m\x1B[38;2;108;183;245mn\x1B[39m\x1B[38;2;115;191;250me\x1B[39m\x1B[38;2;123;198;255mn\x1B[39m\x1B[38;2;126;199;255mt\x1B[39m \x1B[38;2;129;201;255mF\x1B[39m\x1B[38;2;133;202;255mr\x1B[39m\x1B[38;2;136;204;255ma\x1B[39m\x1B[38;2;139;205;255mm\x1B[39m\x1B[38;2;142;207;255me\x1B[39m\x1B[38;2;145;208;255mw\x1B[39m\x1B[38;2;149;210;255mo\x1B[39m\x1B[38;2;152;211;255mr\x1B[39m\x1B[38;2;155;212;255mk\x1B[39m \x1B[38;2;158;214;255mf\x1B[39m\x1B[38;2;161;215;255mo\x1B[39m\x1B[38;2;164;217;255mr\x1B[39m \x1B[38;2;168;218;255mV\x1B[39m\x1B[38;2;171;220;255mu\x1B[39m\x1B[38;2;174;221;255me\x1B[39m";
|
|
2386
2109
|
console.log(`
|
|
2387
2110
|
${banner}
|
|
2388
2111
|
`);
|
|
2389
|
-
const
|
|
2390
|
-
|
|
2391
|
-
cwd:
|
|
2392
|
-
projectName:
|
|
2393
|
-
|
|
2394
|
-
useTypeScript:
|
|
2395
|
-
usePreset:
|
|
2396
|
-
|
|
2397
|
-
|
|
2112
|
+
const cliContext = cliOptionsToContext(cliOptions, process.cwd());
|
|
2113
|
+
const initialContext = {
|
|
2114
|
+
cwd: cliContext.cwd,
|
|
2115
|
+
projectName: cliContext.projectName,
|
|
2116
|
+
canOverwrite: cliContext.canOverwrite,
|
|
2117
|
+
useTypeScript: cliContext.useTypeScript,
|
|
2118
|
+
usePreset: cliContext.usePreset,
|
|
2119
|
+
usePackageManager: cliContext.usePackageManager,
|
|
2120
|
+
installDependencies: cliContext.installDependencies,
|
|
2121
|
+
useNuxtModule: cliContext.useNuxtModule,
|
|
2122
|
+
useNuxtSSR: cliContext.useNuxtSSR,
|
|
2123
|
+
useNuxtSSRClientHints: cliContext.useNuxtSSRClientHints
|
|
2398
2124
|
};
|
|
2125
|
+
const finalContext = resolveNonInteractiveContext(initialContext);
|
|
2126
|
+
await createProject(finalContext);
|
|
2127
|
+
}
|
|
2128
|
+
async function createProject(finalContext) {
|
|
2399
2129
|
const {
|
|
2400
2130
|
canOverwrite,
|
|
2401
2131
|
cwd: cwd2,
|
|
@@ -2404,19 +2134,18 @@ ${banner}
|
|
|
2404
2134
|
usePackageManager,
|
|
2405
2135
|
installDependencies: installDeps,
|
|
2406
2136
|
usePreset,
|
|
2407
|
-
useNuxtV4Compat,
|
|
2408
2137
|
useNuxtModule,
|
|
2409
2138
|
useNuxtSSR,
|
|
2410
2139
|
useNuxtSSRClientHints
|
|
2411
|
-
} =
|
|
2412
|
-
const projectRoot =
|
|
2413
|
-
if (canOverwrite) {
|
|
2140
|
+
} = finalContext;
|
|
2141
|
+
const projectRoot = join4(cwd2, projectName);
|
|
2142
|
+
if (canOverwrite && existsSync5(projectRoot)) {
|
|
2414
2143
|
rmSync(projectRoot, { recursive: true });
|
|
2415
2144
|
}
|
|
2416
|
-
const preset =
|
|
2145
|
+
const preset = finalContext.usePreset ?? usePreset;
|
|
2417
2146
|
if (preset.startsWith("nuxt-")) {
|
|
2418
|
-
const templateRoot =
|
|
2419
|
-
const templatePath =
|
|
2147
|
+
const templateRoot = resolve6(dirname3(fileURLToPath(import.meta.url)), "../template/typescript");
|
|
2148
|
+
const templatePath = resolve6(dirname3(fileURLToPath(import.meta.url)), "../template/typescript/nuxt");
|
|
2420
2149
|
await renderNuxtTemplate({
|
|
2421
2150
|
cwd: cwd2,
|
|
2422
2151
|
projectName,
|
|
@@ -2424,23 +2153,22 @@ ${banner}
|
|
|
2424
2153
|
templateRoot,
|
|
2425
2154
|
templatePath,
|
|
2426
2155
|
nuxtPreset: preset,
|
|
2427
|
-
useNuxtV4Compat,
|
|
2428
2156
|
useNuxtModule,
|
|
2429
2157
|
useNuxtSSR,
|
|
2430
2158
|
useNuxtSSRClientHints
|
|
2431
2159
|
});
|
|
2432
2160
|
} else {
|
|
2433
2161
|
mkdirSync2(projectRoot);
|
|
2434
|
-
writeFileSync2(
|
|
2162
|
+
writeFileSync2(resolve6(projectRoot, "package.json"), JSON.stringify({ name: projectName }, null, 2));
|
|
2435
2163
|
console.log("\n\u25CC Generating scaffold...");
|
|
2436
2164
|
const jsOrTs = useTypeScript ? "typescript" : "javascript";
|
|
2437
|
-
const templatePath =
|
|
2438
|
-
renderTemplate(
|
|
2165
|
+
const templatePath = resolve6(dirname3(fileURLToPath(import.meta.url)), "../template", jsOrTs);
|
|
2166
|
+
renderTemplate(resolve6(templatePath, "default"), projectRoot);
|
|
2439
2167
|
if (["base", "essentials"].includes(usePreset)) {
|
|
2440
|
-
renderTemplate(
|
|
2168
|
+
renderTemplate(resolve6(templatePath, "base"), projectRoot);
|
|
2441
2169
|
}
|
|
2442
2170
|
if (["essentials", "recommended"].includes(usePreset)) {
|
|
2443
|
-
renderTemplate(
|
|
2171
|
+
renderTemplate(resolve6(templatePath, "essentials"), projectRoot);
|
|
2444
2172
|
}
|
|
2445
2173
|
if (usePackageManager && installDeps) {
|
|
2446
2174
|
console.log(`\u25CC Installing dependencies with ${usePackageManager}...
|
|
@@ -2459,7 +2187,7 @@ run().then(() => {
|
|
|
2459
2187
|
process.exit(0);
|
|
2460
2188
|
}).catch((error) => {
|
|
2461
2189
|
console.error(`
|
|
2462
|
-
${
|
|
2190
|
+
${red3("\u2716")} ${error}
|
|
2463
2191
|
`);
|
|
2464
2192
|
process.exit(1);
|
|
2465
2193
|
});
|