create-vuetify 2.3.1 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -3
- package/dist/index.mjs +1704 -137
- package/package.json +27 -29
- package/template/javascript/base/eslint.config.js +1 -23
- package/template/javascript/base/package.json +5 -9
- package/template/javascript/base/src/components/HelloWorld.vue +42 -109
- package/template/javascript/base/src/router/index.js +0 -1
- package/template/javascript/base/vite.config.mjs +24 -9
- package/template/javascript/default/package.json +11 -11
- package/template/javascript/default/src/components/AppFooter.vue +6 -3
- package/template/javascript/default/src/components/HelloWorld.vue +41 -108
- package/template/javascript/default/src/main.js +3 -0
- package/template/javascript/default/vite.config.mjs +18 -9
- package/template/javascript/essentials/_eslintrc-auto-import.json +11 -1
- package/template/javascript/essentials/package.json +3 -3
- package/template/javascript/essentials/src/layouts/README.md +1 -1
- package/template/javascript/essentials/vite.config.mjs +20 -4
- package/template/typescript/base/eslint.config.js +1 -36
- package/template/typescript/base/package.json +4 -9
- package/template/typescript/base/src/components/HelloWorld.vue +42 -109
- package/template/typescript/base/vite.config.mts +28 -9
- package/template/typescript/default/README.md +1 -1
- package/template/typescript/default/package.json +13 -15
- package/template/typescript/default/src/components/HelloWorld.vue +41 -108
- package/template/typescript/default/src/main.ts +3 -0
- package/template/typescript/default/vite.config.mts +16 -7
- package/template/typescript/essentials/_eslintrc-auto-import.json +13 -0
- package/template/typescript/essentials/env.d.ts +1 -1
- package/template/typescript/essentials/package.json +3 -3
- package/template/typescript/essentials/src/auto-imports.d.ts +16 -66
- package/template/typescript/essentials/src/components/AppFooter.vue +6 -3
- package/template/typescript/essentials/src/layouts/README.md +1 -1
- package/template/typescript/essentials/vite.config.mts +25 -8
- package/template/typescript/nuxt/assets/logo.png +0 -0
- package/template/typescript/nuxt/assets/logo.svg +6 -0
- package/template/typescript/nuxt/components/AppFooter.vue +38 -35
- package/template/typescript/nuxt/components/HelloWorld.vue +44 -107
- package/template/typescript/nuxt/modules/vuetify.ts +35 -10
- package/template/typescript/nuxt/pages/index.vue +0 -1
- package/template/typescript/nuxt/plugins/vuetify-nuxt.ts +2 -2
- package/template/typescript/nuxt/plugins/vuetify.ts +1 -1
- package/dist/output.cjs +0 -303
package/dist/output.cjs
DELETED
|
@@ -1,303 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
18
|
-
|
|
19
|
-
// src/index.ts
|
|
20
|
-
var import_path3 = require("path");
|
|
21
|
-
var import_fs3 = require("fs");
|
|
22
|
-
|
|
23
|
-
// src/utils/prompts.ts
|
|
24
|
-
var import_path = require("path");
|
|
25
|
-
var import_fs = require("fs");
|
|
26
|
-
|
|
27
|
-
// src/utils/presets.ts
|
|
28
|
-
var defaultContext = {
|
|
29
|
-
useEslint: false,
|
|
30
|
-
useRouter: false,
|
|
31
|
-
useStore: false
|
|
32
|
-
};
|
|
33
|
-
var baseContext = {
|
|
34
|
-
...defaultContext,
|
|
35
|
-
useEslint: true,
|
|
36
|
-
useRouter: true
|
|
37
|
-
};
|
|
38
|
-
var essentialsContext = {
|
|
39
|
-
...baseContext,
|
|
40
|
-
useStore: true
|
|
41
|
-
};
|
|
42
|
-
var presets = {
|
|
43
|
-
base: baseContext,
|
|
44
|
-
default: defaultContext,
|
|
45
|
-
essentials: essentialsContext
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
// src/utils/prompts.ts
|
|
49
|
-
var import_kolorist = require("kolorist");
|
|
50
|
-
var import_prompts = __toESM(require("prompts"), 1);
|
|
51
|
-
var import_validate_npm_package_name = __toESM(require("validate-npm-package-name"), 1);
|
|
52
|
-
var promptQuestions = (context) => [
|
|
53
|
-
{
|
|
54
|
-
name: "projectName",
|
|
55
|
-
type: "text",
|
|
56
|
-
message: "Project name:",
|
|
57
|
-
initial: "vuetify-project",
|
|
58
|
-
validate: (v) => {
|
|
59
|
-
const { errors } = (0, import_validate_npm_package_name.default)(String(v).trim());
|
|
60
|
-
return !(errors && errors.length) || `Package ${errors[0]}`;
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
name: "canOverwrite",
|
|
65
|
-
active: "Yes",
|
|
66
|
-
inactive: "No",
|
|
67
|
-
initial: false,
|
|
68
|
-
type: (_, { projectName }) => {
|
|
69
|
-
const projectPath = (0, import_path.join)(context.cwd, projectName);
|
|
70
|
-
return !(0, import_fs.existsSync)(projectPath) || (0, import_fs.readdirSync)(projectPath).length === 0 ? null : "toggle";
|
|
71
|
-
},
|
|
72
|
-
message: (prev) => `The project path: ${(0, import_path.resolve)(context.cwd, prev)} already exists, would you like to overwrite this directory?`
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
name: "usePreset",
|
|
76
|
-
type: context.usePreset ? null : "select",
|
|
77
|
-
message: "Which preset would you like to install?",
|
|
78
|
-
initial: 1,
|
|
79
|
-
choices: [
|
|
80
|
-
{ title: "Default (Vuetify)", value: "default" },
|
|
81
|
-
{ title: "Base (Vuetify, VueRouter)", value: "base" },
|
|
82
|
-
{ title: "Essentials (Vuetify, VueRouter, Pinia)", value: "essentials" },
|
|
83
|
-
{ title: "Custom (Choose your features)", value: "custom" }
|
|
84
|
-
]
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
name: "useTypeScript",
|
|
88
|
-
type: context.useTypeScript ? null : "toggle",
|
|
89
|
-
message: "Use TypeScript?",
|
|
90
|
-
active: "Yes",
|
|
91
|
-
inactive: "No",
|
|
92
|
-
initial: false
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
name: "useRouter",
|
|
96
|
-
type: (_, { usePreset }) => usePreset !== "custom" && context.usePreset !== "custom" ? null : "toggle",
|
|
97
|
-
message: "Use Vue Router?",
|
|
98
|
-
active: "Yes",
|
|
99
|
-
inactive: "No",
|
|
100
|
-
initial: false
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
name: "useStore",
|
|
104
|
-
type: (_, { usePreset }) => usePreset !== "custom" && context.usePreset !== "custom" ? null : "toggle",
|
|
105
|
-
message: "Use Pinia?",
|
|
106
|
-
active: "Yes",
|
|
107
|
-
inactive: "No",
|
|
108
|
-
initial: false
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
name: "useEslint",
|
|
112
|
-
type: (_, { usePreset }) => usePreset !== "custom" && context.usePreset !== "custom" ? null : "toggle",
|
|
113
|
-
message: "Use ESLint?",
|
|
114
|
-
active: "Yes",
|
|
115
|
-
inactive: "No",
|
|
116
|
-
initial: false
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
name: "usePackageManager",
|
|
120
|
-
type: "select",
|
|
121
|
-
message: "Would you like to install dependencies with yarn, npm, pnpm, or bun?",
|
|
122
|
-
initial: 0,
|
|
123
|
-
choices: [
|
|
124
|
-
{ title: "yarn", value: "yarn" },
|
|
125
|
-
{ title: "npm", value: "npm" },
|
|
126
|
-
{ title: "pnpm", value: "pnpm" },
|
|
127
|
-
{ title: "bun", value: "bun" },
|
|
128
|
-
{ title: "none", value: null }
|
|
129
|
-
]
|
|
130
|
-
}
|
|
131
|
-
];
|
|
132
|
-
var promptOptions = {
|
|
133
|
-
onCancel: () => {
|
|
134
|
-
throw new Error((0, import_kolorist.red)("\u2716") + " Operation cancelled");
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
var initPrompts = async (context) => {
|
|
138
|
-
if (context.usePreset && context.usePreset !== "custom") {
|
|
139
|
-
context = {
|
|
140
|
-
...context,
|
|
141
|
-
...presets[context.usePreset]
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
const answers = await (0, import_prompts.default)(promptQuestions(context), promptOptions);
|
|
145
|
-
return {
|
|
146
|
-
...context,
|
|
147
|
-
...answers
|
|
148
|
-
};
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
// src/index.ts
|
|
152
|
-
var import_kolorist2 = require("kolorist");
|
|
153
|
-
var import_minimist = __toESM(require("minimist"), 1);
|
|
154
|
-
|
|
155
|
-
// src/utils/installDependencies.ts
|
|
156
|
-
var import_child_process = require("child_process");
|
|
157
|
-
function installDependencies(projectRoot, packageManager) {
|
|
158
|
-
const cmd = packageManager === "npm" ? "npm install" : packageManager === "yarn" ? "yarn" : packageManager === "bun" ? "bun install" : "pnpm install";
|
|
159
|
-
const spawn = (0, import_child_process.spawnSync)(cmd, {
|
|
160
|
-
cwd: projectRoot,
|
|
161
|
-
stdio: ["inherit", "inherit", "pipe"],
|
|
162
|
-
shell: true
|
|
163
|
-
});
|
|
164
|
-
if (spawn.error) {
|
|
165
|
-
throw spawn.error;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// src/utils/renderTemplate.ts
|
|
170
|
-
var import_fs2 = require("fs");
|
|
171
|
-
var import_path2 = require("path");
|
|
172
|
-
|
|
173
|
-
// src/utils/deepMerge.ts
|
|
174
|
-
var isObject = (v) => {
|
|
175
|
-
return v === Object(v) && v !== null && !Array.isArray(v);
|
|
176
|
-
};
|
|
177
|
-
var deepMerge = (...sources) => sources.reduce((acc, curr) => {
|
|
178
|
-
Object.keys(curr).forEach((key) => {
|
|
179
|
-
if (Array.isArray(acc[key]) && Array.isArray(curr[key])) {
|
|
180
|
-
acc[key] = Array.from(new Set(acc[key].concat(curr[key])));
|
|
181
|
-
} else if (isObject(acc[key]) && isObject(curr[key])) {
|
|
182
|
-
acc[key] = deepMerge(acc[key], curr[key]);
|
|
183
|
-
} else {
|
|
184
|
-
acc[key] = curr[key];
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
return acc;
|
|
188
|
-
}, {});
|
|
189
|
-
|
|
190
|
-
// src/utils/renderTemplate.ts
|
|
191
|
-
function mergePkg(source, destination) {
|
|
192
|
-
const target = JSON.parse((0, import_fs2.readFileSync)(destination, "utf8"));
|
|
193
|
-
const src = JSON.parse((0, import_fs2.readFileSync)(source, "utf8"));
|
|
194
|
-
const mergedPkg = deepMerge(target, src);
|
|
195
|
-
const keysToSort = ["devDependencies", "dependencies"];
|
|
196
|
-
keysToSort.forEach((k) => {
|
|
197
|
-
mergedPkg[k] = Object.keys(mergedPkg[k]).sort().reduce((a, c) => (a[c] = mergedPkg[k][c], a), {});
|
|
198
|
-
});
|
|
199
|
-
(0, import_fs2.writeFileSync)(destination, JSON.stringify(mergedPkg, null, 2) + "\n");
|
|
200
|
-
}
|
|
201
|
-
function renderDirectory(source, destination) {
|
|
202
|
-
(0, import_fs2.mkdirSync)(destination, { recursive: true });
|
|
203
|
-
(0, import_fs2.readdirSync)(source).forEach((path) => renderTemplate((0, import_path2.resolve)(source, path), (0, import_path2.resolve)(destination, path)));
|
|
204
|
-
}
|
|
205
|
-
function renderFile(source, destination) {
|
|
206
|
-
const filename = (0, import_path2.basename)(source);
|
|
207
|
-
if (filename.startsWith("_"))
|
|
208
|
-
destination = (0, import_path2.resolve)((0, import_path2.dirname)(destination), filename.replace("_", "."));
|
|
209
|
-
if (filename === "package.json")
|
|
210
|
-
mergePkg(source, destination);
|
|
211
|
-
else
|
|
212
|
-
(0, import_fs2.copyFileSync)(source, destination);
|
|
213
|
-
}
|
|
214
|
-
function renderTemplate(source, destination) {
|
|
215
|
-
if ((0, import_fs2.statSync)(source).isDirectory()) {
|
|
216
|
-
renderDirectory(source, destination);
|
|
217
|
-
} else {
|
|
218
|
-
renderFile(source, destination);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
// src/index.ts
|
|
223
|
-
var validPresets = ["base", "custom", "default", "essentials"];
|
|
224
|
-
async function run() {
|
|
225
|
-
const argv = (0, import_minimist.default)(process.argv.slice(2), {
|
|
226
|
-
alias: {
|
|
227
|
-
"typescript": ["ts"]
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
if (argv.preset && !validPresets.includes(argv.preset)) {
|
|
231
|
-
throw new Error(`'${argv.preset}' is not a valid preset. Valid presets are: ${validPresets.join(", ")}.`);
|
|
232
|
-
}
|
|
233
|
-
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";
|
|
234
|
-
console.log(`
|
|
235
|
-
${banner}
|
|
236
|
-
`);
|
|
237
|
-
const context = {
|
|
238
|
-
canOverwrite: false,
|
|
239
|
-
cwd: process.cwd(),
|
|
240
|
-
projectName: "vuetify-project",
|
|
241
|
-
useRouter: false,
|
|
242
|
-
useTypeScript: argv.typescript,
|
|
243
|
-
usePreset: argv.preset,
|
|
244
|
-
useStore: void 0,
|
|
245
|
-
usePackageManager: void 0
|
|
246
|
-
};
|
|
247
|
-
const {
|
|
248
|
-
canOverwrite,
|
|
249
|
-
cwd,
|
|
250
|
-
projectName,
|
|
251
|
-
useTypeScript,
|
|
252
|
-
usePackageManager,
|
|
253
|
-
usePreset,
|
|
254
|
-
useStore,
|
|
255
|
-
useEslint,
|
|
256
|
-
useRouter
|
|
257
|
-
} = await initPrompts(context);
|
|
258
|
-
const projectRoot = (0, import_path3.join)(cwd, projectName);
|
|
259
|
-
if (canOverwrite) {
|
|
260
|
-
(0, import_fs3.rmSync)(projectRoot, { recursive: true });
|
|
261
|
-
}
|
|
262
|
-
(0, import_fs3.mkdirSync)(projectRoot);
|
|
263
|
-
(0, import_fs3.writeFileSync)((0, import_path3.resolve)(projectRoot, "package.json"), JSON.stringify({ name: projectName }, null, 2));
|
|
264
|
-
const jsOrTs = useTypeScript ? "typescript" : "javascript";
|
|
265
|
-
let templatePath = (0, import_path3.resolve)(__dirname, "../template", jsOrTs);
|
|
266
|
-
console.log("\n\u25CC Generating scaffold...");
|
|
267
|
-
if (usePreset !== "custom") {
|
|
268
|
-
renderTemplate((0, import_path3.resolve)(templatePath, usePreset), projectRoot);
|
|
269
|
-
} else {
|
|
270
|
-
renderTemplate((0, import_path3.resolve)(templatePath, "default"), projectRoot);
|
|
271
|
-
templatePath = (0, import_path3.resolve)(templatePath, usePreset);
|
|
272
|
-
if (useEslint) {
|
|
273
|
-
renderTemplate((0, import_path3.resolve)(templatePath, "eslint"), projectRoot);
|
|
274
|
-
}
|
|
275
|
-
if (useRouter) {
|
|
276
|
-
renderTemplate((0, import_path3.resolve)(templatePath, "router"), projectRoot);
|
|
277
|
-
}
|
|
278
|
-
if (useStore) {
|
|
279
|
-
renderTemplate((0, import_path3.resolve)(templatePath, "store"), projectRoot);
|
|
280
|
-
if (useRouter) {
|
|
281
|
-
renderTemplate((0, import_path3.resolve)(templatePath, "router-pinia"), projectRoot);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
if (usePackageManager) {
|
|
286
|
-
console.log(`\u25CC Installing dependencies with ${usePackageManager}...
|
|
287
|
-
`);
|
|
288
|
-
installDependencies(projectRoot, usePackageManager);
|
|
289
|
-
}
|
|
290
|
-
console.log(`
|
|
291
|
-
${projectName} has been generated at ${projectRoot}
|
|
292
|
-
`);
|
|
293
|
-
}
|
|
294
|
-
run().then(() => {
|
|
295
|
-
console.log("Discord community: https://community.vuetifyjs.com");
|
|
296
|
-
console.log("Github: https://github.com/vuetifyjs/vuetify");
|
|
297
|
-
console.log("Support Vuetify: https://github.com/sponsors/johnleider");
|
|
298
|
-
}).catch((err) => {
|
|
299
|
-
console.error(`
|
|
300
|
-
${(0, import_kolorist2.red)("\u2716")} ${err}
|
|
301
|
-
`);
|
|
302
|
-
process.exit(1);
|
|
303
|
-
});
|