create-vuetify 2.2.5 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +713 -84
- package/package.json +7 -3
- package/template/javascript/base/eslint.config.js +23 -0
- package/template/javascript/base/package.json +7 -10
- package/template/javascript/base/src/router/index.js +21 -0
- package/template/javascript/base/vite.config.mjs +7 -0
- package/template/javascript/default/index.html +10 -13
- package/template/javascript/default/package.json +10 -7
- package/template/javascript/default/src/components/AppFooter.vue +2 -2
- package/template/javascript/default/vite.config.mjs +7 -0
- package/template/javascript/essentials/_eslintrc-auto-import.json +72 -0
- package/template/javascript/essentials/package.json +1 -1
- package/template/javascript/essentials/src/router/index.js +21 -1
- package/template/javascript/essentials/vite.config.mjs +7 -0
- package/template/typescript/base/env.d.ts +2 -0
- package/template/typescript/base/eslint.config.js +36 -0
- package/template/typescript/base/package.json +8 -12
- package/template/typescript/base/src/router/index.ts +21 -0
- package/template/typescript/base/vite.config.mts +7 -0
- package/template/typescript/default/_editorconfig +4 -3
- package/template/typescript/default/env.d.ts +1 -0
- package/template/typescript/default/index.html +7 -10
- package/template/typescript/default/package.json +21 -13
- package/template/typescript/default/tsconfig.app.json +14 -0
- package/template/typescript/default/tsconfig.json +8 -28
- package/template/typescript/default/tsconfig.node.json +14 -4
- package/template/typescript/default/vite.config.mts +7 -0
- package/template/typescript/essentials/_eslintrc-auto-import.json +69 -0
- package/template/typescript/essentials/env.d.ts +3 -0
- package/template/typescript/essentials/package.json +1 -1
- package/template/typescript/essentials/src/components/AppFooter.vue +2 -2
- package/template/typescript/essentials/src/router/index.ts +21 -1
- package/template/typescript/essentials/vite.config.mts +7 -0
- package/template/typescript/nuxt/app-layout.vue +5 -0
- package/template/typescript/nuxt/app.vue +9 -0
- package/template/typescript/nuxt/components/AppFooter.vue +79 -0
- package/template/typescript/nuxt/components/HelloWorld.vue +153 -0
- package/template/typescript/nuxt/layouts/default.vue +9 -0
- package/template/typescript/nuxt/modules/vuetify.ts +125 -0
- package/template/typescript/nuxt/pages/index.vue +8 -0
- package/template/typescript/nuxt/plugins/vuetify-nuxt.ts +8 -0
- package/template/typescript/nuxt/plugins/vuetify.ts +14 -0
- package/template/typescript/nuxt/vuetify.config.ts +8 -0
- package/dist/output.cjs +0 -264
- package/template/javascript/base/_eslintrc.js +0 -10
- package/template/typescript/base/_eslintrc.js +0 -20
- package/template/typescript/base/tsconfig.json +0 -32
- package/template/typescript/default/src/vite-env.d.ts +0 -7
- package/template/typescript/essentials/tsconfig.json +0 -33
package/dist/index.mjs
CHANGED
|
@@ -23,91 +23,153 @@ var essentialsContext = {
|
|
|
23
23
|
useStore: true
|
|
24
24
|
};
|
|
25
25
|
var presets = {
|
|
26
|
-
base: baseContext,
|
|
27
|
-
default: defaultContext,
|
|
28
|
-
essentials: essentialsContext
|
|
26
|
+
"base": baseContext,
|
|
27
|
+
"default": defaultContext,
|
|
28
|
+
"essentials": essentialsContext,
|
|
29
|
+
"nuxt-base": baseContext,
|
|
30
|
+
"nuxt-default": defaultContext,
|
|
31
|
+
"nuxt-essentials": essentialsContext
|
|
29
32
|
};
|
|
30
33
|
|
|
31
34
|
// src/utils/prompts.ts
|
|
32
35
|
import { red } from "kolorist";
|
|
33
36
|
import prompts from "prompts";
|
|
34
37
|
import validate from "validate-npm-package-name";
|
|
35
|
-
var promptQuestions = (context) => [
|
|
36
|
-
{
|
|
37
|
-
name: "projectName",
|
|
38
|
-
type: "text",
|
|
39
|
-
message: "Project name:",
|
|
40
|
-
initial: "vuetify-project",
|
|
41
|
-
validate: (v) => {
|
|
42
|
-
const { errors } = validate(String(v).trim());
|
|
43
|
-
return !(errors && errors.length) || `Package ${errors[0]}`;
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
name: "canOverwrite",
|
|
48
|
-
active: "Yes",
|
|
49
|
-
inactive: "No",
|
|
50
|
-
initial: false,
|
|
51
|
-
type: (_, { projectName }) => {
|
|
52
|
-
const projectPath = join(context.cwd, projectName);
|
|
53
|
-
return !existsSync(projectPath) || readdirSync(projectPath).length === 0 ? null : "toggle";
|
|
54
|
-
},
|
|
55
|
-
message: (prev) => `The project path: ${resolve(context.cwd, prev)} already exists, would you like to overwrite this directory?`
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
name: "usePreset",
|
|
59
|
-
type: context.usePreset ? null : "select",
|
|
60
|
-
message: "Which preset would you like to install?",
|
|
61
|
-
initial: 0,
|
|
62
|
-
choices: [
|
|
63
|
-
{ title: "Default (Vuetify)", value: "default" },
|
|
64
|
-
{ title: "Base (Default, Routing)", value: "base" },
|
|
65
|
-
{ title: "Essentials (Base, Layouts, Pinia)", value: "essentials" }
|
|
66
|
-
]
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
name: "useTypeScript",
|
|
70
|
-
type: context.useTypeScript ? null : "toggle",
|
|
71
|
-
message: "Use TypeScript?",
|
|
72
|
-
active: "Yes",
|
|
73
|
-
inactive: "No",
|
|
74
|
-
initial: false
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
name: "usePackageManager",
|
|
78
|
-
type: "select",
|
|
79
|
-
message: "Would you like to install dependencies with yarn, npm, pnpm, or bun?",
|
|
80
|
-
initial: 0,
|
|
81
|
-
choices: [
|
|
82
|
-
{ title: "yarn", value: "yarn" },
|
|
83
|
-
{ title: "npm", value: "npm" },
|
|
84
|
-
{ title: "pnpm", value: "pnpm" },
|
|
85
|
-
{ title: "bun", value: "bun" },
|
|
86
|
-
{ title: "none", value: null }
|
|
87
|
-
]
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
name: "installDependencies",
|
|
91
|
-
type: context.installDependencies ? null : "toggle",
|
|
92
|
-
message: "Install Dependencies?",
|
|
93
|
-
active: "Yes",
|
|
94
|
-
inactive: "No",
|
|
95
|
-
initial: "Yes"
|
|
96
|
-
}
|
|
97
|
-
];
|
|
98
38
|
var promptOptions = {
|
|
99
39
|
onCancel: () => {
|
|
100
40
|
throw new Error(red("\u2716") + " Operation cancelled");
|
|
101
41
|
}
|
|
102
42
|
};
|
|
103
43
|
var initPrompts = async (context) => {
|
|
44
|
+
let answers;
|
|
104
45
|
if (context.usePreset) {
|
|
105
46
|
context = {
|
|
106
47
|
...context,
|
|
107
48
|
...presets[context.usePreset]
|
|
108
49
|
};
|
|
109
50
|
}
|
|
110
|
-
|
|
51
|
+
answers = await prompts([
|
|
52
|
+
{
|
|
53
|
+
name: "projectName",
|
|
54
|
+
type: "text",
|
|
55
|
+
message: "Project name:",
|
|
56
|
+
initial: "vuetify-project",
|
|
57
|
+
validate: (v) => {
|
|
58
|
+
const { errors } = validate(String(v).trim());
|
|
59
|
+
return !(errors && errors.length) || `Package ${errors[0]}`;
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: "canOverwrite",
|
|
64
|
+
active: "Yes",
|
|
65
|
+
inactive: "No",
|
|
66
|
+
initial: false,
|
|
67
|
+
type: (_, { projectName }) => {
|
|
68
|
+
const projectPath = join(context.cwd, projectName);
|
|
69
|
+
return !existsSync(projectPath) || readdirSync(projectPath).length === 0 ? null : "toggle";
|
|
70
|
+
},
|
|
71
|
+
message: (prev) => `The project path: ${resolve(context.cwd, prev)} already exists, would you like to overwrite this directory?`
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: "usePreset",
|
|
75
|
+
type: context.usePreset ? null : "select",
|
|
76
|
+
message: "Which preset would you like to install?",
|
|
77
|
+
initial: 1,
|
|
78
|
+
choices: [
|
|
79
|
+
{ title: "Barebones (Only Vue & Vuetify)", value: "default" },
|
|
80
|
+
{ title: "Default (Adds routing, ESLint & SASS variables)", value: "base" },
|
|
81
|
+
{ title: "Recommended (Everything from Default. Adds auto importing, layouts & pinia)", value: "essentials" },
|
|
82
|
+
{ title: "Nuxt Barebones (Only Vuetify)", value: "nuxt-default" },
|
|
83
|
+
{ title: "Nuxt Default (Adds Nuxt ESLint & SASS variables)", value: "nuxt-base" },
|
|
84
|
+
{ title: "Nuxt Recommended (Everything from Default. Enables auto importing & layouts)", value: "nuxt-essentials" }
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: "useTypeScript",
|
|
89
|
+
type: (usePreset) => {
|
|
90
|
+
const p = context.usePreset ?? usePreset;
|
|
91
|
+
return p.startsWith("nuxt-") || context.useTypeScript ? null : "toggle";
|
|
92
|
+
},
|
|
93
|
+
message: "Use TypeScript?",
|
|
94
|
+
active: "Yes",
|
|
95
|
+
inactive: "No",
|
|
96
|
+
initial: false
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: "usePackageManager",
|
|
100
|
+
type: (_, { usePreset }) => {
|
|
101
|
+
const p = context.usePreset ?? usePreset;
|
|
102
|
+
return p.startsWith("nuxt-") ? null : "select";
|
|
103
|
+
},
|
|
104
|
+
message: "Would you like to install dependencies with yarn, npm, pnpm, or bun?",
|
|
105
|
+
initial: 0,
|
|
106
|
+
choices: [
|
|
107
|
+
{ title: "yarn", value: "yarn" },
|
|
108
|
+
{ title: "npm", value: "npm" },
|
|
109
|
+
{ title: "pnpm", value: "pnpm" },
|
|
110
|
+
{ title: "bun", value: "bun" },
|
|
111
|
+
{ title: "none", value: null }
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: "installDependencies",
|
|
116
|
+
type: (_, { usePreset }) => {
|
|
117
|
+
const p = context.usePreset ?? usePreset;
|
|
118
|
+
return p.startsWith("nuxt-") || context.installDependencies ? null : "toggle";
|
|
119
|
+
},
|
|
120
|
+
message: "Install Dependencies?",
|
|
121
|
+
active: "Yes",
|
|
122
|
+
inactive: "No",
|
|
123
|
+
initial: "Yes"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: "useNuxtV4Compat",
|
|
127
|
+
type: (_, { usePreset }) => {
|
|
128
|
+
const p = context.usePreset ?? usePreset;
|
|
129
|
+
return p.startsWith("nuxt-") ? "toggle" : null;
|
|
130
|
+
},
|
|
131
|
+
message: "Use Nuxt v4 compatibility?",
|
|
132
|
+
active: "Yes",
|
|
133
|
+
inactive: "No",
|
|
134
|
+
initial: "Yes"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: "useNuxtModule",
|
|
138
|
+
type: (_, { usePreset }) => {
|
|
139
|
+
const p = context.usePreset ?? usePreset;
|
|
140
|
+
return p.startsWith("nuxt-") ? "toggle" : null;
|
|
141
|
+
},
|
|
142
|
+
message: "Use vuetify-nuxt-module?",
|
|
143
|
+
active: "Yes",
|
|
144
|
+
inactive: "No",
|
|
145
|
+
initial: "Yes"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: "useNuxtSSR",
|
|
149
|
+
type: (_, { usePreset }) => {
|
|
150
|
+
const p = context.usePreset ?? usePreset;
|
|
151
|
+
return p.startsWith("nuxt-") ? "toggle" : null;
|
|
152
|
+
},
|
|
153
|
+
message: "Enable Nuxt SSR?",
|
|
154
|
+
active: "Yes",
|
|
155
|
+
inactive: "No",
|
|
156
|
+
initial: "Yes"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
name: "useNuxtSSRClientHints",
|
|
160
|
+
type: (useNuxtSSR, { usePreset, useNuxtModule }) => {
|
|
161
|
+
const p = context.usePreset ?? usePreset;
|
|
162
|
+
if (!p.startsWith("nuxt-")) {
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
return useNuxtModule && useNuxtSSR ? "toggle" : null;
|
|
166
|
+
},
|
|
167
|
+
message: "Enable Nuxt SSR Http Client Hints?",
|
|
168
|
+
active: "Yes",
|
|
169
|
+
inactive: "No",
|
|
170
|
+
initial: "Yes"
|
|
171
|
+
}
|
|
172
|
+
], promptOptions);
|
|
111
173
|
return {
|
|
112
174
|
...context,
|
|
113
175
|
...answers
|
|
@@ -166,7 +228,7 @@ function mergePkg(source, destination) {
|
|
|
166
228
|
}
|
|
167
229
|
function renderDirectory(source, destination) {
|
|
168
230
|
mkdirSync(destination, { recursive: true });
|
|
169
|
-
readdirSync2(source).forEach((
|
|
231
|
+
readdirSync2(source).forEach((path4) => renderTemplate(resolve2(source, path4), resolve2(destination, path4)));
|
|
170
232
|
}
|
|
171
233
|
function renderFile(source, destination) {
|
|
172
234
|
const filename = basename(source);
|
|
@@ -185,6 +247,548 @@ function renderTemplate(source, destination) {
|
|
|
185
247
|
}
|
|
186
248
|
}
|
|
187
249
|
|
|
250
|
+
// src/utils/nuxt/renderNuxtTemplate.ts
|
|
251
|
+
import fs3 from "fs";
|
|
252
|
+
import path3 from "path";
|
|
253
|
+
import { spawnSync as spawnSync3 } from "child_process";
|
|
254
|
+
|
|
255
|
+
// src/utils/nuxt/utils.ts
|
|
256
|
+
import process2 from "process";
|
|
257
|
+
import path from "path";
|
|
258
|
+
import { spawnSync as spawnSync2 } from "child_process";
|
|
259
|
+
import fs from "fs";
|
|
260
|
+
|
|
261
|
+
// node_modules/.pnpm/package-manager-detector@0.2.2/node_modules/package-manager-detector/dist/commands.mjs
|
|
262
|
+
function npmRun(agent) {
|
|
263
|
+
return (args) => {
|
|
264
|
+
if (args.length > 1) {
|
|
265
|
+
return [agent, "run", args[0], "--", ...args.slice(1)];
|
|
266
|
+
} else {
|
|
267
|
+
return [agent, "run", args[0]];
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
var yarn = {
|
|
272
|
+
"agent": ["yarn", 0],
|
|
273
|
+
"run": ["yarn", "run", 0],
|
|
274
|
+
"install": ["yarn", "install", 0],
|
|
275
|
+
"frozen": ["yarn", "install", "--frozen-lockfile"],
|
|
276
|
+
"global": ["yarn", "global", "add", 0],
|
|
277
|
+
"add": ["yarn", "add", 0],
|
|
278
|
+
"upgrade": ["yarn", "upgrade", 0],
|
|
279
|
+
"upgrade-interactive": ["yarn", "upgrade-interactive", 0],
|
|
280
|
+
"execute": ["npx", 0],
|
|
281
|
+
"execute-local": ["yarn", "exec", 0],
|
|
282
|
+
"uninstall": ["yarn", "remove", 0],
|
|
283
|
+
"global_uninstall": ["yarn", "global", "remove", 0]
|
|
284
|
+
};
|
|
285
|
+
var pnpm = {
|
|
286
|
+
"agent": ["pnpm", 0],
|
|
287
|
+
"run": ["pnpm", "run", 0],
|
|
288
|
+
"install": ["pnpm", "i", 0],
|
|
289
|
+
"frozen": ["pnpm", "i", "--frozen-lockfile"],
|
|
290
|
+
"global": ["pnpm", "add", "-g", 0],
|
|
291
|
+
"add": ["pnpm", "add", 0],
|
|
292
|
+
"upgrade": ["pnpm", "update", 0],
|
|
293
|
+
"upgrade-interactive": ["pnpm", "update", "-i", 0],
|
|
294
|
+
"execute": ["pnpm", "dlx", 0],
|
|
295
|
+
"execute-local": ["pnpm", "exec", 0],
|
|
296
|
+
"uninstall": ["pnpm", "remove", 0],
|
|
297
|
+
"global_uninstall": ["pnpm", "remove", "--global", 0]
|
|
298
|
+
};
|
|
299
|
+
var bun = {
|
|
300
|
+
"agent": ["bun", 0],
|
|
301
|
+
"run": ["bun", "run", 0],
|
|
302
|
+
"install": ["bun", "install", 0],
|
|
303
|
+
"frozen": ["bun", "install", "--frozen-lockfile"],
|
|
304
|
+
"global": ["bun", "add", "-g", 0],
|
|
305
|
+
"add": ["bun", "add", 0],
|
|
306
|
+
"upgrade": ["bun", "update", 0],
|
|
307
|
+
"upgrade-interactive": ["bun", "update", 0],
|
|
308
|
+
"execute": ["bun", "x", 0],
|
|
309
|
+
"execute-local": ["bun", "x", 0],
|
|
310
|
+
"uninstall": ["bun", "remove", 0],
|
|
311
|
+
"global_uninstall": ["bun", "remove", "-g", 0]
|
|
312
|
+
};
|
|
313
|
+
var COMMANDS = {
|
|
314
|
+
"npm": {
|
|
315
|
+
"agent": ["npm", 0],
|
|
316
|
+
"run": npmRun("npm"),
|
|
317
|
+
"install": ["npm", "i", 0],
|
|
318
|
+
"frozen": ["npm", "ci"],
|
|
319
|
+
"global": ["npm", "i", "-g", 0],
|
|
320
|
+
"add": ["npm", "i", 0],
|
|
321
|
+
"upgrade": ["npm", "update", 0],
|
|
322
|
+
"upgrade-interactive": null,
|
|
323
|
+
"execute": ["npx", 0],
|
|
324
|
+
"execute-local": ["npx", 0],
|
|
325
|
+
"uninstall": ["npm", "uninstall", 0],
|
|
326
|
+
"global_uninstall": ["npm", "uninstall", "-g", 0]
|
|
327
|
+
},
|
|
328
|
+
"yarn": yarn,
|
|
329
|
+
"yarn@berry": {
|
|
330
|
+
...yarn,
|
|
331
|
+
"frozen": ["yarn", "install", "--immutable"],
|
|
332
|
+
"upgrade": ["yarn", "up", 0],
|
|
333
|
+
"upgrade-interactive": ["yarn", "up", "-i", 0],
|
|
334
|
+
"execute": ["yarn", "dlx", 0],
|
|
335
|
+
"execute-local": ["yarn", "exec", 0],
|
|
336
|
+
"global": ["npm", "i", "-g", 0],
|
|
337
|
+
"global_uninstall": ["npm", "uninstall", "-g", 0]
|
|
338
|
+
},
|
|
339
|
+
"pnpm": pnpm,
|
|
340
|
+
"pnpm@6": {
|
|
341
|
+
...pnpm,
|
|
342
|
+
run: npmRun("pnpm")
|
|
343
|
+
},
|
|
344
|
+
"bun": bun
|
|
345
|
+
};
|
|
346
|
+
function resolveCommand(agent, command, args) {
|
|
347
|
+
const value = COMMANDS[agent][command];
|
|
348
|
+
return constructCommand(value, args);
|
|
349
|
+
}
|
|
350
|
+
function constructCommand(value, args) {
|
|
351
|
+
if (value == null)
|
|
352
|
+
return null;
|
|
353
|
+
const list = typeof value === "function" ? value(args) : value.flatMap((v) => {
|
|
354
|
+
if (typeof v === "number")
|
|
355
|
+
return args;
|
|
356
|
+
return [v];
|
|
357
|
+
});
|
|
358
|
+
return {
|
|
359
|
+
command: list[0],
|
|
360
|
+
args: list.slice(1)
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// src/utils/nuxt/utils.ts
|
|
365
|
+
function detectPkgInfo() {
|
|
366
|
+
const userAgent = process2.env.npm_config_user_agent;
|
|
367
|
+
if (!userAgent)
|
|
368
|
+
return void 0;
|
|
369
|
+
const pkgSpec = userAgent.split(" ")[0];
|
|
370
|
+
const pkgSpecArr = pkgSpec.split("/");
|
|
371
|
+
return {
|
|
372
|
+
name: pkgSpecArr[0],
|
|
373
|
+
version: pkgSpecArr[1]
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
function addPackageObject(key, entry, pkg, sort = true) {
|
|
377
|
+
pkg[key] ??= {};
|
|
378
|
+
if (!sort) {
|
|
379
|
+
for (const [name, value] of entry)
|
|
380
|
+
pkg[key][name] = value;
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
const entries = Object.entries(pkg[key]);
|
|
384
|
+
pkg[key] = {};
|
|
385
|
+
entry.forEach(([name, value]) => {
|
|
386
|
+
entries.push([name, value]);
|
|
387
|
+
});
|
|
388
|
+
entries.sort(([a], [b]) => a.localeCompare(b)).forEach(([k, v]) => {
|
|
389
|
+
pkg[key][k] = v;
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
function runCommand(pmDetection, command, args, cwd) {
|
|
393
|
+
let runCommand2 = "npm";
|
|
394
|
+
let runArgs = [command];
|
|
395
|
+
if (pmDetection) {
|
|
396
|
+
const prepare = resolveCommand(pmDetection.name, command, args);
|
|
397
|
+
runCommand2 = prepare.command;
|
|
398
|
+
runArgs = prepare.args;
|
|
399
|
+
}
|
|
400
|
+
const run2 = spawnSync2(
|
|
401
|
+
runCommand2,
|
|
402
|
+
runArgs.filter(Boolean),
|
|
403
|
+
{
|
|
404
|
+
cwd,
|
|
405
|
+
stdio: ["inherit", "inherit", "pipe"],
|
|
406
|
+
shell: true
|
|
407
|
+
}
|
|
408
|
+
);
|
|
409
|
+
if (run2.error) {
|
|
410
|
+
throw run2.error;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
function editFile(file, callback, destination) {
|
|
414
|
+
const content = fs.readFileSync(file, "utf-8");
|
|
415
|
+
fs.writeFileSync(destination ?? file, callback(content), "utf-8");
|
|
416
|
+
}
|
|
417
|
+
function getPaths(rootPath, templateDir, v4) {
|
|
418
|
+
return v4 ? [path.join(rootPath, "app"), templateDir] : [rootPath, templateDir];
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
// src/utils/nuxt/versions.ts
|
|
422
|
+
var versions = {
|
|
423
|
+
"vuetify": "^3.7.3",
|
|
424
|
+
"typescript": "^5.6.3",
|
|
425
|
+
"vue-tsc": "^2.1.6",
|
|
426
|
+
"sass-embedded": "^1.80.3",
|
|
427
|
+
"@vuetify/loader-shared": "^2.0.3",
|
|
428
|
+
"vite-plugin-vuetify": "^2.0.4",
|
|
429
|
+
"vuetify-nuxt-module": "^0.18.3",
|
|
430
|
+
"upath": "^2.0.1",
|
|
431
|
+
"@mdi/font": "^7.4.47",
|
|
432
|
+
"@nuxt/fonts": "^0.10.0"
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
// node_modules/.pnpm/package-manager-detector@0.2.2/node_modules/package-manager-detector/dist/constants.mjs
|
|
436
|
+
var AGENTS = [
|
|
437
|
+
"npm",
|
|
438
|
+
"yarn",
|
|
439
|
+
"yarn@berry",
|
|
440
|
+
"pnpm",
|
|
441
|
+
"pnpm@6",
|
|
442
|
+
"bun"
|
|
443
|
+
];
|
|
444
|
+
var LOCKS = {
|
|
445
|
+
"bun.lockb": "bun",
|
|
446
|
+
"pnpm-lock.yaml": "pnpm",
|
|
447
|
+
"yarn.lock": "yarn",
|
|
448
|
+
"package-lock.json": "npm",
|
|
449
|
+
"npm-shrinkwrap.json": "npm"
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
// node_modules/.pnpm/package-manager-detector@0.2.2/node_modules/package-manager-detector/dist/detect.mjs
|
|
453
|
+
import fs2 from "node:fs";
|
|
454
|
+
import fsPromises from "node:fs/promises";
|
|
455
|
+
import path2 from "node:path";
|
|
456
|
+
import process3 from "node:process";
|
|
457
|
+
async function detect(options = {}) {
|
|
458
|
+
const { cwd, onUnknown } = options;
|
|
459
|
+
for (const directory of lookup(cwd)) {
|
|
460
|
+
for (const lock of Object.keys(LOCKS)) {
|
|
461
|
+
if (await fileExists(path2.join(directory, lock))) {
|
|
462
|
+
const name = LOCKS[lock];
|
|
463
|
+
const result2 = await parsePackageJson(path2.join(directory, "package.json"), onUnknown);
|
|
464
|
+
if (result2)
|
|
465
|
+
return result2;
|
|
466
|
+
else
|
|
467
|
+
return { name, agent: name };
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
const result = await parsePackageJson(path2.join(directory, "package.json"), onUnknown);
|
|
471
|
+
if (result)
|
|
472
|
+
return result;
|
|
473
|
+
}
|
|
474
|
+
return null;
|
|
475
|
+
}
|
|
476
|
+
function* lookup(cwd = process3.cwd()) {
|
|
477
|
+
let directory = path2.resolve(cwd);
|
|
478
|
+
const { root } = path2.parse(directory);
|
|
479
|
+
while (directory && directory !== root) {
|
|
480
|
+
yield directory;
|
|
481
|
+
directory = path2.dirname(directory);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
async function parsePackageJson(filepath, onUnknown) {
|
|
485
|
+
return !filepath || !await fileExists(filepath) ? null : handlePackageManager(filepath, onUnknown);
|
|
486
|
+
}
|
|
487
|
+
function handlePackageManager(filepath, onUnknown) {
|
|
488
|
+
try {
|
|
489
|
+
const pkg = JSON.parse(fs2.readFileSync(filepath, "utf8"));
|
|
490
|
+
let agent;
|
|
491
|
+
if (typeof pkg.packageManager === "string") {
|
|
492
|
+
const [name, ver] = pkg.packageManager.replace(/^\^/, "").split("@");
|
|
493
|
+
let version = ver;
|
|
494
|
+
if (name === "yarn" && Number.parseInt(ver) > 1) {
|
|
495
|
+
agent = "yarn@berry";
|
|
496
|
+
version = "berry";
|
|
497
|
+
return { name, agent, version };
|
|
498
|
+
} else if (name === "pnpm" && Number.parseInt(ver) < 7) {
|
|
499
|
+
agent = "pnpm@6";
|
|
500
|
+
return { name, agent, version };
|
|
501
|
+
} else if (AGENTS.includes(name)) {
|
|
502
|
+
agent = name;
|
|
503
|
+
return { name, agent, version };
|
|
504
|
+
} else {
|
|
505
|
+
return onUnknown?.(pkg.packageManager) ?? null;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
} catch {
|
|
509
|
+
}
|
|
510
|
+
return null;
|
|
511
|
+
}
|
|
512
|
+
async function fileExists(filePath) {
|
|
513
|
+
try {
|
|
514
|
+
const stats = await fsPromises.stat(filePath);
|
|
515
|
+
if (stats.isFile()) {
|
|
516
|
+
return true;
|
|
517
|
+
}
|
|
518
|
+
} catch {
|
|
519
|
+
}
|
|
520
|
+
return false;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
// src/utils/nuxt/renderNuxtTemplate.ts
|
|
524
|
+
import { generateCode, parseModule } from "magicast";
|
|
525
|
+
import { addNuxtModule, getDefaultExportOptions } from "magicast/helpers";
|
|
526
|
+
async function renderNuxtTemplate(ctx) {
|
|
527
|
+
const {
|
|
528
|
+
cwd,
|
|
529
|
+
projectName,
|
|
530
|
+
projectRoot,
|
|
531
|
+
useNuxtV4Compat,
|
|
532
|
+
nuxtPreset
|
|
533
|
+
} = ctx;
|
|
534
|
+
const pkgInfo = detectPkgInfo();
|
|
535
|
+
const pkgManager = pkgInfo ? pkgInfo.name : "npm";
|
|
536
|
+
const isYarn1 = pkgManager === "yarn" && pkgInfo?.version.startsWith("1.");
|
|
537
|
+
const customCommand = useNuxtV4Compat ? `npx nuxi@latest init -t v4-compat ${projectName}` : `npm exec nuxi init ${projectName}`;
|
|
538
|
+
const fullCustomCommand = customCommand.replace("@latest", () => isYarn1 ? "" : "@latest").replace(/^npm exec/, () => {
|
|
539
|
+
if (pkgManager === "pnpm")
|
|
540
|
+
return "pnpm dlx";
|
|
541
|
+
if (pkgManager === "yarn" && !isYarn1)
|
|
542
|
+
return "yarn dlx";
|
|
543
|
+
if (pkgManager === "bun")
|
|
544
|
+
return "bun x";
|
|
545
|
+
return "npm exec";
|
|
546
|
+
});
|
|
547
|
+
let [command, ...args] = fullCustomCommand.split(" ");
|
|
548
|
+
const nuxiCli = spawnSync3(command, args, {
|
|
549
|
+
cwd,
|
|
550
|
+
stdio: ["inherit", "inherit", "pipe"],
|
|
551
|
+
shell: true
|
|
552
|
+
});
|
|
553
|
+
if (nuxiCli.error) {
|
|
554
|
+
throw nuxiCli.error;
|
|
555
|
+
}
|
|
556
|
+
configurePackageJson(ctx);
|
|
557
|
+
const pmDetection = await detect({ cwd: projectRoot });
|
|
558
|
+
runCommand(pmDetection, "install", [], projectRoot);
|
|
559
|
+
prepareProject(ctx);
|
|
560
|
+
if (nuxtPreset !== "nuxt-default") {
|
|
561
|
+
runCommand(pmDetection, "execute", ["nuxi", "module", "add", "eslint"], projectRoot);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
function configurePackageJson({
|
|
565
|
+
projectName,
|
|
566
|
+
projectRoot,
|
|
567
|
+
useNuxtModule,
|
|
568
|
+
nuxtPreset
|
|
569
|
+
}) {
|
|
570
|
+
const packageJson = path3.join(projectRoot, "package.json");
|
|
571
|
+
const pkg = JSON.parse(fs3.readFileSync(path3.join(projectRoot, "package.json"), "utf-8"));
|
|
572
|
+
pkg.name = projectName;
|
|
573
|
+
const scripts = [
|
|
574
|
+
["prepare", "nuxt prepare"],
|
|
575
|
+
["typecheck", "nuxt typecheck"]
|
|
576
|
+
];
|
|
577
|
+
if (nuxtPreset !== "nuxt-default") {
|
|
578
|
+
scripts.push(["lint", "eslint ."]);
|
|
579
|
+
scripts.push(["lint:fix", "eslint . --fix"]);
|
|
580
|
+
}
|
|
581
|
+
const dependencies = [
|
|
582
|
+
["vuetify", versions.vuetify]
|
|
583
|
+
];
|
|
584
|
+
if (dependencies.length) {
|
|
585
|
+
addPackageObject("dependencies", dependencies, pkg);
|
|
586
|
+
}
|
|
587
|
+
const devDependencies = [
|
|
588
|
+
["@mdi/font", versions["@mdi/font"]],
|
|
589
|
+
["@nuxt/fonts", versions["@nuxt/fonts"]],
|
|
590
|
+
["sass-embedded", versions["sass-embedded"]],
|
|
591
|
+
["typescript", versions.typescript],
|
|
592
|
+
["vue-tsc", versions["vue-tsc"]]
|
|
593
|
+
];
|
|
594
|
+
if (useNuxtModule) {
|
|
595
|
+
devDependencies.push(["vuetify-nuxt-module", versions["vuetify-nuxt-module"]]);
|
|
596
|
+
} else {
|
|
597
|
+
devDependencies.push(["upath", versions["upath"]]);
|
|
598
|
+
devDependencies.push(["@vuetify/loader-shared", versions["@vuetify/loader-shared"]]);
|
|
599
|
+
devDependencies.push(["vite-plugin-vuetify", versions["vite-plugin-vuetify"]]);
|
|
600
|
+
}
|
|
601
|
+
if (devDependencies.length) {
|
|
602
|
+
addPackageObject("devDependencies", devDependencies, pkg);
|
|
603
|
+
}
|
|
604
|
+
addPackageObject("scripts", scripts, pkg, false);
|
|
605
|
+
fs3.writeFileSync(packageJson, JSON.stringify(pkg, null, 2), "utf-8");
|
|
606
|
+
}
|
|
607
|
+
function configureVuetify(ctx, nuxtConfig) {
|
|
608
|
+
const config = getDefaultExportOptions(nuxtConfig);
|
|
609
|
+
config.ssr = ctx.useNuxtSSR;
|
|
610
|
+
config.features = {
|
|
611
|
+
inlineStyles: !ctx.useNuxtModule,
|
|
612
|
+
devLogs: !ctx.useNuxtModule
|
|
613
|
+
};
|
|
614
|
+
config.build = { transpile: ["vuetify"] };
|
|
615
|
+
config.vite = {
|
|
616
|
+
ssr: {
|
|
617
|
+
noExternal: ["vuetify"]
|
|
618
|
+
}
|
|
619
|
+
};
|
|
620
|
+
config.css = [];
|
|
621
|
+
if (!ctx.useNuxtModule) {
|
|
622
|
+
config.css.push("@mdi/font/css/materialdesignicons.css");
|
|
623
|
+
config.css.push("vuetify/styles");
|
|
624
|
+
}
|
|
625
|
+
addNuxtModule(nuxtConfig, "@nuxt/fonts");
|
|
626
|
+
return config;
|
|
627
|
+
}
|
|
628
|
+
function copyResources(ctx, rootPath, templateDir) {
|
|
629
|
+
const {
|
|
630
|
+
useNuxtSSR,
|
|
631
|
+
useNuxtV4Compat,
|
|
632
|
+
nuxtPreset,
|
|
633
|
+
useNuxtModule,
|
|
634
|
+
templateRoot
|
|
635
|
+
} = ctx;
|
|
636
|
+
const assetsDir = path3.join(rootPath, "assets");
|
|
637
|
+
let templateAssetsDir = path3.join(templateRoot, "default/src/assets");
|
|
638
|
+
fs3.mkdirSync(assetsDir);
|
|
639
|
+
fs3.copyFileSync(
|
|
640
|
+
path3.join(templateAssetsDir, "logo.png"),
|
|
641
|
+
path3.join(assetsDir, "logo.png")
|
|
642
|
+
);
|
|
643
|
+
fs3.copyFileSync(
|
|
644
|
+
path3.join(templateAssetsDir, "logo.svg"),
|
|
645
|
+
path3.join(assetsDir, "logo.svg")
|
|
646
|
+
);
|
|
647
|
+
if (nuxtPreset !== "nuxt-default") {
|
|
648
|
+
templateAssetsDir = path3.join(templateRoot, "base/src/styles");
|
|
649
|
+
fs3.copyFileSync(
|
|
650
|
+
path3.join(templateAssetsDir, "settings.scss"),
|
|
651
|
+
path3.join(assetsDir, "settings.scss")
|
|
652
|
+
);
|
|
653
|
+
}
|
|
654
|
+
const pluginsDir = path3.join(rootPath, "plugins");
|
|
655
|
+
const templatePluginsDir = path3.join(templateDir, "plugins");
|
|
656
|
+
fs3.mkdirSync(pluginsDir);
|
|
657
|
+
if (useNuxtModule) {
|
|
658
|
+
fs3.copyFileSync(
|
|
659
|
+
path3.join(templateDir, "vuetify.config.ts"),
|
|
660
|
+
path3.join(rootPath, useNuxtV4Compat ? "../vuetify.config.ts" : "vuetify.config.ts")
|
|
661
|
+
);
|
|
662
|
+
fs3.copyFileSync(
|
|
663
|
+
path3.join(templatePluginsDir, "vuetify-nuxt.ts"),
|
|
664
|
+
path3.join(pluginsDir, "vuetify.ts")
|
|
665
|
+
);
|
|
666
|
+
} else {
|
|
667
|
+
const modulesDir = path3.join(rootPath, useNuxtV4Compat ? "../modules" : "modules");
|
|
668
|
+
const templateModulesDir = path3.join(templateDir, "modules");
|
|
669
|
+
fs3.mkdirSync(modulesDir);
|
|
670
|
+
fs3.copyFileSync(
|
|
671
|
+
path3.resolve(templateModulesDir, "vuetify.ts"),
|
|
672
|
+
path3.resolve(modulesDir, "vuetify.ts")
|
|
673
|
+
);
|
|
674
|
+
editFile(
|
|
675
|
+
path3.join(templatePluginsDir, "vuetify.ts"),
|
|
676
|
+
(content) => {
|
|
677
|
+
return useNuxtSSR ? content : content.replace("ssr: true,", "ssr: false,");
|
|
678
|
+
},
|
|
679
|
+
path3.resolve(pluginsDir, "vuetify.ts")
|
|
680
|
+
);
|
|
681
|
+
}
|
|
682
|
+
fs3.copyFileSync(
|
|
683
|
+
path3.resolve(templateDir, nuxtPreset === "nuxt-essentials" ? "app-layout.vue" : "app.vue"),
|
|
684
|
+
path3.resolve(rootPath, "app.vue")
|
|
685
|
+
);
|
|
686
|
+
if (nuxtPreset === "nuxt-essentials") {
|
|
687
|
+
const layoutsDir = path3.join(rootPath, "layouts");
|
|
688
|
+
const templateLayoutsDir = path3.join(templateDir, "layouts");
|
|
689
|
+
fs3.mkdirSync(layoutsDir);
|
|
690
|
+
fs3.copyFileSync(
|
|
691
|
+
path3.resolve(templateLayoutsDir, "default.vue"),
|
|
692
|
+
path3.resolve(layoutsDir, "default.vue")
|
|
693
|
+
);
|
|
694
|
+
}
|
|
695
|
+
const componentsDir = path3.join(rootPath, "components");
|
|
696
|
+
const templateComponentsDir = path3.join(templateDir, "components");
|
|
697
|
+
fs3.mkdirSync(componentsDir);
|
|
698
|
+
fs3.copyFileSync(
|
|
699
|
+
path3.resolve(templateComponentsDir, "AppFooter.vue"),
|
|
700
|
+
path3.resolve(componentsDir, "AppFooter.vue")
|
|
701
|
+
);
|
|
702
|
+
fs3.copyFileSync(
|
|
703
|
+
path3.resolve(templateComponentsDir, "HelloWorld.vue"),
|
|
704
|
+
path3.resolve(componentsDir, "HelloWorld.vue")
|
|
705
|
+
);
|
|
706
|
+
const pagesDir = path3.join(rootPath, "pages");
|
|
707
|
+
const templatePagesDir = path3.join(templateDir, "pages");
|
|
708
|
+
fs3.mkdirSync(pagesDir);
|
|
709
|
+
fs3.copyFileSync(
|
|
710
|
+
path3.resolve(templatePagesDir, "index.vue"),
|
|
711
|
+
path3.resolve(pagesDir, "index.vue")
|
|
712
|
+
);
|
|
713
|
+
}
|
|
714
|
+
function prepareNuxtModule(ctx, nuxtConfig) {
|
|
715
|
+
const moduleOptions = {
|
|
716
|
+
ssrClientHints: {
|
|
717
|
+
reloadOnFirstRequest: false,
|
|
718
|
+
viewportSize: ctx.useNuxtSSR && ctx.useNuxtSSRClientHints,
|
|
719
|
+
prefersColorScheme: false,
|
|
720
|
+
prefersColorSchemeOptions: {
|
|
721
|
+
useBrowserThemeOnly: false
|
|
722
|
+
}
|
|
723
|
+
},
|
|
724
|
+
styles: ctx.nuxtPreset === "nuxt-default" ? true : {
|
|
725
|
+
configFile: "assets/settings.scss"
|
|
726
|
+
}
|
|
727
|
+
};
|
|
728
|
+
configureVuetify(ctx, nuxtConfig);
|
|
729
|
+
addNuxtModule(
|
|
730
|
+
nuxtConfig,
|
|
731
|
+
"vuetify-nuxt-module",
|
|
732
|
+
"vuetify",
|
|
733
|
+
{ moduleOptions }
|
|
734
|
+
);
|
|
735
|
+
}
|
|
736
|
+
function prepareVuetifyModule(ctx, nuxtConfig) {
|
|
737
|
+
const config = configureVuetify(ctx, nuxtConfig);
|
|
738
|
+
const styles = ctx.nuxtPreset !== "nuxt-essentials" ? true : {
|
|
739
|
+
configFile: "assets/settings.scss"
|
|
740
|
+
};
|
|
741
|
+
config.vuetify = { autoImport: true, styles };
|
|
742
|
+
}
|
|
743
|
+
function prepareProject(ctx) {
|
|
744
|
+
const {
|
|
745
|
+
projectRoot,
|
|
746
|
+
templatePath,
|
|
747
|
+
useNuxtV4Compat,
|
|
748
|
+
useNuxtModule
|
|
749
|
+
} = ctx;
|
|
750
|
+
const [rootPath, templateDir] = getPaths(projectRoot, templatePath, useNuxtV4Compat);
|
|
751
|
+
const nuxtConfigFile = path3.join(rootPath, useNuxtV4Compat ? "../nuxt.config.ts" : "nuxt.config.ts");
|
|
752
|
+
const nuxtConfig = parseModule(fs3.readFileSync(nuxtConfigFile, "utf-8"));
|
|
753
|
+
if (useNuxtModule) {
|
|
754
|
+
prepareNuxtModule(ctx, nuxtConfig);
|
|
755
|
+
} else {
|
|
756
|
+
prepareVuetifyModule(ctx, nuxtConfig);
|
|
757
|
+
}
|
|
758
|
+
let code = generateCode(nuxtConfig, {
|
|
759
|
+
trailingComma: true,
|
|
760
|
+
quote: "single",
|
|
761
|
+
arrayBracketSpacing: false,
|
|
762
|
+
objectCurlySpacing: true,
|
|
763
|
+
lineTerminator: "\n",
|
|
764
|
+
format: {
|
|
765
|
+
trailingComma: true,
|
|
766
|
+
quote: "single",
|
|
767
|
+
arrayBracketSpacing: false,
|
|
768
|
+
objectCurlySpacing: true,
|
|
769
|
+
useSemi: false
|
|
770
|
+
}
|
|
771
|
+
}).code;
|
|
772
|
+
if (useNuxtModule) {
|
|
773
|
+
code = code.replace("ssrClientHints:", `// check https://nuxt.vuetifyjs.com/guide/server-side-rendering.html
|
|
774
|
+
ssrClientHints:`);
|
|
775
|
+
code = code.replace("styles:", `// /* If customizing sass global variables ($utilities, $reset, $color-pack, $body-font-family, etc) */
|
|
776
|
+
// disableVuetifyStyles: true,
|
|
777
|
+
styles:`);
|
|
778
|
+
} else {
|
|
779
|
+
code = code.replace("ssr:", `// when enabling/disabling ssr option, remember to update ssr option in plugins/vuetify.ts
|
|
780
|
+
ssr:`);
|
|
781
|
+
}
|
|
782
|
+
code = code.replace("features:", `// when enabling ssr option you need to disable inlineStyles and maybe devLogs
|
|
783
|
+
features:`);
|
|
784
|
+
fs3.writeFileSync(
|
|
785
|
+
nuxtConfigFile,
|
|
786
|
+
code,
|
|
787
|
+
"utf-8"
|
|
788
|
+
);
|
|
789
|
+
copyResources(ctx, rootPath, templateDir);
|
|
790
|
+
}
|
|
791
|
+
|
|
188
792
|
// src/index.ts
|
|
189
793
|
var validPresets = ["base", "custom", "default", "essentials"];
|
|
190
794
|
async function run() {
|
|
@@ -217,28 +821,52 @@ ${banner}
|
|
|
217
821
|
useTypeScript,
|
|
218
822
|
usePackageManager,
|
|
219
823
|
installDependencies: installDeps,
|
|
220
|
-
usePreset
|
|
824
|
+
usePreset,
|
|
825
|
+
useStore,
|
|
826
|
+
useEslint,
|
|
827
|
+
useNuxtV4Compat,
|
|
828
|
+
useNuxtModule,
|
|
829
|
+
useNuxtSSR,
|
|
830
|
+
useNuxtSSRClientHints
|
|
221
831
|
} = await initPrompts(context);
|
|
222
832
|
const projectRoot = join2(cwd, projectName);
|
|
223
833
|
if (canOverwrite) {
|
|
224
834
|
rmSync(projectRoot, { recursive: true });
|
|
225
835
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
836
|
+
const preset = context.usePreset ?? usePreset;
|
|
837
|
+
if (preset.startsWith("nuxt-")) {
|
|
838
|
+
const templateRoot = resolve3(dirname2(fileURLToPath(import.meta.url)), "../template/typescript");
|
|
839
|
+
const templatePath = resolve3(dirname2(fileURLToPath(import.meta.url)), "../template/typescript/nuxt");
|
|
840
|
+
await renderNuxtTemplate({
|
|
841
|
+
cwd,
|
|
842
|
+
projectName,
|
|
843
|
+
projectRoot,
|
|
844
|
+
templateRoot,
|
|
845
|
+
templatePath,
|
|
846
|
+
nuxtPreset: preset,
|
|
847
|
+
useNuxtV4Compat,
|
|
848
|
+
useNuxtModule,
|
|
849
|
+
useNuxtSSR,
|
|
850
|
+
useNuxtSSRClientHints
|
|
851
|
+
});
|
|
852
|
+
} else {
|
|
853
|
+
mkdirSync2(projectRoot);
|
|
854
|
+
writeFileSync2(resolve3(projectRoot, "package.json"), JSON.stringify({ name: projectName }, null, 2));
|
|
855
|
+
console.log("\n\u25CC Generating scaffold...");
|
|
856
|
+
const jsOrTs = useTypeScript ? "typescript" : "javascript";
|
|
857
|
+
let templatePath = resolve3(dirname2(fileURLToPath(import.meta.url)), "../template", jsOrTs);
|
|
858
|
+
renderTemplate(resolve3(templatePath, "default"), projectRoot);
|
|
859
|
+
if (["base", "essentials"].includes(usePreset)) {
|
|
860
|
+
renderTemplate(resolve3(templatePath, "base"), projectRoot);
|
|
861
|
+
}
|
|
862
|
+
if (["essentials", "recommended"].includes(usePreset)) {
|
|
863
|
+
renderTemplate(resolve3(templatePath, "essentials"), projectRoot);
|
|
864
|
+
}
|
|
865
|
+
if (usePackageManager && installDeps) {
|
|
866
|
+
console.log(`\u25CC Installing dependencies with ${usePackageManager}...
|
|
240
867
|
`);
|
|
241
|
-
|
|
868
|
+
installDependencies(projectRoot, usePackageManager);
|
|
869
|
+
}
|
|
242
870
|
}
|
|
243
871
|
console.log(`
|
|
244
872
|
${projectName} has been generated at ${projectRoot}
|
|
@@ -248,6 +876,7 @@ run().then(() => {
|
|
|
248
876
|
console.log("Discord community: https://community.vuetifyjs.com");
|
|
249
877
|
console.log("Github: https://github.com/vuetifyjs/vuetify");
|
|
250
878
|
console.log("Support Vuetify: https://github.com/sponsors/johnleider");
|
|
879
|
+
process.exit(0);
|
|
251
880
|
}).catch((err) => {
|
|
252
881
|
console.error(`
|
|
253
882
|
${red2("\u2716")} ${err}
|