create-vuetify 2.2.6 → 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 +4 -7
- package/template/javascript/base/vite.config.mjs +7 -0
- package/template/javascript/default/index.html +10 -13
- package/template/javascript/default/package.json +6 -3
- package/template/javascript/default/vite.config.mjs +7 -0
- package/template/javascript/essentials/package.json +0 -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 +5 -9
- 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 +18 -10
- 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/env.d.ts +3 -0
- package/template/typescript/essentials/package.json +0 -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/javascript/essentials/_eslintrc.js +0 -19
- 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/_eslintrc.js +0 -20
- package/template/typescript/essentials/tsconfig.json +0 -33
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-container class="fill-height">
|
|
3
|
+
<v-responsive
|
|
4
|
+
class="align-centerfill-height mx-auto"
|
|
5
|
+
max-width="900"
|
|
6
|
+
>
|
|
7
|
+
<v-img
|
|
8
|
+
class="mb-4"
|
|
9
|
+
height="150"
|
|
10
|
+
src="~/assets/logo.png"
|
|
11
|
+
/>
|
|
12
|
+
|
|
13
|
+
<div class="text-center">
|
|
14
|
+
<div class="text-body-2 font-weight-light mb-n1">Welcome to</div>
|
|
15
|
+
|
|
16
|
+
<h1 class="text-h2 font-weight-bold">Vuetify</h1>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<div class="py-4" />
|
|
20
|
+
|
|
21
|
+
<v-row>
|
|
22
|
+
<v-col cols="12">
|
|
23
|
+
<v-card
|
|
24
|
+
class="py-4"
|
|
25
|
+
color="surface-variant"
|
|
26
|
+
image="https://cdn.vuetifyjs.com/docs/images/one/create/feature.png"
|
|
27
|
+
prepend-icon="mdi-rocket-launch-outline"
|
|
28
|
+
rounded="lg"
|
|
29
|
+
variant="outlined"
|
|
30
|
+
>
|
|
31
|
+
<template #image>
|
|
32
|
+
<v-img position="top right" />
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<template #title>
|
|
36
|
+
<h2 class="text-h5 font-weight-bold">Get started</h2>
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<template #subtitle>
|
|
40
|
+
<div class="text-subtitle-1">
|
|
41
|
+
Change this page by updating <v-kbd>{{ `<HelloWorld />` }}</v-kbd> in <v-kbd>components/HelloWorld.vue</v-kbd>.
|
|
42
|
+
</div>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<v-overlay
|
|
46
|
+
opacity=".12"
|
|
47
|
+
scrim="primary"
|
|
48
|
+
contained
|
|
49
|
+
model-value
|
|
50
|
+
persistent
|
|
51
|
+
/>
|
|
52
|
+
</v-card>
|
|
53
|
+
</v-col>
|
|
54
|
+
|
|
55
|
+
<v-col cols="6">
|
|
56
|
+
<v-card
|
|
57
|
+
append-icon="mdi-open-in-new"
|
|
58
|
+
class="py-4"
|
|
59
|
+
color="surface-variant"
|
|
60
|
+
href="https://vuetifyjs.com/"
|
|
61
|
+
prepend-icon="mdi-text-box-outline"
|
|
62
|
+
rel="noopener noreferrer"
|
|
63
|
+
rounded="lg"
|
|
64
|
+
subtitle="Learn about all things Vuetify in our documentation."
|
|
65
|
+
target="_blank"
|
|
66
|
+
title="Documentation"
|
|
67
|
+
variant="text"
|
|
68
|
+
>
|
|
69
|
+
<v-overlay
|
|
70
|
+
opacity=".06"
|
|
71
|
+
scrim="primary"
|
|
72
|
+
contained
|
|
73
|
+
model-value
|
|
74
|
+
persistent
|
|
75
|
+
/>
|
|
76
|
+
</v-card>
|
|
77
|
+
</v-col>
|
|
78
|
+
|
|
79
|
+
<v-col cols="6">
|
|
80
|
+
<v-card
|
|
81
|
+
append-icon="mdi-open-in-new"
|
|
82
|
+
class="py-4"
|
|
83
|
+
color="surface-variant"
|
|
84
|
+
href="https://vuetifyjs.com/introduction/why-vuetify/#feature-guides"
|
|
85
|
+
prepend-icon="mdi-star-circle-outline"
|
|
86
|
+
rel="noopener noreferrer"
|
|
87
|
+
rounded="lg"
|
|
88
|
+
subtitle="Explore available framework Features."
|
|
89
|
+
target="_blank"
|
|
90
|
+
title="Features"
|
|
91
|
+
variant="text"
|
|
92
|
+
>
|
|
93
|
+
<v-overlay
|
|
94
|
+
opacity=".06"
|
|
95
|
+
scrim="primary"
|
|
96
|
+
contained
|
|
97
|
+
model-value
|
|
98
|
+
persistent
|
|
99
|
+
/>
|
|
100
|
+
</v-card>
|
|
101
|
+
</v-col>
|
|
102
|
+
|
|
103
|
+
<v-col cols="6">
|
|
104
|
+
<v-card
|
|
105
|
+
append-icon="mdi-open-in-new"
|
|
106
|
+
class="py-4"
|
|
107
|
+
color="surface-variant"
|
|
108
|
+
href="https://vuetifyjs.com/components/all"
|
|
109
|
+
prepend-icon="mdi-widgets-outline"
|
|
110
|
+
rel="noopener noreferrer"
|
|
111
|
+
rounded="lg"
|
|
112
|
+
subtitle="Discover components in the API Explorer."
|
|
113
|
+
target="_blank"
|
|
114
|
+
title="Components"
|
|
115
|
+
variant="text"
|
|
116
|
+
>
|
|
117
|
+
<v-overlay
|
|
118
|
+
opacity=".06"
|
|
119
|
+
scrim="primary"
|
|
120
|
+
contained
|
|
121
|
+
model-value
|
|
122
|
+
persistent
|
|
123
|
+
/>
|
|
124
|
+
</v-card>
|
|
125
|
+
</v-col>
|
|
126
|
+
|
|
127
|
+
<v-col cols="6">
|
|
128
|
+
<v-card
|
|
129
|
+
append-icon="mdi-open-in-new"
|
|
130
|
+
class="py-4"
|
|
131
|
+
color="surface-variant"
|
|
132
|
+
href="https://discord.vuetifyjs.com"
|
|
133
|
+
prepend-icon="mdi-account-group-outline"
|
|
134
|
+
rel="noopener noreferrer"
|
|
135
|
+
rounded="lg"
|
|
136
|
+
subtitle="Connect with Vuetify developers."
|
|
137
|
+
target="_blank"
|
|
138
|
+
title="Community"
|
|
139
|
+
variant="text"
|
|
140
|
+
>
|
|
141
|
+
<v-overlay
|
|
142
|
+
opacity=".06"
|
|
143
|
+
scrim="primary"
|
|
144
|
+
contained
|
|
145
|
+
model-value
|
|
146
|
+
persistent
|
|
147
|
+
/>
|
|
148
|
+
</v-card>
|
|
149
|
+
</v-col>
|
|
150
|
+
</v-row>
|
|
151
|
+
</v-responsive>
|
|
152
|
+
</v-container>
|
|
153
|
+
</template>
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { defineNuxtModule } from '@nuxt/kit'
|
|
2
|
+
import type { Options as ModuleOptions } from '@vuetify/loader-shared'
|
|
3
|
+
import vuetify, { transformAssetUrls } from 'vite-plugin-vuetify'
|
|
4
|
+
import path from 'upath'
|
|
5
|
+
import { resolveVuetifyBase, isObject } from '@vuetify/loader-shared'
|
|
6
|
+
import { pathToFileURL } from 'node:url'
|
|
7
|
+
|
|
8
|
+
export type { ModuleOptions }
|
|
9
|
+
|
|
10
|
+
// WARNING: Remove the file from modules directory if you install vuetify-nuxt-module
|
|
11
|
+
export default defineNuxtModule<ModuleOptions>({
|
|
12
|
+
meta: {
|
|
13
|
+
name: 'vuetify-module',
|
|
14
|
+
configKey: 'vuetify',
|
|
15
|
+
},
|
|
16
|
+
defaults: () => ({ styles: true }),
|
|
17
|
+
setup(options, nuxt) {
|
|
18
|
+
let configFile: string | undefined
|
|
19
|
+
const vuetifyBase = resolveVuetifyBase()
|
|
20
|
+
const noneFiles = new Set<string>()
|
|
21
|
+
let isNone = false
|
|
22
|
+
let sassVariables = false
|
|
23
|
+
const PREFIX = 'vuetify-styles/'
|
|
24
|
+
const SSR_PREFIX = `/@${PREFIX}`
|
|
25
|
+
|
|
26
|
+
nuxt.hook('vite:extendConfig', (viteInlineConfig) => {
|
|
27
|
+
// add vuetify transformAssetUrls
|
|
28
|
+
viteInlineConfig.vue ??= {}
|
|
29
|
+
viteInlineConfig.vue.template ??= {}
|
|
30
|
+
viteInlineConfig.vue.template.transformAssetUrls = transformAssetUrls
|
|
31
|
+
|
|
32
|
+
viteInlineConfig.plugins = viteInlineConfig.plugins ?? []
|
|
33
|
+
viteInlineConfig.plugins.push(vuetify({
|
|
34
|
+
autoImport: options.autoImport,
|
|
35
|
+
styles: true,
|
|
36
|
+
}))
|
|
37
|
+
|
|
38
|
+
viteInlineConfig.css ??= {}
|
|
39
|
+
viteInlineConfig.css.preprocessorOptions ??= {}
|
|
40
|
+
viteInlineConfig.css.preprocessorOptions.sass ??= {}
|
|
41
|
+
viteInlineConfig.css.preprocessorOptions.sass.api = 'modern-compiler'
|
|
42
|
+
|
|
43
|
+
viteInlineConfig.plugins.push({
|
|
44
|
+
name: 'vuetify:nuxt:styles',
|
|
45
|
+
enforce: 'pre',
|
|
46
|
+
async configResolved (config) {
|
|
47
|
+
if (isObject(options.styles)) {
|
|
48
|
+
sassVariables = true
|
|
49
|
+
if (path.isAbsolute(options.styles.configFile)) {
|
|
50
|
+
configFile = path.resolve(options.styles.configFile)
|
|
51
|
+
} else {
|
|
52
|
+
configFile = path.resolve(path.join(config.root || process.cwd(), options.styles.configFile))
|
|
53
|
+
}
|
|
54
|
+
configFile = pathToFileURL(configFile).href
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
isNone = options.styles === 'none'
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
async resolveId (source, importer, { custom, ssr }) {
|
|
61
|
+
if (source.startsWith(PREFIX) || source.startsWith(SSR_PREFIX)) {
|
|
62
|
+
if (source.endsWith('.sass')) {
|
|
63
|
+
return source
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const idx = source.indexOf('?')
|
|
67
|
+
return idx > -1 ? source.slice(0, idx) : source
|
|
68
|
+
}
|
|
69
|
+
if (
|
|
70
|
+
source === 'vuetify/styles' || (
|
|
71
|
+
importer &&
|
|
72
|
+
source.endsWith('.css') &&
|
|
73
|
+
isSubdir(vuetifyBase, path.isAbsolute(source) ? source : importer)
|
|
74
|
+
)
|
|
75
|
+
) {
|
|
76
|
+
if (options.styles === 'sass') {
|
|
77
|
+
const target = source.replace(/\.css$/, '.sass')
|
|
78
|
+
return this.resolve(target, importer, { skipSelf: true, custom })
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const resolution = await this.resolve(source, importer, { skipSelf: true, custom })
|
|
82
|
+
|
|
83
|
+
if (!resolution)
|
|
84
|
+
return undefined
|
|
85
|
+
|
|
86
|
+
const target = resolution.id.replace(/\.css$/, '.sass')
|
|
87
|
+
if (isNone) {
|
|
88
|
+
noneFiles.add(target)
|
|
89
|
+
return target
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return `${ssr ? SSR_PREFIX: PREFIX}${path.relative(vuetifyBase, target)}`
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return undefined
|
|
96
|
+
},
|
|
97
|
+
load(id){
|
|
98
|
+
if (sassVariables) {
|
|
99
|
+
const target = id.startsWith(PREFIX)
|
|
100
|
+
? path.resolve(vuetifyBase, id.slice(PREFIX.length))
|
|
101
|
+
: id.startsWith(SSR_PREFIX)
|
|
102
|
+
? path.resolve(vuetifyBase, id.slice(SSR_PREFIX.length))
|
|
103
|
+
: undefined
|
|
104
|
+
|
|
105
|
+
if (target) {
|
|
106
|
+
return {
|
|
107
|
+
code: `@use "${configFile}"\n@use "${pathToFileURL(target).href}"`,
|
|
108
|
+
map: {
|
|
109
|
+
mappings: '',
|
|
110
|
+
},
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return isNone && noneFiles.has(id) ? '' : undefined
|
|
116
|
+
},
|
|
117
|
+
})
|
|
118
|
+
})
|
|
119
|
+
}
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
function isSubdir (root: string, test: string) {
|
|
123
|
+
const relative = path.relative(root, test)
|
|
124
|
+
return relative && !relative.startsWith('..') && !path.isAbsolute(relative)
|
|
125
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export default defineNuxtPlugin((nuxtApp) => {
|
|
2
|
+
// check https://vuetify-nuxt-module.netlify.app/guide/nuxt-runtime-hooks.html
|
|
3
|
+
nuxtApp.hook('vuetify:before-create', (options) => {
|
|
4
|
+
if (import.meta.client) {
|
|
5
|
+
console.log('vuetify:before-create', options)
|
|
6
|
+
}
|
|
7
|
+
})
|
|
8
|
+
})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createVuetify } from 'vuetify'
|
|
2
|
+
|
|
3
|
+
export default defineNuxtPlugin((nuxtApp) => {
|
|
4
|
+
const vuetify = createVuetify({
|
|
5
|
+
// WARNING: when switching ssr option in nuxt.config.ts file you need to manually change it here
|
|
6
|
+
ssr: true,
|
|
7
|
+
// your Vuetify options here
|
|
8
|
+
theme: {
|
|
9
|
+
defaultTheme: 'dark',
|
|
10
|
+
},
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
nuxtApp.vueApp.use(vuetify);
|
|
14
|
+
})
|
package/dist/output.cjs
DELETED
|
@@ -1,264 +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: 0,
|
|
79
|
-
choices: [
|
|
80
|
-
{ title: "Default (Vuetify)", value: "default" },
|
|
81
|
-
{ title: "Base (Default, Routing)", value: "base" },
|
|
82
|
-
{ title: "Essentials (Base, Layouts, Pinia)", value: "essentials" }
|
|
83
|
-
]
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
name: "useTypeScript",
|
|
87
|
-
type: context.useTypeScript ? null : "toggle",
|
|
88
|
-
message: "Use TypeScript?",
|
|
89
|
-
active: "Yes",
|
|
90
|
-
inactive: "No",
|
|
91
|
-
initial: false
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
name: "usePackageManager",
|
|
95
|
-
type: "select",
|
|
96
|
-
message: "Would you like to install dependencies with yarn, npm, pnpm, or bun?",
|
|
97
|
-
initial: 0,
|
|
98
|
-
choices: [
|
|
99
|
-
{ title: "yarn", value: "yarn" },
|
|
100
|
-
{ title: "npm", value: "npm" },
|
|
101
|
-
{ title: "pnpm", value: "pnpm" },
|
|
102
|
-
{ title: "bun", value: "bun" },
|
|
103
|
-
{ title: "none", value: null }
|
|
104
|
-
]
|
|
105
|
-
}
|
|
106
|
-
];
|
|
107
|
-
var promptOptions = {
|
|
108
|
-
onCancel: () => {
|
|
109
|
-
throw new Error((0, import_kolorist.red)("\u2716") + " Operation cancelled");
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
var initPrompts = async (context) => {
|
|
113
|
-
if (context.usePreset && context.usePreset !== "custom") {
|
|
114
|
-
context = {
|
|
115
|
-
...context,
|
|
116
|
-
...presets[context.usePreset]
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
const answers = await (0, import_prompts.default)(promptQuestions(context), promptOptions);
|
|
120
|
-
return {
|
|
121
|
-
...context,
|
|
122
|
-
...answers
|
|
123
|
-
};
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
// src/index.ts
|
|
127
|
-
var import_kolorist2 = require("kolorist");
|
|
128
|
-
var import_minimist = __toESM(require("minimist"), 1);
|
|
129
|
-
|
|
130
|
-
// src/utils/installDependencies.ts
|
|
131
|
-
var import_child_process = require("child_process");
|
|
132
|
-
function installDependencies(projectRoot, packageManager) {
|
|
133
|
-
const cmd = packageManager === "npm" ? "npm install" : packageManager === "yarn" ? "yarn" : packageManager === "bun" ? "bun install" : "pnpm install";
|
|
134
|
-
const spawn = (0, import_child_process.spawnSync)(cmd, {
|
|
135
|
-
cwd: projectRoot,
|
|
136
|
-
stdio: ["inherit", "inherit", "pipe"],
|
|
137
|
-
shell: true
|
|
138
|
-
});
|
|
139
|
-
if (spawn.error) {
|
|
140
|
-
throw spawn.error;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// src/utils/renderTemplate.ts
|
|
145
|
-
var import_fs2 = require("fs");
|
|
146
|
-
var import_path2 = require("path");
|
|
147
|
-
|
|
148
|
-
// src/utils/deepMerge.ts
|
|
149
|
-
var isObject = (v) => {
|
|
150
|
-
return v === Object(v) && v !== null && !Array.isArray(v);
|
|
151
|
-
};
|
|
152
|
-
var deepMerge = (...sources) => sources.reduce((acc, curr) => {
|
|
153
|
-
Object.keys(curr).forEach((key) => {
|
|
154
|
-
if (Array.isArray(acc[key]) && Array.isArray(curr[key])) {
|
|
155
|
-
acc[key] = Array.from(new Set(acc[key].concat(curr[key])));
|
|
156
|
-
} else if (isObject(acc[key]) && isObject(curr[key])) {
|
|
157
|
-
acc[key] = deepMerge(acc[key], curr[key]);
|
|
158
|
-
} else {
|
|
159
|
-
acc[key] = curr[key];
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
return acc;
|
|
163
|
-
}, {});
|
|
164
|
-
|
|
165
|
-
// src/utils/renderTemplate.ts
|
|
166
|
-
function mergePkg(source, destination) {
|
|
167
|
-
const target = JSON.parse((0, import_fs2.readFileSync)(destination, "utf8"));
|
|
168
|
-
const src = JSON.parse((0, import_fs2.readFileSync)(source, "utf8"));
|
|
169
|
-
const mergedPkg = deepMerge(target, src);
|
|
170
|
-
const keysToSort = ["devDependencies", "dependencies"];
|
|
171
|
-
keysToSort.forEach((k) => {
|
|
172
|
-
mergedPkg[k] = Object.keys(mergedPkg[k]).sort().reduce((a, c) => (a[c] = mergedPkg[k][c], a), {});
|
|
173
|
-
});
|
|
174
|
-
(0, import_fs2.writeFileSync)(destination, JSON.stringify(mergedPkg, null, 2) + "\n");
|
|
175
|
-
}
|
|
176
|
-
function renderDirectory(source, destination) {
|
|
177
|
-
(0, import_fs2.mkdirSync)(destination, { recursive: true });
|
|
178
|
-
(0, import_fs2.readdirSync)(source).forEach((path) => renderTemplate((0, import_path2.resolve)(source, path), (0, import_path2.resolve)(destination, path)));
|
|
179
|
-
}
|
|
180
|
-
function renderFile(source, destination) {
|
|
181
|
-
const filename = (0, import_path2.basename)(source);
|
|
182
|
-
if (filename.startsWith("_"))
|
|
183
|
-
destination = (0, import_path2.resolve)((0, import_path2.dirname)(destination), filename.replace("_", "."));
|
|
184
|
-
if (filename === "package.json")
|
|
185
|
-
mergePkg(source, destination);
|
|
186
|
-
else
|
|
187
|
-
(0, import_fs2.copyFileSync)(source, destination);
|
|
188
|
-
}
|
|
189
|
-
function renderTemplate(source, destination) {
|
|
190
|
-
if ((0, import_fs2.statSync)(source).isDirectory()) {
|
|
191
|
-
renderDirectory(source, destination);
|
|
192
|
-
} else {
|
|
193
|
-
renderFile(source, destination);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
// src/index.ts
|
|
198
|
-
var validPresets = ["base", "custom", "default", "essentials"];
|
|
199
|
-
async function run() {
|
|
200
|
-
const argv = (0, import_minimist.default)(process.argv.slice(2), {
|
|
201
|
-
alias: {
|
|
202
|
-
"typescript": ["ts"]
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
if (argv.preset && !validPresets.includes(argv.preset)) {
|
|
206
|
-
throw new Error(`'${argv.preset}' is not a valid preset. Valid presets are: ${validPresets.join(", ")}.`);
|
|
207
|
-
}
|
|
208
|
-
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";
|
|
209
|
-
console.log(`
|
|
210
|
-
${banner}
|
|
211
|
-
`);
|
|
212
|
-
const context = {
|
|
213
|
-
canOverwrite: false,
|
|
214
|
-
cwd: process.cwd(),
|
|
215
|
-
projectName: "vuetify-project",
|
|
216
|
-
useRouter: false,
|
|
217
|
-
useTypeScript: argv.typescript,
|
|
218
|
-
usePreset: argv.preset,
|
|
219
|
-
useStore: void 0,
|
|
220
|
-
usePackageManager: void 0
|
|
221
|
-
};
|
|
222
|
-
const {
|
|
223
|
-
canOverwrite,
|
|
224
|
-
cwd,
|
|
225
|
-
projectName,
|
|
226
|
-
useTypeScript,
|
|
227
|
-
usePackageManager,
|
|
228
|
-
usePreset
|
|
229
|
-
} = await initPrompts(context);
|
|
230
|
-
const projectRoot = (0, import_path3.join)(cwd, projectName);
|
|
231
|
-
if (canOverwrite) {
|
|
232
|
-
(0, import_fs3.rmSync)(projectRoot, { recursive: true });
|
|
233
|
-
}
|
|
234
|
-
(0, import_fs3.mkdirSync)(projectRoot);
|
|
235
|
-
(0, import_fs3.writeFileSync)((0, import_path3.resolve)(projectRoot, "package.json"), JSON.stringify({ name: projectName }, null, 2));
|
|
236
|
-
const jsOrTs = useTypeScript ? "typescript" : "javascript";
|
|
237
|
-
let templatePath = (0, import_path3.resolve)(__dirname, "../template", jsOrTs);
|
|
238
|
-
console.log("\n\u25CC Generating scaffold...");
|
|
239
|
-
renderTemplate((0, import_path3.resolve)(templatePath, "default"), projectRoot);
|
|
240
|
-
if (["base", "essentials"].includes(usePreset)) {
|
|
241
|
-
renderTemplate((0, import_path3.resolve)(templatePath, "base"), projectRoot);
|
|
242
|
-
}
|
|
243
|
-
if (["essentials", "recommended"].includes(usePreset)) {
|
|
244
|
-
renderTemplate((0, import_path3.resolve)(templatePath, "essentials"), projectRoot);
|
|
245
|
-
}
|
|
246
|
-
if (usePackageManager) {
|
|
247
|
-
console.log(`\u25CC Installing dependencies with ${usePackageManager}...
|
|
248
|
-
`);
|
|
249
|
-
installDependencies(projectRoot, usePackageManager);
|
|
250
|
-
}
|
|
251
|
-
console.log(`
|
|
252
|
-
${projectName} has been generated at ${projectRoot}
|
|
253
|
-
`);
|
|
254
|
-
}
|
|
255
|
-
run().then(() => {
|
|
256
|
-
console.log("Discord community: https://community.vuetifyjs.com");
|
|
257
|
-
console.log("Github: https://github.com/vuetifyjs/vuetify");
|
|
258
|
-
console.log("Support Vuetify: https://github.com/sponsors/johnleider");
|
|
259
|
-
}).catch((err) => {
|
|
260
|
-
console.error(`
|
|
261
|
-
${(0, import_kolorist2.red)("\u2716")} ${err}
|
|
262
|
-
`);
|
|
263
|
-
process.exit(1);
|
|
264
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* .eslint.js
|
|
3
|
-
*
|
|
4
|
-
* ESLint configuration file.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
module.exports = {
|
|
8
|
-
root: true,
|
|
9
|
-
env: {
|
|
10
|
-
node: true,
|
|
11
|
-
},
|
|
12
|
-
extends: [
|
|
13
|
-
'vuetify',
|
|
14
|
-
'./.eslintrc-auto-import.json',
|
|
15
|
-
],
|
|
16
|
-
rules: {
|
|
17
|
-
'vue/multi-word-component-names': 'off',
|
|
18
|
-
},
|
|
19
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* .eslint.js
|
|
3
|
-
*
|
|
4
|
-
* ESLint configuration file.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
module.exports = {
|
|
8
|
-
root: true,
|
|
9
|
-
env: {
|
|
10
|
-
node: true,
|
|
11
|
-
},
|
|
12
|
-
extends: [
|
|
13
|
-
'plugin:vue/vue3-essential',
|
|
14
|
-
'eslint:recommended',
|
|
15
|
-
'@vue/eslint-config-typescript',
|
|
16
|
-
],
|
|
17
|
-
rules: {
|
|
18
|
-
'vue/multi-word-component-names': 'off',
|
|
19
|
-
},
|
|
20
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ESNext",
|
|
4
|
-
"jsx": "preserve",
|
|
5
|
-
"lib": ["DOM", "ESNext"],
|
|
6
|
-
"baseUrl": ".",
|
|
7
|
-
"module": "ESNext",
|
|
8
|
-
"moduleResolution": "bundler",
|
|
9
|
-
"paths": {
|
|
10
|
-
"@/*": ["src/*"]
|
|
11
|
-
},
|
|
12
|
-
"resolveJsonModule": true,
|
|
13
|
-
"types": [
|
|
14
|
-
"vite/client",
|
|
15
|
-
"unplugin-vue-router/client"
|
|
16
|
-
],
|
|
17
|
-
"allowJs": true,
|
|
18
|
-
"strict": true,
|
|
19
|
-
"strictNullChecks": true,
|
|
20
|
-
"noUnusedLocals": true,
|
|
21
|
-
"esModuleInterop": true,
|
|
22
|
-
"forceConsistentCasingInFileNames": true,
|
|
23
|
-
"isolatedModules": true,
|
|
24
|
-
"skipLibCheck": true
|
|
25
|
-
},
|
|
26
|
-
"include": [
|
|
27
|
-
"src/**/*",
|
|
28
|
-
"src/**/*.vue"
|
|
29
|
-
],
|
|
30
|
-
"exclude": ["dist", "node_modules", "cypress"],
|
|
31
|
-
"references": [{ "path": "./tsconfig.node.json" }],
|
|
32
|
-
}
|