create-quasar 2.0.12 → 2.1.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/index.js +72 -54
- package/package.json +15 -16
- package/scripts/create-test-project.ts +28 -25
- package/templates/{eslint.config.base.js → __eslint.config.base.js} +3 -2
- package/templates/app/{eslint.config.js → __eslint.config.js} +2 -2
- package/templates/app/create-quasar-script.js +8 -0
- package/templates/app/quasar-v2/{index.js → create-quasar-script.js} +22 -8
- package/templates/app/quasar-v2/js-vite-2/BASE/_package.json +16 -16
- package/templates/app/quasar-v2/js-vite-2/BASE/_pnpm-workspace.yaml +4 -0
- package/templates/app/quasar-v2/{ts-webpack-4/index.js → js-vite-2/create-quasar-script.js} +12 -3
- package/templates/app/quasar-v2/js-webpack-4/BASE/_package.json +9 -9
- package/templates/app/quasar-v2/js-webpack-4/BASE/_pnpm-workspace.yaml +4 -0
- package/templates/app/quasar-v2/{js-vite-2/index.js → js-webpack-4/create-quasar-script.js} +12 -3
- package/templates/app/quasar-v2/ts-vite-2/BASE/_package.json +19 -19
- package/templates/app/quasar-v2/ts-vite-2/BASE/_pnpm-workspace.yaml +4 -0
- package/templates/app/quasar-v2/ts-vite-2/{index.js → create-quasar-script.js} +12 -3
- package/templates/app/quasar-v2/ts-webpack-4/BASE/_package.json +11 -11
- package/templates/app/quasar-v2/ts-webpack-4/BASE/_pnpm-workspace.yaml +4 -0
- package/templates/app/quasar-v2/{js-webpack-4/index.js → ts-webpack-4/create-quasar-script.js} +12 -3
- package/templates/app-extension/{eslint.config.js → __eslint.config.js} +2 -2
- package/templates/app-extension/ae-js/{index.js → create-quasar-script.js} +9 -4
- package/templates/app-extension/ae-ts/BASE/_eslint.config.js +3 -2
- package/templates/app-extension/ae-ts/BASE/_package.json +4 -4
- package/templates/app-extension/ae-ts/BASE/app-extension/_package.json +1 -1
- package/templates/app-extension/ae-ts/BASE/playground/quasar-cli-vite/_package.json +1 -1
- package/templates/app-extension/ae-ts/BASE/playground/quasar-cli-vite/quasar.config.ts +0 -2
- package/templates/app-extension/ae-ts/BASE/playground/quasar-cli-webpack/_package.json +1 -1
- package/templates/app-extension/ae-ts/BASE/playground/quasar-cli-webpack/quasar.config.ts +0 -2
- package/templates/app-extension/ae-ts/{index.js → create-quasar-script.js} +11 -6
- package/templates/app-extension/create-quasar-script.js +16 -0
- package/templates/ui-kit/{eslint.config.js → __eslint.config.js} +2 -2
- package/templates/ui-kit/{index.js → create-quasar-script.js} +8 -5
- package/templates/ui-kit/quasar-v2/BASE/ui/_package.json +2 -2
- package/templates/ui-kit/quasar-v2/{index.js → create-quasar-script.js} +5 -2
- package/test-project/.editorconfig +7 -0
- package/test-project/.prettierrc.json +5 -0
- package/test-project/.vscode/extensions.json +15 -0
- package/test-project/.vscode/settings.json +9 -0
- package/test-project/README.md +43 -0
- package/test-project/eslint.config.js +83 -0
- package/test-project/index.html +24 -0
- package/test-project/package.json +45 -0
- package/test-project/pnpm-lock.yaml +5293 -0
- package/test-project/pnpm-workspace.yaml +6 -0
- package/test-project/postcss.config.js +29 -0
- package/test-project/public/favicon.ico +0 -0
- package/test-project/public/icons/favicon-128x128.png +0 -0
- package/test-project/public/icons/favicon-16x16.png +0 -0
- package/test-project/public/icons/favicon-32x32.png +0 -0
- package/test-project/public/icons/favicon-96x96.png +0 -0
- package/test-project/quasar.config.ts +217 -0
- package/test-project/src/App.vue +7 -0
- package/test-project/src/assets/quasar-logo-vertical.svg +15 -0
- package/test-project/src/boot/.gitkeep +0 -0
- package/test-project/src/components/EssentialLink.vue +27 -0
- package/test-project/src/components/ExampleComponent.vue +37 -0
- package/test-project/src/components/models.ts +8 -0
- package/test-project/src/css/app.scss +1 -0
- package/test-project/src/css/quasar.variables.scss +25 -0
- package/test-project/src/env.d.ts +7 -0
- package/test-project/src/layouts/MainLayout.vue +81 -0
- package/test-project/src/pages/ErrorNotFound.vue +23 -0
- package/test-project/src/pages/IndexPage.vue +43 -0
- package/test-project/src/router/index.ts +37 -0
- package/test-project/src/router/routes.ts +18 -0
- package/test-project/tsconfig.json +3 -0
- package/utils/index.js +123 -104
- package/utils/logger.js +52 -50
- package/eslint.config.base.js +0 -19
- package/eslint.config.js +0 -47
- package/templates/app/index.js +0 -8
- package/templates/app-extension/index.js +0 -15
- /package/templates/app/quasar-v2/js-vite-2/{.eslintrc.cjs → __.eslintrc.cjs} +0 -0
- /package/templates/app/quasar-v2/js-webpack-4/{.eslintrc.cjs → __.eslintrc.cjs} +0 -0
- /package/templates/app/quasar-v2/ts-vite-2/{.eslintrc.cjs → __.eslintrc.cjs} +0 -0
- /package/templates/app/quasar-v2/ts-webpack-4/{.eslintrc.cjs → __.eslintrc.cjs} +0 -0
package/utils/index.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { readFileSync, writeFileSync, existsSync } from 'node:fs'
|
|
2
2
|
import { fileURLToPath } from 'node:url'
|
|
3
3
|
import { sep, dirname, normalize, join, resolve, extname } from 'node:path'
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { execSync as exec } from 'node:child_process'
|
|
5
|
+
import { sync as spawnSync } from 'cross-spawn'
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
emptyDirSync,
|
|
9
|
+
ensureDirSync,
|
|
10
|
+
ensureFileSync,
|
|
11
|
+
copySync
|
|
12
|
+
} from 'fs-extra/esm'
|
|
7
13
|
import promptUser from 'prompts'
|
|
8
14
|
import compileTemplate from 'lodash/template.js'
|
|
9
15
|
import { globSync } from 'tinyglobby'
|
|
@@ -11,14 +17,24 @@ import { yellow, green } from 'kolorist'
|
|
|
11
17
|
|
|
12
18
|
import logger from './logger.js'
|
|
13
19
|
|
|
14
|
-
const TEMPLATING_FILE_EXTENSIONS = [
|
|
20
|
+
const TEMPLATING_FILE_EXTENSIONS = [
|
|
21
|
+
'',
|
|
22
|
+
'.json',
|
|
23
|
+
'.js',
|
|
24
|
+
'.cjs',
|
|
25
|
+
'.ts',
|
|
26
|
+
'.vue',
|
|
27
|
+
'.md',
|
|
28
|
+
'.html',
|
|
29
|
+
'.sass'
|
|
30
|
+
]
|
|
15
31
|
|
|
16
32
|
/**
|
|
17
33
|
* @param {Record<string, any>} scope
|
|
18
34
|
* @param {promptUser.PromptObject[]} questions
|
|
19
35
|
* @param {promptUser.Options} opts
|
|
20
36
|
*/
|
|
21
|
-
async function prompts
|
|
37
|
+
async function prompts(scope, questions, opts) {
|
|
22
38
|
const options = opts || {
|
|
23
39
|
onCancel: () => {
|
|
24
40
|
logger.fatal('Scaffolding cancelled')
|
|
@@ -29,7 +45,7 @@ async function prompts (scope, questions, opts) {
|
|
|
29
45
|
Object.assign(scope, answers)
|
|
30
46
|
}
|
|
31
47
|
|
|
32
|
-
function createTargetDir
|
|
48
|
+
function createTargetDir(scope) {
|
|
33
49
|
console.log()
|
|
34
50
|
logger.log('Generating files...')
|
|
35
51
|
console.log()
|
|
@@ -38,10 +54,10 @@ function createTargetDir (scope) {
|
|
|
38
54
|
fn(scope.projectFolder)
|
|
39
55
|
}
|
|
40
56
|
|
|
41
|
-
function convertArrayToObject
|
|
57
|
+
function convertArrayToObject(arr) {
|
|
42
58
|
const acc = {}
|
|
43
59
|
arr.forEach(key => {
|
|
44
|
-
acc[
|
|
60
|
+
acc[key] = true
|
|
45
61
|
})
|
|
46
62
|
return acc
|
|
47
63
|
}
|
|
@@ -52,37 +68,30 @@ const runningPackageManager = (() => {
|
|
|
52
68
|
return
|
|
53
69
|
}
|
|
54
70
|
|
|
55
|
-
const [
|
|
71
|
+
const [name, version] = userAgent.split(' ')[0].split('/')
|
|
56
72
|
return { name, version }
|
|
57
73
|
})()
|
|
58
74
|
|
|
59
|
-
function getCallerPath
|
|
75
|
+
function getCallerPath() {
|
|
60
76
|
const _prepareStackTrace = Error.prepareStackTrace
|
|
61
77
|
Error.prepareStackTrace = (_, stack) => stack
|
|
62
78
|
const stack = new Error().stack.slice(1)
|
|
63
79
|
Error.prepareStackTrace = _prepareStackTrace
|
|
64
|
-
const filename = stack[
|
|
80
|
+
const filename = stack[1].getFileName()
|
|
65
81
|
return dirname(
|
|
66
|
-
filename.startsWith('file://')
|
|
67
|
-
? fileURLToPath(filename)
|
|
68
|
-
: filename
|
|
82
|
+
filename.startsWith('file://') ? fileURLToPath(filename) : filename
|
|
69
83
|
)
|
|
70
84
|
}
|
|
71
85
|
|
|
72
|
-
function renderTemplate
|
|
86
|
+
function renderTemplate(relativePath, scope) {
|
|
73
87
|
const templateDir = join(getCallerPath(), relativePath)
|
|
74
|
-
const files = globSync([
|
|
88
|
+
const files = globSync(['**/*'], { cwd: templateDir })
|
|
75
89
|
|
|
76
90
|
for (const rawPath of files) {
|
|
77
|
-
const targetRelativePath = rawPath
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
// we also prefix files like "package.json" too. (e.g. "_package.json")
|
|
82
|
-
return name.startsWith('_')
|
|
83
|
-
? name.slice(1)
|
|
84
|
-
: name
|
|
85
|
-
}).join('/')
|
|
91
|
+
const targetRelativePath = rawPath
|
|
92
|
+
.split('/')
|
|
93
|
+
.map(name => (name.startsWith('_') ? name.slice(1) : name))
|
|
94
|
+
.join('/')
|
|
86
95
|
|
|
87
96
|
const targetPath = resolve(scope.projectFolder, targetRelativePath)
|
|
88
97
|
const sourcePath = resolve(templateDir, rawPath)
|
|
@@ -90,11 +99,13 @@ function renderTemplate (relativePath, scope) {
|
|
|
90
99
|
|
|
91
100
|
ensureFileSync(targetPath)
|
|
92
101
|
|
|
93
|
-
console.log(` ${
|
|
102
|
+
console.log(` ${green('-')} ${targetRelativePath}`)
|
|
94
103
|
|
|
95
104
|
if (TEMPLATING_FILE_EXTENSIONS.includes(extension)) {
|
|
96
105
|
const rawContent = readFileSync(sourcePath, 'utf-8')
|
|
97
|
-
const template = compileTemplate(rawContent, {
|
|
106
|
+
const template = compileTemplate(rawContent, {
|
|
107
|
+
interpolate: /<%=([\s\S]+?)%>/g
|
|
108
|
+
})
|
|
98
109
|
|
|
99
110
|
let newContent = template(scope)
|
|
100
111
|
if (extension === '.json') {
|
|
@@ -107,20 +118,19 @@ function renderTemplate (relativePath, scope) {
|
|
|
107
118
|
}
|
|
108
119
|
|
|
109
120
|
writeFileSync(targetPath, newContent, 'utf-8')
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
121
|
+
} else {
|
|
112
122
|
copySync(sourcePath, targetPath)
|
|
113
123
|
}
|
|
114
124
|
}
|
|
115
125
|
}
|
|
116
126
|
|
|
117
|
-
function isValidPackageName
|
|
127
|
+
function isValidPackageName(projectName) {
|
|
118
128
|
return /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(
|
|
119
129
|
projectName
|
|
120
130
|
)
|
|
121
131
|
}
|
|
122
132
|
|
|
123
|
-
function inferPackageName
|
|
133
|
+
function inferPackageName(projectFolder) {
|
|
124
134
|
return projectFolder
|
|
125
135
|
.trim()
|
|
126
136
|
.toLowerCase()
|
|
@@ -129,22 +139,21 @@ function inferPackageName (projectFolder) {
|
|
|
129
139
|
.replace(/[^a-z0-9-~]+/g, '-')
|
|
130
140
|
}
|
|
131
141
|
|
|
132
|
-
function escapeString
|
|
142
|
+
function escapeString(val) {
|
|
133
143
|
return JSON.stringify(val).slice(1, -1)
|
|
134
144
|
}
|
|
135
145
|
|
|
136
|
-
function getGitUser
|
|
146
|
+
function getGitUser() {
|
|
137
147
|
let name
|
|
138
148
|
let email
|
|
139
149
|
|
|
140
150
|
try {
|
|
141
151
|
name = exec('git config --get user.name')
|
|
142
152
|
email = exec('git config --get user.email')
|
|
143
|
-
}
|
|
144
|
-
catch (_) {}
|
|
153
|
+
} catch {}
|
|
145
154
|
|
|
146
155
|
name = name && JSON.stringify(name.toString().trim()).slice(1, -1)
|
|
147
|
-
email = email &&
|
|
156
|
+
email = email && ' <' + email.toString().trim() + '>'
|
|
148
157
|
|
|
149
158
|
return (name || '') + (email || '')
|
|
150
159
|
}
|
|
@@ -154,20 +163,28 @@ function getGitUser () {
|
|
|
154
163
|
*
|
|
155
164
|
* @param {Object} scope Data from questionnaire.
|
|
156
165
|
*/
|
|
157
|
-
function printFinalMessage
|
|
166
|
+
function printFinalMessage(scope) {
|
|
158
167
|
const verPrefix = scope.quasarVersion ? scope.quasarVersion + '.' : ''
|
|
159
168
|
const message = `
|
|
160
169
|
To get started:
|
|
161
|
-
${
|
|
162
|
-
cd ${
|
|
170
|
+
${yellow(`
|
|
171
|
+
cd ${scope.projectFolderName}${
|
|
172
|
+
scope.skipDepsInstall !== true && scope.packageManager === false
|
|
173
|
+
? `
|
|
163
174
|
yarn #or: npm install
|
|
164
|
-
yarn lint --fix # or: npm run lint -- --fix`
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
175
|
+
yarn lint --fix # or: npm run lint -- --fix`
|
|
176
|
+
: ''
|
|
177
|
+
}${
|
|
178
|
+
scope.skipDepsInstall !== true
|
|
179
|
+
? `
|
|
180
|
+
quasar dev # or: yarn quasar dev # or: npx quasar dev`
|
|
181
|
+
: ''
|
|
182
|
+
}
|
|
183
|
+
`)}
|
|
184
|
+
Documentation can be found at: https://${verPrefix}quasar.dev
|
|
168
185
|
|
|
169
186
|
Quasar is relying on donations to evolve. We'd be very grateful if you can
|
|
170
|
-
read our manifest on "Why donations are important": https://${
|
|
187
|
+
read our manifest on "Why donations are important": https://${verPrefix}quasar.dev/why-donate
|
|
171
188
|
Donation campaign: https://donate.quasar.dev
|
|
172
189
|
Any amount is very welcome.
|
|
173
190
|
If invoices are required, please first contact Razvan Stoenescu.
|
|
@@ -181,100 +198,101 @@ function printFinalMessage (scope) {
|
|
|
181
198
|
console.log(message)
|
|
182
199
|
}
|
|
183
200
|
|
|
184
|
-
function runCommand
|
|
201
|
+
function runCommand(cmd, args, options) {
|
|
185
202
|
console.log()
|
|
186
|
-
return new Promise((resolve, reject) => {
|
|
187
|
-
const runner = spawn(
|
|
188
|
-
cmd,
|
|
189
|
-
args,
|
|
190
|
-
Object.assign({
|
|
191
|
-
cwd: process.cwd(),
|
|
192
|
-
stdio: 'inherit',
|
|
193
|
-
shell: true
|
|
194
|
-
}, options)
|
|
195
|
-
)
|
|
196
|
-
|
|
197
|
-
runner.on('exit', code => {
|
|
198
|
-
console.log()
|
|
199
203
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}
|
|
205
|
-
else {
|
|
206
|
-
resolve()
|
|
207
|
-
}
|
|
208
|
-
})
|
|
204
|
+
const runner = spawnSync(cmd, args, {
|
|
205
|
+
cwd: process.cwd(),
|
|
206
|
+
stdio: 'inherit',
|
|
207
|
+
...options
|
|
209
208
|
})
|
|
209
|
+
|
|
210
|
+
console.log()
|
|
211
|
+
|
|
212
|
+
if (runner.status) {
|
|
213
|
+
console.log(` ${cmd} FAILED...`)
|
|
214
|
+
console.log()
|
|
215
|
+
throw new Error(`${cmd} FAILED`)
|
|
216
|
+
}
|
|
210
217
|
}
|
|
211
218
|
|
|
212
|
-
function installDeps
|
|
213
|
-
const args = [
|
|
219
|
+
function installDeps(scope) {
|
|
220
|
+
const args = ['install']
|
|
214
221
|
// Related to scripts/create-test-project.ts
|
|
215
222
|
if (process.env.CREATE_TEST_PROJECT_OVERRIDE === 'true') {
|
|
216
223
|
// If we don't use this flag, then the test project will become part of the monorepo and fail to install properly
|
|
217
224
|
args.push('--ignore-workspace')
|
|
218
225
|
}
|
|
219
226
|
|
|
220
|
-
return runCommand(
|
|
221
|
-
scope.packageManager,
|
|
222
|
-
args,
|
|
223
|
-
{ cwd: scope.projectFolder }
|
|
224
|
-
)
|
|
227
|
+
return runCommand(scope.packageManager, args, { cwd: scope.projectFolder })
|
|
225
228
|
}
|
|
226
229
|
|
|
227
|
-
function lintFolder
|
|
230
|
+
function lintFolder(scope) {
|
|
228
231
|
return runCommand(
|
|
229
232
|
scope.packageManager,
|
|
230
233
|
scope.packageManager === 'npm'
|
|
231
|
-
? [
|
|
232
|
-
: [
|
|
234
|
+
? ['run', 'lint', '--', '--fix']
|
|
235
|
+
: ['run', 'lint', '--fix'],
|
|
233
236
|
{ cwd: scope.projectFolder }
|
|
234
237
|
)
|
|
235
238
|
}
|
|
236
239
|
|
|
237
|
-
function formatFolder
|
|
238
|
-
return runCommand(
|
|
239
|
-
scope.
|
|
240
|
-
|
|
241
|
-
{ cwd: scope.projectFolder }
|
|
242
|
-
)
|
|
240
|
+
function formatFolder(scope) {
|
|
241
|
+
return runCommand(scope.packageManager, ['run', 'format'], {
|
|
242
|
+
cwd: scope.projectFolder
|
|
243
|
+
})
|
|
243
244
|
}
|
|
244
245
|
|
|
245
|
-
function hasGit
|
|
246
|
+
function hasGit() {
|
|
246
247
|
try {
|
|
247
248
|
exec('git --version')
|
|
248
249
|
return true
|
|
249
|
-
}
|
|
250
|
-
catch (_) {}
|
|
250
|
+
} catch {}
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
-
function folderHasGit
|
|
253
|
+
function folderHasGit(cwd) {
|
|
254
254
|
try {
|
|
255
255
|
exec('git status', { stdio: 'ignore', cwd })
|
|
256
256
|
return true
|
|
257
|
-
}
|
|
258
|
-
catch (_) {}
|
|
257
|
+
} catch {}
|
|
259
258
|
}
|
|
260
259
|
|
|
261
|
-
function initializeGit
|
|
260
|
+
function initializeGit(projectFolder) {
|
|
262
261
|
if (hasGit() !== true) {
|
|
263
|
-
logger.log(
|
|
262
|
+
logger.log(
|
|
263
|
+
'Git is not installed on the system, so skipping Git repo initialization.'
|
|
264
|
+
)
|
|
264
265
|
return
|
|
265
266
|
}
|
|
266
267
|
|
|
267
268
|
if (folderHasGit(projectFolder) === true) {
|
|
268
|
-
logger.log(
|
|
269
|
+
logger.log(
|
|
270
|
+
'A parent of the project folder is already a Git repository, so skipping Git initialization.'
|
|
271
|
+
)
|
|
269
272
|
return
|
|
270
273
|
}
|
|
271
274
|
|
|
272
275
|
try {
|
|
276
|
+
logger.log('Initializing Git repository...')
|
|
273
277
|
exec('git init', { cwd: projectFolder })
|
|
274
278
|
exec('git add -A', { cwd: projectFolder })
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
279
|
+
|
|
280
|
+
// Provide useful feedback to the user if they have GPG signing enabled to avoid feeling that the process is hanging
|
|
281
|
+
try {
|
|
282
|
+
const needsSigning = exec('git config --get commit.gpgsign', {
|
|
283
|
+
cwd: projectFolder
|
|
284
|
+
})
|
|
285
|
+
.toString()
|
|
286
|
+
.trim()
|
|
287
|
+
if (needsSigning === 'true') {
|
|
288
|
+
logger.log('Creating initial commit (waiting for GPG signing)...')
|
|
289
|
+
}
|
|
290
|
+
} catch {}
|
|
291
|
+
|
|
292
|
+
exec('git commit -m "Initialize the project 🚀" --no-verify', {
|
|
293
|
+
cwd: projectFolder
|
|
294
|
+
})
|
|
295
|
+
} catch {
|
|
278
296
|
logger.warn('Could not initialize Git repository. Please do this manually.')
|
|
279
297
|
return
|
|
280
298
|
}
|
|
@@ -290,14 +308,16 @@ const quasarConfigFilenameList = [
|
|
|
290
308
|
'quasar.conf.js' // legacy
|
|
291
309
|
]
|
|
292
310
|
|
|
293
|
-
function ensureOutsideProject
|
|
311
|
+
function ensureOutsideProject() {
|
|
294
312
|
let dir = process.cwd()
|
|
295
313
|
|
|
296
|
-
while (dir.length && dir[
|
|
314
|
+
while (dir.length && dir[dir.length - 1] !== sep) {
|
|
297
315
|
for (const name of quasarConfigFilenameList) {
|
|
298
316
|
const filename = join(dir, name)
|
|
299
317
|
if (existsSync(filename)) {
|
|
300
|
-
logger.fatal(
|
|
318
|
+
logger.fatal(
|
|
319
|
+
'Error. This command must NOT be executed inside of a Quasar project folder.'
|
|
320
|
+
)
|
|
301
321
|
}
|
|
302
322
|
}
|
|
303
323
|
|
|
@@ -322,10 +342,10 @@ const commonPrompts = {
|
|
|
322
342
|
productName: {
|
|
323
343
|
type: 'text',
|
|
324
344
|
name: 'productName',
|
|
325
|
-
message:
|
|
345
|
+
message:
|
|
346
|
+
'Project product name: (must start with letter if building mobile apps)',
|
|
326
347
|
initial: 'Quasar App',
|
|
327
|
-
validate: val =>
|
|
328
|
-
(val && val.length > 0) || 'Invalid product name'
|
|
348
|
+
validate: val => (val && val.length > 0) || 'Invalid product name'
|
|
329
349
|
},
|
|
330
350
|
|
|
331
351
|
description: {
|
|
@@ -334,8 +354,7 @@ const commonPrompts = {
|
|
|
334
354
|
message: 'Project description:',
|
|
335
355
|
initial: 'A Quasar Project',
|
|
336
356
|
format: escapeString,
|
|
337
|
-
validate: val =>
|
|
338
|
-
val.length > 0 || 'Invalid project description'
|
|
357
|
+
validate: val => val.length > 0 || 'Invalid project description'
|
|
339
358
|
},
|
|
340
359
|
|
|
341
360
|
license: {
|
|
@@ -346,7 +365,7 @@ const commonPrompts = {
|
|
|
346
365
|
}
|
|
347
366
|
}
|
|
348
367
|
|
|
349
|
-
export async function injectAuthor
|
|
368
|
+
export async function injectAuthor(scope) {
|
|
350
369
|
const author = getGitUser()
|
|
351
370
|
|
|
352
371
|
if (author) {
|
package/utils/logger.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
|
-
bgGreen,
|
|
2
|
+
bgGreen,
|
|
3
|
+
green,
|
|
3
4
|
inverse,
|
|
4
|
-
bgRed,
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
bgRed,
|
|
6
|
+
red,
|
|
7
|
+
bgYellow,
|
|
8
|
+
yellow,
|
|
9
|
+
black,
|
|
10
|
+
white,
|
|
7
11
|
underline
|
|
8
12
|
} from 'kolorist'
|
|
9
13
|
|
|
@@ -13,10 +17,10 @@ import readline from 'node:readline'
|
|
|
13
17
|
* Pills
|
|
14
18
|
*/
|
|
15
19
|
|
|
16
|
-
const successPill = msg => bgGreen(black(` ${
|
|
17
|
-
const infoPill = msg => inverse(` ${
|
|
18
|
-
const errorPill = msg => bgRed(white(` ${
|
|
19
|
-
const warningPill = msg => bgYellow(black(` ${
|
|
20
|
+
const successPill = msg => bgGreen(black(` ${msg} `))
|
|
21
|
+
const infoPill = msg => inverse(` ${msg} `)
|
|
22
|
+
const errorPill = msg => bgRed(white(` ${msg} `))
|
|
23
|
+
const warningPill = msg => bgYellow(black(` ${msg} `))
|
|
20
24
|
|
|
21
25
|
/**
|
|
22
26
|
* Main approach
|
|
@@ -27,7 +31,7 @@ const banner = 'Quasar ' + dot
|
|
|
27
31
|
const greenBanner = green(banner)
|
|
28
32
|
const redBanner = red(banner)
|
|
29
33
|
const yellowBanner = yellow(banner)
|
|
30
|
-
const tipBanner = `${
|
|
34
|
+
const tipBanner = `${green('App')} ${dot} ${successPill('TIP')} ${dot} 🚀 `
|
|
31
35
|
|
|
32
36
|
const clearConsole = process.stdout.isTTY
|
|
33
37
|
? () => {
|
|
@@ -39,36 +43,31 @@ const clearConsole = process.stdout.isTTY
|
|
|
39
43
|
}
|
|
40
44
|
: () => {}
|
|
41
45
|
|
|
42
|
-
function tip
|
|
43
|
-
console.log(msg ? ` ${
|
|
46
|
+
function tip(msg) {
|
|
47
|
+
console.log(msg ? ` ${tipBanner} ${msg}` : '')
|
|
44
48
|
}
|
|
45
49
|
|
|
46
|
-
function log
|
|
47
|
-
console.log(msg ? ` ${
|
|
50
|
+
function log(msg) {
|
|
51
|
+
console.log(msg ? ` ${greenBanner} ${msg}` : '')
|
|
48
52
|
}
|
|
49
53
|
|
|
50
|
-
function warn
|
|
54
|
+
function warn(msg, pill) {
|
|
51
55
|
if (msg !== void 0) {
|
|
52
|
-
const pillBanner =
|
|
53
|
-
? bgYellow(black('', pill, '')) + ' '
|
|
54
|
-
: ''
|
|
56
|
+
const pillBanner =
|
|
57
|
+
pill !== void 0 ? bgYellow(black('', pill, '')) + ' ' : ''
|
|
55
58
|
|
|
56
|
-
console.warn(` ${
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
+
console.warn(` ${yellowBanner} ⚠️ ${pillBanner}${msg}`)
|
|
60
|
+
} else {
|
|
59
61
|
console.warn()
|
|
60
62
|
}
|
|
61
63
|
}
|
|
62
64
|
|
|
63
|
-
function fatal
|
|
65
|
+
function fatal(msg, pill) {
|
|
64
66
|
if (msg !== void 0) {
|
|
65
|
-
const pillBanner = pill !== void 0
|
|
66
|
-
? errorPill(pill) + ' '
|
|
67
|
-
: ''
|
|
67
|
+
const pillBanner = pill !== void 0 ? errorPill(pill) + ' ' : ''
|
|
68
68
|
|
|
69
|
-
console.error(`\n ${
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
69
|
+
console.error(`\n ${redBanner} ⚠️ ${pillBanner}${msg}\n`)
|
|
70
|
+
} else {
|
|
72
71
|
console.error()
|
|
73
72
|
}
|
|
74
73
|
|
|
@@ -79,50 +78,53 @@ function fatal (msg, pill) {
|
|
|
79
78
|
* Extended approach - Status & pills
|
|
80
79
|
*/
|
|
81
80
|
|
|
82
|
-
function success
|
|
83
|
-
console.log(` ${
|
|
81
|
+
function success(msg, title = 'SUCCESS') {
|
|
82
|
+
console.log(` ${greenBanner} ${successPill(title)} ${green(dot + ' ' + msg)}`)
|
|
84
83
|
}
|
|
85
|
-
function getSuccess
|
|
86
|
-
return ` ${
|
|
84
|
+
function getSuccess(msg, title) {
|
|
85
|
+
return ` ${greenBanner} ${successPill(title)} ${green(dot + ' ' + msg)}`
|
|
87
86
|
}
|
|
88
87
|
|
|
89
|
-
function info
|
|
90
|
-
console.log(` ${
|
|
88
|
+
function info(msg, title = 'INFO') {
|
|
89
|
+
console.log(` ${greenBanner} ${infoPill(title)} ${green(dot)} ${msg}`)
|
|
91
90
|
}
|
|
92
|
-
function getInfo
|
|
93
|
-
return ` ${
|
|
91
|
+
function getInfo(msg, title) {
|
|
92
|
+
return ` ${greenBanner} ${infoPill(title)} ${green(dot)} ${msg}`
|
|
94
93
|
}
|
|
95
94
|
|
|
96
|
-
function error
|
|
97
|
-
console.log(` ${
|
|
95
|
+
function error(msg, title = 'ERROR') {
|
|
96
|
+
console.log(` ${redBanner} ${errorPill(title)} ${red(dot + ' ' + msg)}`)
|
|
98
97
|
}
|
|
99
|
-
function getError
|
|
100
|
-
return ` ${
|
|
98
|
+
function getError(msg, title = 'ERROR') {
|
|
99
|
+
return ` ${redBanner} ${errorPill(title)} ${red(dot + ' ' + msg)}`
|
|
101
100
|
}
|
|
102
101
|
|
|
103
|
-
function warning
|
|
104
|
-
console.log(
|
|
102
|
+
function warning(msg, title = 'WARNING') {
|
|
103
|
+
console.log(
|
|
104
|
+
` ${yellowBanner} ${warningPill(title)} ${yellow(dot + ' ' + msg)}`
|
|
105
|
+
)
|
|
105
106
|
}
|
|
106
|
-
function getWarning
|
|
107
|
-
return ` ${
|
|
107
|
+
function getWarning(msg, title = 'WARNING') {
|
|
108
|
+
return ` ${yellowBanner} ${warningPill(title)} ${yellow(dot + ' ' + msg)}`
|
|
108
109
|
}
|
|
109
110
|
|
|
110
111
|
/**
|
|
111
112
|
* Progress related
|
|
112
113
|
*/
|
|
113
114
|
|
|
114
|
-
function progress
|
|
115
|
-
const parseMsg =
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
function progress(msg, token) {
|
|
116
|
+
const parseMsg =
|
|
117
|
+
token !== void 0
|
|
118
|
+
? text => text.replace('___', underline(green(token)))
|
|
119
|
+
: text => text
|
|
118
120
|
|
|
119
121
|
info(parseMsg(msg), 'WAIT')
|
|
120
122
|
|
|
121
123
|
const startTime = Date.now()
|
|
122
124
|
|
|
123
|
-
return
|
|
124
|
-
const diffTime =
|
|
125
|
-
success(`${
|
|
125
|
+
return progressMessage => {
|
|
126
|
+
const diffTime = Number(new Date()) - startTime
|
|
127
|
+
success(`${parseMsg(progressMessage)} ${dot} ${diffTime}ms`, 'DONE')
|
|
126
128
|
log()
|
|
127
129
|
}
|
|
128
130
|
}
|
package/eslint.config.base.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import eslintJs from '@eslint/js'
|
|
2
|
-
import tseslint from 'typescript-eslint'
|
|
3
|
-
|
|
4
|
-
export default tseslint.config(
|
|
5
|
-
{
|
|
6
|
-
name: 'eslint/recommended',
|
|
7
|
-
|
|
8
|
-
...eslintJs.configs.recommended
|
|
9
|
-
},
|
|
10
|
-
|
|
11
|
-
{
|
|
12
|
-
name: 'custom',
|
|
13
|
-
|
|
14
|
-
rules: {
|
|
15
|
-
'no-empty': 'off',
|
|
16
|
-
'no-unused-vars': [ 'error', { ignoreRestSiblings: true, argsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_' } ]
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
)
|
package/eslint.config.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import baseConfig from './eslint.config.base.js'
|
|
2
|
-
import globals from 'globals'
|
|
3
|
-
import tseslint from 'typescript-eslint'
|
|
4
|
-
// import quasar from 'eslint-config-quasar'
|
|
5
|
-
|
|
6
|
-
export default tseslint.config(
|
|
7
|
-
...baseConfig,
|
|
8
|
-
|
|
9
|
-
// TODO: enable these configs
|
|
10
|
-
// ...quasar.configs.base,
|
|
11
|
-
// ...quasar.configs.node,
|
|
12
|
-
|
|
13
|
-
{
|
|
14
|
-
name: 'custom/ignores',
|
|
15
|
-
|
|
16
|
-
ignores: [ 'test-project' ]
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
{
|
|
20
|
-
name: 'custom',
|
|
21
|
-
|
|
22
|
-
languageOptions: {
|
|
23
|
-
ecmaVersion: 'latest',
|
|
24
|
-
sourceType: 'module',
|
|
25
|
-
|
|
26
|
-
globals: {
|
|
27
|
-
...globals.node
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
{
|
|
33
|
-
name: 'custom/scripts',
|
|
34
|
-
|
|
35
|
-
files: [ './scripts/**/*.ts' ],
|
|
36
|
-
|
|
37
|
-
extends: [
|
|
38
|
-
...tseslint.configs.recommended
|
|
39
|
-
],
|
|
40
|
-
|
|
41
|
-
languageOptions: {
|
|
42
|
-
parserOptions: {
|
|
43
|
-
sourceType: 'module',
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
)
|
package/templates/app/index.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export async function script ({ scope, utils }) {
|
|
2
|
-
/**
|
|
3
|
-
* Temporarily disable scriptType prompt (TS not ready yet)
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// await utils.prompts(scope, [
|
|
7
|
-
// utils.commonPrompts.scriptType
|
|
8
|
-
// ])
|
|
9
|
-
|
|
10
|
-
// const { script } = await import(`./ae-${ scope.scriptType }/index.js`)
|
|
11
|
-
// await script({ scope, utils })
|
|
12
|
-
|
|
13
|
-
const { script } = await import('./ae-js/index.js')
|
|
14
|
-
await script({ scope, utils })
|
|
15
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|