create-vuetify 1.0.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/README.md +41 -0
- package/dist/output.cjs +199 -0
- package/package.json +50 -0
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# create-vuetify
|
|
2
|
+
|
|
3
|
+
## Flags
|
|
4
|
+
|
|
5
|
+
`create-vuetify` provides flags that can be passed when using the CLI to generate a new project.
|
|
6
|
+
|
|
7
|
+
| **Flags** | **Values** | **Example** |
|
|
8
|
+
|:---------------|-----------------------------------|-----------------------------------------|
|
|
9
|
+
| `preset` | `default, base, essentials` | `--preset="default" or --preset default`|
|
|
10
|
+
| `typescript` | `boolean` | `--typescript` |
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## 💪 Supporting Vuetify
|
|
14
|
+
|
|
15
|
+
<p>Vuetify is an open source MIT project that has been made possible due to the generous contributions by <a href="https://github.com/vuetifyjs/vuetify/blob/dev/BACKERS.md">community backers</a>. If you are interested in supporting this project, please consider:</p>
|
|
16
|
+
|
|
17
|
+
<ul>
|
|
18
|
+
<li>
|
|
19
|
+
<a href="https://github.com/users/johnleider/sponsorship">Becoming a sponsor on Github</a>
|
|
20
|
+
<strong><small>(supports John)</small></strong>
|
|
21
|
+
</li>
|
|
22
|
+
<li>
|
|
23
|
+
<a href="https://opencollective.com/vuetify">Becoming a backer on OpenCollective</a>
|
|
24
|
+
<strong><small>(supports the Dev team)</small></strong>
|
|
25
|
+
</li>
|
|
26
|
+
<li>
|
|
27
|
+
<a href="https://tidelift.com/subscription/npm/vuetify?utm_source=vuetify&utm_medium=referral&utm_campaign=readme">Become a subscriber on Tidelift</a>
|
|
28
|
+
</li>
|
|
29
|
+
<li>
|
|
30
|
+
<a href="https://paypal.me/vuetify">Make a one-time payment with Paypal</a>
|
|
31
|
+
</li>
|
|
32
|
+
<li>
|
|
33
|
+
<a href="https://vuetifyjs.com/getting-started/consulting-and-support?ref=github">Book time with the Team</a>
|
|
34
|
+
</li>
|
|
35
|
+
</ul>
|
|
36
|
+
|
|
37
|
+
### 📑 License
|
|
38
|
+
|
|
39
|
+
[MIT](http://opensource.org/licenses/MIT)
|
|
40
|
+
|
|
41
|
+
Copyright (c) 2016-present Vuetify, LLC
|
package/dist/output.cjs
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
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_path2 = require("path");
|
|
21
|
+
var import_fs2 = require("fs");
|
|
22
|
+
var import_kolorist = require("kolorist");
|
|
23
|
+
var import_minimist = __toESM(require("minimist"), 1);
|
|
24
|
+
var import_prompts = __toESM(require("prompts"), 1);
|
|
25
|
+
var import_validate_npm_package_name = __toESM(require("validate-npm-package-name"), 1);
|
|
26
|
+
|
|
27
|
+
// src/utils/installDependencies.ts
|
|
28
|
+
var import_child_process = require("child_process");
|
|
29
|
+
function installDependencies(projectRoot, packageManager) {
|
|
30
|
+
const cmd = packageManager === "npm" ? "npm install" : packageManager === "yarn" ? "yarn" : "pnpm install";
|
|
31
|
+
const spawn = (0, import_child_process.spawnSync)(cmd, {
|
|
32
|
+
cwd: projectRoot,
|
|
33
|
+
stdio: ["inherit", "inherit", "pipe"],
|
|
34
|
+
shell: true
|
|
35
|
+
});
|
|
36
|
+
if (spawn.error) {
|
|
37
|
+
throw spawn.error;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// src/utils/renderTemplate.ts
|
|
42
|
+
var import_fs = require("fs");
|
|
43
|
+
var import_path = require("path");
|
|
44
|
+
|
|
45
|
+
// src/utils/deepMerge.ts
|
|
46
|
+
var isObject = (v) => {
|
|
47
|
+
return v === Object(v) && v !== null && !Array.isArray(v);
|
|
48
|
+
};
|
|
49
|
+
var deepMerge = (...sources) => sources.reduce((acc, curr) => {
|
|
50
|
+
Object.keys(curr).forEach((key) => {
|
|
51
|
+
if (Array.isArray(acc[key]) && Array.isArray(curr[key])) {
|
|
52
|
+
acc[key] = Array.from(new Set(acc[key].concat(curr[key])));
|
|
53
|
+
} else if (isObject(acc[key]) && isObject(curr[key])) {
|
|
54
|
+
acc[key] = deepMerge(acc[key], curr[key]);
|
|
55
|
+
} else {
|
|
56
|
+
acc[key] = curr[key];
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
return acc;
|
|
60
|
+
}, {});
|
|
61
|
+
|
|
62
|
+
// src/utils/renderTemplate.ts
|
|
63
|
+
function mergePkg(source, destination) {
|
|
64
|
+
const target = JSON.parse((0, import_fs.readFileSync)(destination, "utf8"));
|
|
65
|
+
const src = JSON.parse((0, import_fs.readFileSync)(source, "utf8"));
|
|
66
|
+
const mergedPkg = deepMerge(target, src);
|
|
67
|
+
(0, import_fs.writeFileSync)(destination, JSON.stringify(mergedPkg, null, 2) + "\n");
|
|
68
|
+
}
|
|
69
|
+
function renderDirectory(source, destination) {
|
|
70
|
+
(0, import_fs.mkdirSync)(destination, { recursive: true });
|
|
71
|
+
(0, import_fs.readdirSync)(source).forEach((path) => renderTemplate((0, import_path.resolve)(source, path), (0, import_path.resolve)(destination, path)));
|
|
72
|
+
}
|
|
73
|
+
function renderFile(source, destination) {
|
|
74
|
+
const filename = (0, import_path.basename)(source);
|
|
75
|
+
if (filename.startsWith("_"))
|
|
76
|
+
destination = (0, import_path.resolve)((0, import_path.dirname)(destination), filename.replace("_", "."));
|
|
77
|
+
if (filename === "package.json")
|
|
78
|
+
mergePkg(source, destination);
|
|
79
|
+
else
|
|
80
|
+
(0, import_fs.copyFileSync)(source, destination);
|
|
81
|
+
}
|
|
82
|
+
function renderTemplate(source, destination) {
|
|
83
|
+
if ((0, import_fs.statSync)(source).isDirectory()) {
|
|
84
|
+
renderDirectory(source, destination);
|
|
85
|
+
} else {
|
|
86
|
+
renderFile(source, destination);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// src/index.ts
|
|
91
|
+
var validPresets = ["base", "default", "essentials"];
|
|
92
|
+
async function run() {
|
|
93
|
+
const cwd = process.cwd();
|
|
94
|
+
const argv = (0, import_minimist.default)(process.argv.slice(2), {
|
|
95
|
+
alias: {
|
|
96
|
+
"typescript": ["ts"]
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
if (argv.preset && !validPresets.includes(argv.preset)) {
|
|
100
|
+
throw new Error(`'${argv.preset}' is not a valid preset. Valid presets are: 'default', 'base', 'essentials'.`);
|
|
101
|
+
}
|
|
102
|
+
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";
|
|
103
|
+
console.log(`
|
|
104
|
+
${banner}
|
|
105
|
+
`);
|
|
106
|
+
let context = {
|
|
107
|
+
projectName: void 0,
|
|
108
|
+
canOverwrite: void 0,
|
|
109
|
+
useTypeScript: argv.typescript,
|
|
110
|
+
usePackageManager: void 0
|
|
111
|
+
};
|
|
112
|
+
try {
|
|
113
|
+
context = await (0, import_prompts.default)([
|
|
114
|
+
{
|
|
115
|
+
name: "projectName",
|
|
116
|
+
type: "text",
|
|
117
|
+
message: "Project name:",
|
|
118
|
+
initial: "vuetify-project",
|
|
119
|
+
validate: (v) => {
|
|
120
|
+
const { errors } = (0, import_validate_npm_package_name.default)(String(v).trim());
|
|
121
|
+
return !(errors && errors.length) || `Package ${errors[0]}`;
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: "canOverwrite",
|
|
126
|
+
active: "Yes",
|
|
127
|
+
inactive: "No",
|
|
128
|
+
initial: false,
|
|
129
|
+
type: (_, { projectName: projectName2 }) => {
|
|
130
|
+
const projectPath = (0, import_path2.join)(cwd, projectName2);
|
|
131
|
+
return !(0, import_fs2.existsSync)(projectPath) || (0, import_fs2.readdirSync)(projectPath).length === 0 ? null : "toggle";
|
|
132
|
+
},
|
|
133
|
+
message: (prev) => `The project path: ${(0, import_path2.resolve)(cwd, prev)} already exists, would you like to overwrite this directory?`
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
name: "useTypeScript",
|
|
137
|
+
type: context.useTypeScript ? null : "toggle",
|
|
138
|
+
message: "Use TypeScript?",
|
|
139
|
+
active: "Yes",
|
|
140
|
+
inactive: "No",
|
|
141
|
+
initial: false
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: "usePackageManager",
|
|
145
|
+
type: "select",
|
|
146
|
+
message: "Would you like to install dependencies with yarn, npm, or pnpm?",
|
|
147
|
+
initial: 0,
|
|
148
|
+
choices: [
|
|
149
|
+
{ title: "yarn", value: "yarn" },
|
|
150
|
+
{ title: "npm", value: "npm" },
|
|
151
|
+
{ title: "pnpm", value: "pnpm" },
|
|
152
|
+
{ title: "none", value: null }
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
], {
|
|
156
|
+
onCancel: () => {
|
|
157
|
+
throw new Error((0, import_kolorist.red)("\u2716") + " Operation cancelled");
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
} catch (err) {
|
|
161
|
+
throw err;
|
|
162
|
+
}
|
|
163
|
+
const {
|
|
164
|
+
canOverwrite,
|
|
165
|
+
projectName,
|
|
166
|
+
useTypeScript,
|
|
167
|
+
usePackageManager
|
|
168
|
+
} = context;
|
|
169
|
+
const projectRoot = (0, import_path2.join)(cwd, projectName);
|
|
170
|
+
if (canOverwrite) {
|
|
171
|
+
(0, import_fs2.rmSync)(projectRoot, { recursive: true });
|
|
172
|
+
}
|
|
173
|
+
(0, import_fs2.mkdirSync)(projectRoot);
|
|
174
|
+
const rootPkg = { name: projectName };
|
|
175
|
+
(0, import_fs2.writeFileSync)((0, import_path2.resolve)(projectRoot, "package.json"), JSON.stringify(rootPkg, null, 2));
|
|
176
|
+
const rootTemplatePath = (0, import_path2.resolve)(cwd, "template");
|
|
177
|
+
const jsOrTs = useTypeScript || argv.typescript ? "typescript" : "javascript";
|
|
178
|
+
const preset = !!argv.preset ? argv.preset : "default";
|
|
179
|
+
console.log("\n\u25CC Generating scaffold...");
|
|
180
|
+
renderTemplate((0, import_path2.resolve)(rootTemplatePath, jsOrTs, preset), projectRoot);
|
|
181
|
+
if (usePackageManager) {
|
|
182
|
+
console.log(`\u25CC Installing dependencies with ${usePackageManager}...
|
|
183
|
+
`);
|
|
184
|
+
installDependencies(projectRoot, usePackageManager);
|
|
185
|
+
}
|
|
186
|
+
console.log(`
|
|
187
|
+
${projectName} has been generated at ${projectRoot}
|
|
188
|
+
`);
|
|
189
|
+
}
|
|
190
|
+
run().then(() => {
|
|
191
|
+
console.log("Discord community: https://community.vuetifyjs.com");
|
|
192
|
+
console.log("Github: https://github.com/vuetifyjs/vuetify");
|
|
193
|
+
console.log("Support Vuetify: https://github.com/sponsors/johnleider");
|
|
194
|
+
}).catch((err) => {
|
|
195
|
+
console.error(`
|
|
196
|
+
${(0, import_kolorist.red)("\u2716")} ${err}
|
|
197
|
+
`);
|
|
198
|
+
process.exit();
|
|
199
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-vuetify",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "dist/output.cjs",
|
|
5
|
+
"author": "Elijah Kotyluk <elijah@elijahkotyluk.com>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"bin": {
|
|
9
|
+
"create-vuetify": "./dist/output.cjs"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"./dist/output.cjs",
|
|
13
|
+
"./template"
|
|
14
|
+
],
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/vuetifyjs/create-vuetify.git"
|
|
18
|
+
},
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/vuetifyjs/create-vuetify/issues"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "node ./scripts/build.js",
|
|
24
|
+
"start": "node ./dist/output.cjs",
|
|
25
|
+
"lint": "eslint --fix 'src/**'",
|
|
26
|
+
"prepublishOnly": "npm run build"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"kolorist": "^1.5.1",
|
|
30
|
+
"minimist": "^1.2.6",
|
|
31
|
+
"prompts": "^2.4.2",
|
|
32
|
+
"validate-npm-package-name": "^4.0.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/minimist": "^1.2.2",
|
|
36
|
+
"@types/prompts": "^2.0.14",
|
|
37
|
+
"@types/validate-npm-package-name": "^4.0.0",
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "^5.30.6",
|
|
39
|
+
"@typescript-eslint/parser": "^5.30.6",
|
|
40
|
+
"esbuild": "^0.14.47",
|
|
41
|
+
"esbuild-jest": "^0.5.0",
|
|
42
|
+
"eslint": "^8.19.0",
|
|
43
|
+
"eslint-plugin-jest": "^26.5.3",
|
|
44
|
+
"eslint-plugin-local-rules": "^1.3.0",
|
|
45
|
+
"eslint-plugin-lodash-template": "^0.21.0",
|
|
46
|
+
"husky": "^8.0.1",
|
|
47
|
+
"lint-staged": "^13.0.3",
|
|
48
|
+
"typescript": "^4.7.4"
|
|
49
|
+
}
|
|
50
|
+
}
|