create-vuetify 2.2.1 → 2.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
- # create-vuetify
1
+ # Vuetify Create
2
2
 
3
3
  <p align="center">
4
- <img src="https://cdn.vuetifyjs.com/docs/images/logos/v.png" height="128">
4
+ <img src="https://vuetifyjs.b-cdn.net/docs/images/one/create/vcreate-logo.png" alt="Vuetify Logo" width="200">
5
5
  </p>
6
6
 
7
- ## Getting Started
7
+ ## 💿 Getting Started
8
8
 
9
9
  Using your terminal, navigate to your sites directory and run the following command:
10
10
 
@@ -28,13 +28,13 @@ pnpm create vuetify
28
28
  bun create vuetify
29
29
  ```
30
30
 
31
- ## Vuetify
31
+ ## 🐉 Vuetify
32
32
 
33
33
  Vuetify is an Open Source UI Library that is developed exactly according to Material Design spec. Every component is handcrafted to bring you the best possible UI tools to your next great app. The development doesn't stop at the core components outlined in Google's spec. Through the support of community members and sponsors, additional components will be designed and made available for everyone to enjoy.
34
34
 
35
35
  The documentation for **Vuetify** is hosted [here](https://vuetifyjs.com/).
36
36
 
37
- ### Support Development
37
+ ### 💖 Support Development
38
38
 
39
39
  Vuetify is an open source MIT project that has been made possible due to the generous contributions by our [sponsors and backers](https://vuetifyjs.com/introduction/sponsors-and-backers/). If you are interested in supporting this project, please consider:
40
40
 
@@ -46,11 +46,7 @@ Vuetify is an open source MIT project that has been made possible due to the gen
46
46
  - [Becoming a subscriber on Tidelift](https://tidelift.com/subscription/npm/vuetify)
47
47
  - [Making a one-time donation with Paypal](https://paypal.me/vuetify)
48
48
 
49
- ## Vite
50
-
51
- Vite is a build tool that significantly improves the front-end development experience. You can use Vite to set up a development environment for frameworks like Vue and React, and even for a vanilla JavaScript app with a dev server and hot reloading in just three commands. It also easily integrates with [TypeScript](https://vitejs.dev/guide/features.html#typescript).
52
-
53
- ## Browser Support
49
+ ## 🌐 Browser Support
54
50
 
55
51
  | Browser | Status |
56
52
  | - | - |
@@ -61,15 +57,16 @@ Vite is a build tool that significantly improves the front-end development exper
61
57
  | Edge <79 | ⛔ Not supported |
62
58
  | Internet Explorer | ⛔ Not supported |
63
59
 
64
- ## Resources
60
+ ## 📃 Resources
65
61
 
66
62
  - 📄 [Documentation](https://vuetifyjs.com/)
67
63
  - 🚨 [Report an Issue](https://issues.vuetifyjs.com/)
68
64
  - 🏬 [Vuetify Store](https://store.vuetifyjs.com/)
65
+ - 🗑️ [Vuetify Bin](https://bin.vuetifyjs.com/)
69
66
  - 🎮 [Vuetify Playground](https://play.vuetifyjs.com/)
70
- - 💬 [Discord](https://community.vuetifyjs.com)
67
+ - 💬 [Discord](https://community.vuetifyjs.com/)
71
68
 
72
- ## Licensing
69
+ ## Licensing
73
70
 
74
71
  - Copyright 2023 Vuetify <https://vuetifyjs.com/>
75
72
  - Vuetify [License Information](https://github.com/vuetifyjs/vuetify/blob/master/LICENSE.md)
package/dist/index.mjs ADDED
@@ -0,0 +1,256 @@
1
+ // src/index.ts
2
+ import { dirname as dirname2, join as join2, resolve as resolve3 } from "path";
3
+ import { fileURLToPath } from "url";
4
+ import { mkdirSync as mkdirSync2, rmSync, writeFileSync as writeFileSync2 } from "fs";
5
+
6
+ // src/utils/prompts.ts
7
+ import { resolve, join } from "path";
8
+ import { existsSync, readdirSync } from "fs";
9
+
10
+ // src/utils/presets.ts
11
+ var defaultContext = {
12
+ useEslint: false,
13
+ useRouter: false,
14
+ useStore: false
15
+ };
16
+ var baseContext = {
17
+ ...defaultContext,
18
+ useEslint: true,
19
+ useRouter: true
20
+ };
21
+ var essentialsContext = {
22
+ ...baseContext,
23
+ useStore: true
24
+ };
25
+ var presets = {
26
+ base: baseContext,
27
+ default: defaultContext,
28
+ essentials: essentialsContext
29
+ };
30
+
31
+ // src/utils/prompts.ts
32
+ import { red } from "kolorist";
33
+ import prompts from "prompts";
34
+ 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: false
96
+ }
97
+ ];
98
+ var promptOptions = {
99
+ onCancel: () => {
100
+ throw new Error(red("\u2716") + " Operation cancelled");
101
+ }
102
+ };
103
+ var initPrompts = async (context) => {
104
+ if (context.usePreset) {
105
+ context = {
106
+ ...context,
107
+ ...presets[context.usePreset]
108
+ };
109
+ }
110
+ const answers = await prompts(promptQuestions(context), promptOptions);
111
+ return {
112
+ ...context,
113
+ ...answers
114
+ };
115
+ };
116
+
117
+ // src/index.ts
118
+ import { red as red2 } from "kolorist";
119
+ import minimist from "minimist";
120
+
121
+ // src/utils/installDependencies.ts
122
+ import { spawnSync } from "child_process";
123
+ function installDependencies(projectRoot, packageManager) {
124
+ const cmd = packageManager === "npm" ? "npm install" : packageManager === "yarn" ? "yarn" : packageManager === "bun" ? "bun install" : "pnpm install";
125
+ const spawn = spawnSync(cmd, {
126
+ cwd: projectRoot,
127
+ stdio: ["inherit", "inherit", "pipe"],
128
+ shell: true
129
+ });
130
+ if (spawn.error) {
131
+ throw spawn.error;
132
+ }
133
+ }
134
+
135
+ // src/utils/renderTemplate.ts
136
+ import { copyFileSync, mkdirSync, readdirSync as readdirSync2, readFileSync, statSync, writeFileSync } from "fs";
137
+ import { basename, dirname, resolve as resolve2 } from "path";
138
+
139
+ // src/utils/deepMerge.ts
140
+ var isObject = (v) => {
141
+ return v === Object(v) && v !== null && !Array.isArray(v);
142
+ };
143
+ var deepMerge = (...sources) => sources.reduce((acc, curr) => {
144
+ Object.keys(curr).forEach((key) => {
145
+ if (Array.isArray(acc[key]) && Array.isArray(curr[key])) {
146
+ acc[key] = Array.from(new Set(acc[key].concat(curr[key])));
147
+ } else if (isObject(acc[key]) && isObject(curr[key])) {
148
+ acc[key] = deepMerge(acc[key], curr[key]);
149
+ } else {
150
+ acc[key] = curr[key];
151
+ }
152
+ });
153
+ return acc;
154
+ }, {});
155
+
156
+ // src/utils/renderTemplate.ts
157
+ function mergePkg(source, destination) {
158
+ const target = JSON.parse(readFileSync(destination, "utf8"));
159
+ const src = JSON.parse(readFileSync(source, "utf8"));
160
+ const mergedPkg = deepMerge(target, src);
161
+ const keysToSort = ["devDependencies", "dependencies"];
162
+ keysToSort.forEach((k) => {
163
+ mergedPkg[k] = Object.keys(mergedPkg[k]).sort().reduce((a, c) => (a[c] = mergedPkg[k][c], a), {});
164
+ });
165
+ writeFileSync(destination, JSON.stringify(mergedPkg, null, 2) + "\n");
166
+ }
167
+ function renderDirectory(source, destination) {
168
+ mkdirSync(destination, { recursive: true });
169
+ readdirSync2(source).forEach((path) => renderTemplate(resolve2(source, path), resolve2(destination, path)));
170
+ }
171
+ function renderFile(source, destination) {
172
+ const filename = basename(source);
173
+ if (filename.startsWith("_"))
174
+ destination = resolve2(dirname(destination), filename.replace("_", "."));
175
+ if (filename === "package.json")
176
+ mergePkg(source, destination);
177
+ else
178
+ copyFileSync(source, destination);
179
+ }
180
+ function renderTemplate(source, destination) {
181
+ if (statSync(source).isDirectory()) {
182
+ renderDirectory(source, destination);
183
+ } else {
184
+ renderFile(source, destination);
185
+ }
186
+ }
187
+
188
+ // src/index.ts
189
+ var validPresets = ["base", "custom", "default", "essentials"];
190
+ async function run() {
191
+ const argv = minimist(process.argv.slice(2), {
192
+ alias: {
193
+ "typescript": ["ts"]
194
+ }
195
+ });
196
+ if (argv.preset && !validPresets.includes(argv.preset)) {
197
+ throw new Error(`'${argv.preset}' is not a valid preset. Valid presets are: ${validPresets.join(", ")}.`);
198
+ }
199
+ 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";
200
+ console.log(`
201
+ ${banner}
202
+ `);
203
+ const context = {
204
+ canOverwrite: false,
205
+ cwd: process.cwd(),
206
+ projectName: "vuetify-project",
207
+ useRouter: false,
208
+ useTypeScript: argv.typescript,
209
+ usePreset: argv.preset,
210
+ useStore: void 0,
211
+ usePackageManager: void 0
212
+ };
213
+ const {
214
+ canOverwrite,
215
+ cwd,
216
+ projectName,
217
+ useTypeScript,
218
+ usePackageManager,
219
+ installDependencies: installDeps,
220
+ usePreset
221
+ } = await initPrompts(context);
222
+ const projectRoot = join2(cwd, projectName);
223
+ if (canOverwrite) {
224
+ rmSync(projectRoot, { recursive: true });
225
+ }
226
+ mkdirSync2(projectRoot);
227
+ writeFileSync2(resolve3(projectRoot, "package.json"), JSON.stringify({ name: projectName }, null, 2));
228
+ const jsOrTs = useTypeScript ? "typescript" : "javascript";
229
+ let templatePath = resolve3(dirname2(fileURLToPath(import.meta.url)), "../template", jsOrTs);
230
+ console.log("\n\u25CC Generating scaffold...");
231
+ renderTemplate(resolve3(templatePath, "default"), projectRoot);
232
+ if (["base", "essentials"].includes(usePreset)) {
233
+ renderTemplate(resolve3(templatePath, "base"), projectRoot);
234
+ }
235
+ if (["essentials", "recommended"].includes(usePreset)) {
236
+ renderTemplate(resolve3(templatePath, "essentials"), projectRoot);
237
+ }
238
+ if (usePackageManager && installDeps) {
239
+ console.log(`\u25CC Installing dependencies with ${usePackageManager}...
240
+ `);
241
+ installDependencies(projectRoot, usePackageManager);
242
+ }
243
+ console.log(`
244
+ ${projectName} has been generated at ${projectRoot}
245
+ `);
246
+ }
247
+ run().then(() => {
248
+ console.log("Discord community: https://community.vuetifyjs.com");
249
+ console.log("Github: https://github.com/vuetifyjs/vuetify");
250
+ console.log("Support Vuetify: https://github.com/sponsors/johnleider");
251
+ }).catch((err) => {
252
+ console.error(`
253
+ ${red2("\u2716")} ${err}
254
+ `);
255
+ process.exit(1);
256
+ });
package/index.js ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ import './dist/index.mjs'
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "create-vuetify",
3
- "version": "2.2.1",
4
- "main": "dist/output.cjs",
3
+ "version": "2.2.2",
5
4
  "author": "Elijah Kotyluk <elijah@elijahkotyluk.com>",
6
5
  "license": "MIT",
7
6
  "type": "module",
8
7
  "bin": {
9
- "create-vuetify": "./dist/output.cjs"
8
+ "create-vuetify": "index.js"
10
9
  },
11
10
  "files": [
12
- "dist/output.cjs",
13
- "template"
11
+ "index.js",
12
+ "template",
13
+ "dist"
14
14
  ],
15
15
  "repository": {
16
16
  "type": "git",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "scripts": {
23
23
  "build": "node ./scripts/build.js",
24
- "start": "node ./dist/output.cjs",
24
+ "start": "node ./index.js",
25
25
  "lint": "eslint --fix 'src/**'",
26
26
  "prepublishOnly": "npm run build"
27
27
  },
@@ -4,7 +4,7 @@
4
4
  "target": "es5",
5
5
  "module": "esnext",
6
6
  "baseUrl": "./",
7
- "moduleResolution": "node",
7
+ "moduleResolution": "bundler",
8
8
  "paths": {
9
9
  "@/*": [
10
10
  "src/*"
@@ -5,7 +5,7 @@
5
5
  "lib": ["DOM", "ESNext"],
6
6
  "baseUrl": ".",
7
7
  "module": "ESNext",
8
- "moduleResolution": "node",
8
+ "moduleResolution": "bundler",
9
9
  "paths": {
10
10
  "@/*": ["src/*"]
11
11
  },
@@ -2,7 +2,7 @@
2
2
  "compilerOptions": {
3
3
  "composite": true,
4
4
  "module": "ESNext",
5
- "moduleResolution": "Node",
5
+ "moduleResolution": "bundler",
6
6
  "allowSyntheticDefaultImports": true
7
7
  },
8
8
  "include": ["vite.config.mts"]