create-quasar 2.1.0 → 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 +14 -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 +3 -3
- 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 +1 -1
- 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 +3 -3
- 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 +1 -1
- 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 +2 -2
- 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/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/{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 +107 -90
- 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
|
@@ -4,7 +4,12 @@ import { sep, dirname, normalize, join, resolve, extname } from 'node:path'
|
|
|
4
4
|
import { execSync as exec } from 'node:child_process'
|
|
5
5
|
import { sync as spawnSync } from 'cross-spawn'
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
emptyDirSync,
|
|
9
|
+
ensureDirSync,
|
|
10
|
+
ensureFileSync,
|
|
11
|
+
copySync
|
|
12
|
+
} from 'fs-extra/esm'
|
|
8
13
|
import promptUser from 'prompts'
|
|
9
14
|
import compileTemplate from 'lodash/template.js'
|
|
10
15
|
import { globSync } from 'tinyglobby'
|
|
@@ -12,14 +17,24 @@ import { yellow, green } from 'kolorist'
|
|
|
12
17
|
|
|
13
18
|
import logger from './logger.js'
|
|
14
19
|
|
|
15
|
-
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
|
+
]
|
|
16
31
|
|
|
17
32
|
/**
|
|
18
33
|
* @param {Record<string, any>} scope
|
|
19
34
|
* @param {promptUser.PromptObject[]} questions
|
|
20
35
|
* @param {promptUser.Options} opts
|
|
21
36
|
*/
|
|
22
|
-
async function prompts
|
|
37
|
+
async function prompts(scope, questions, opts) {
|
|
23
38
|
const options = opts || {
|
|
24
39
|
onCancel: () => {
|
|
25
40
|
logger.fatal('Scaffolding cancelled')
|
|
@@ -30,7 +45,7 @@ async function prompts (scope, questions, opts) {
|
|
|
30
45
|
Object.assign(scope, answers)
|
|
31
46
|
}
|
|
32
47
|
|
|
33
|
-
function createTargetDir
|
|
48
|
+
function createTargetDir(scope) {
|
|
34
49
|
console.log()
|
|
35
50
|
logger.log('Generating files...')
|
|
36
51
|
console.log()
|
|
@@ -39,10 +54,10 @@ function createTargetDir (scope) {
|
|
|
39
54
|
fn(scope.projectFolder)
|
|
40
55
|
}
|
|
41
56
|
|
|
42
|
-
function convertArrayToObject
|
|
57
|
+
function convertArrayToObject(arr) {
|
|
43
58
|
const acc = {}
|
|
44
59
|
arr.forEach(key => {
|
|
45
|
-
acc[
|
|
60
|
+
acc[key] = true
|
|
46
61
|
})
|
|
47
62
|
return acc
|
|
48
63
|
}
|
|
@@ -53,37 +68,30 @@ const runningPackageManager = (() => {
|
|
|
53
68
|
return
|
|
54
69
|
}
|
|
55
70
|
|
|
56
|
-
const [
|
|
71
|
+
const [name, version] = userAgent.split(' ')[0].split('/')
|
|
57
72
|
return { name, version }
|
|
58
73
|
})()
|
|
59
74
|
|
|
60
|
-
function getCallerPath
|
|
75
|
+
function getCallerPath() {
|
|
61
76
|
const _prepareStackTrace = Error.prepareStackTrace
|
|
62
77
|
Error.prepareStackTrace = (_, stack) => stack
|
|
63
78
|
const stack = new Error().stack.slice(1)
|
|
64
79
|
Error.prepareStackTrace = _prepareStackTrace
|
|
65
|
-
const filename = stack[
|
|
80
|
+
const filename = stack[1].getFileName()
|
|
66
81
|
return dirname(
|
|
67
|
-
filename.startsWith('file://')
|
|
68
|
-
? fileURLToPath(filename)
|
|
69
|
-
: filename
|
|
82
|
+
filename.startsWith('file://') ? fileURLToPath(filename) : filename
|
|
70
83
|
)
|
|
71
84
|
}
|
|
72
85
|
|
|
73
|
-
function renderTemplate
|
|
86
|
+
function renderTemplate(relativePath, scope) {
|
|
74
87
|
const templateDir = join(getCallerPath(), relativePath)
|
|
75
|
-
const files = globSync([
|
|
88
|
+
const files = globSync(['**/*'], { cwd: templateDir })
|
|
76
89
|
|
|
77
90
|
for (const rawPath of files) {
|
|
78
|
-
const targetRelativePath = rawPath
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
// we also prefix files like "package.json" too. (e.g. "_package.json")
|
|
83
|
-
return name.startsWith('_')
|
|
84
|
-
? name.slice(1)
|
|
85
|
-
: name
|
|
86
|
-
}).join('/')
|
|
91
|
+
const targetRelativePath = rawPath
|
|
92
|
+
.split('/')
|
|
93
|
+
.map(name => (name.startsWith('_') ? name.slice(1) : name))
|
|
94
|
+
.join('/')
|
|
87
95
|
|
|
88
96
|
const targetPath = resolve(scope.projectFolder, targetRelativePath)
|
|
89
97
|
const sourcePath = resolve(templateDir, rawPath)
|
|
@@ -91,11 +99,13 @@ function renderTemplate (relativePath, scope) {
|
|
|
91
99
|
|
|
92
100
|
ensureFileSync(targetPath)
|
|
93
101
|
|
|
94
|
-
console.log(` ${
|
|
102
|
+
console.log(` ${green('-')} ${targetRelativePath}`)
|
|
95
103
|
|
|
96
104
|
if (TEMPLATING_FILE_EXTENSIONS.includes(extension)) {
|
|
97
105
|
const rawContent = readFileSync(sourcePath, 'utf-8')
|
|
98
|
-
const template = compileTemplate(rawContent, {
|
|
106
|
+
const template = compileTemplate(rawContent, {
|
|
107
|
+
interpolate: /<%=([\s\S]+?)%>/g
|
|
108
|
+
})
|
|
99
109
|
|
|
100
110
|
let newContent = template(scope)
|
|
101
111
|
if (extension === '.json') {
|
|
@@ -108,20 +118,19 @@ function renderTemplate (relativePath, scope) {
|
|
|
108
118
|
}
|
|
109
119
|
|
|
110
120
|
writeFileSync(targetPath, newContent, 'utf-8')
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
121
|
+
} else {
|
|
113
122
|
copySync(sourcePath, targetPath)
|
|
114
123
|
}
|
|
115
124
|
}
|
|
116
125
|
}
|
|
117
126
|
|
|
118
|
-
function isValidPackageName
|
|
127
|
+
function isValidPackageName(projectName) {
|
|
119
128
|
return /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(
|
|
120
129
|
projectName
|
|
121
130
|
)
|
|
122
131
|
}
|
|
123
132
|
|
|
124
|
-
function inferPackageName
|
|
133
|
+
function inferPackageName(projectFolder) {
|
|
125
134
|
return projectFolder
|
|
126
135
|
.trim()
|
|
127
136
|
.toLowerCase()
|
|
@@ -130,22 +139,21 @@ function inferPackageName (projectFolder) {
|
|
|
130
139
|
.replace(/[^a-z0-9-~]+/g, '-')
|
|
131
140
|
}
|
|
132
141
|
|
|
133
|
-
function escapeString
|
|
142
|
+
function escapeString(val) {
|
|
134
143
|
return JSON.stringify(val).slice(1, -1)
|
|
135
144
|
}
|
|
136
145
|
|
|
137
|
-
function getGitUser
|
|
146
|
+
function getGitUser() {
|
|
138
147
|
let name
|
|
139
148
|
let email
|
|
140
149
|
|
|
141
150
|
try {
|
|
142
151
|
name = exec('git config --get user.name')
|
|
143
152
|
email = exec('git config --get user.email')
|
|
144
|
-
}
|
|
145
|
-
catch (_) {}
|
|
153
|
+
} catch {}
|
|
146
154
|
|
|
147
155
|
name = name && JSON.stringify(name.toString().trim()).slice(1, -1)
|
|
148
|
-
email = email &&
|
|
156
|
+
email = email && ' <' + email.toString().trim() + '>'
|
|
149
157
|
|
|
150
158
|
return (name || '') + (email || '')
|
|
151
159
|
}
|
|
@@ -155,20 +163,28 @@ function getGitUser () {
|
|
|
155
163
|
*
|
|
156
164
|
* @param {Object} scope Data from questionnaire.
|
|
157
165
|
*/
|
|
158
|
-
function printFinalMessage
|
|
166
|
+
function printFinalMessage(scope) {
|
|
159
167
|
const verPrefix = scope.quasarVersion ? scope.quasarVersion + '.' : ''
|
|
160
168
|
const message = `
|
|
161
169
|
To get started:
|
|
162
|
-
${
|
|
163
|
-
cd ${
|
|
170
|
+
${yellow(`
|
|
171
|
+
cd ${scope.projectFolderName}${
|
|
172
|
+
scope.skipDepsInstall !== true && scope.packageManager === false
|
|
173
|
+
? `
|
|
164
174
|
yarn #or: npm install
|
|
165
|
-
yarn lint --fix # or: npm run lint -- --fix`
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
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
|
|
169
185
|
|
|
170
186
|
Quasar is relying on donations to evolve. We'd be very grateful if you can
|
|
171
|
-
read our manifest on "Why donations are important": https://${
|
|
187
|
+
read our manifest on "Why donations are important": https://${verPrefix}quasar.dev/why-donate
|
|
172
188
|
Donation campaign: https://donate.quasar.dev
|
|
173
189
|
Any amount is very welcome.
|
|
174
190
|
If invoices are required, please first contact Razvan Stoenescu.
|
|
@@ -182,81 +198,77 @@ function printFinalMessage (scope) {
|
|
|
182
198
|
console.log(message)
|
|
183
199
|
}
|
|
184
200
|
|
|
185
|
-
function runCommand
|
|
201
|
+
function runCommand(cmd, args, options) {
|
|
186
202
|
console.log()
|
|
187
203
|
|
|
188
|
-
const runner = spawnSync(
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
)
|
|
204
|
+
const runner = spawnSync(cmd, args, {
|
|
205
|
+
cwd: process.cwd(),
|
|
206
|
+
stdio: 'inherit',
|
|
207
|
+
...options
|
|
208
|
+
})
|
|
193
209
|
|
|
194
210
|
console.log()
|
|
195
211
|
|
|
196
212
|
if (runner.status) {
|
|
197
|
-
console.log(` ${
|
|
213
|
+
console.log(` ${cmd} FAILED...`)
|
|
198
214
|
console.log()
|
|
199
|
-
throw new Error(`${
|
|
215
|
+
throw new Error(`${cmd} FAILED`)
|
|
200
216
|
}
|
|
201
217
|
}
|
|
202
218
|
|
|
203
|
-
function installDeps
|
|
204
|
-
const args = [
|
|
219
|
+
function installDeps(scope) {
|
|
220
|
+
const args = ['install']
|
|
205
221
|
// Related to scripts/create-test-project.ts
|
|
206
222
|
if (process.env.CREATE_TEST_PROJECT_OVERRIDE === 'true') {
|
|
207
223
|
// If we don't use this flag, then the test project will become part of the monorepo and fail to install properly
|
|
208
224
|
args.push('--ignore-workspace')
|
|
209
225
|
}
|
|
210
226
|
|
|
211
|
-
return runCommand(
|
|
212
|
-
scope.packageManager,
|
|
213
|
-
args,
|
|
214
|
-
{ cwd: scope.projectFolder }
|
|
215
|
-
)
|
|
227
|
+
return runCommand(scope.packageManager, args, { cwd: scope.projectFolder })
|
|
216
228
|
}
|
|
217
229
|
|
|
218
|
-
function lintFolder
|
|
230
|
+
function lintFolder(scope) {
|
|
219
231
|
return runCommand(
|
|
220
232
|
scope.packageManager,
|
|
221
233
|
scope.packageManager === 'npm'
|
|
222
|
-
? [
|
|
223
|
-
: [
|
|
234
|
+
? ['run', 'lint', '--', '--fix']
|
|
235
|
+
: ['run', 'lint', '--fix'],
|
|
224
236
|
{ cwd: scope.projectFolder }
|
|
225
237
|
)
|
|
226
238
|
}
|
|
227
239
|
|
|
228
|
-
function formatFolder
|
|
229
|
-
return runCommand(
|
|
230
|
-
scope.
|
|
231
|
-
|
|
232
|
-
{ cwd: scope.projectFolder }
|
|
233
|
-
)
|
|
240
|
+
function formatFolder(scope) {
|
|
241
|
+
return runCommand(scope.packageManager, ['run', 'format'], {
|
|
242
|
+
cwd: scope.projectFolder
|
|
243
|
+
})
|
|
234
244
|
}
|
|
235
245
|
|
|
236
|
-
function hasGit
|
|
246
|
+
function hasGit() {
|
|
237
247
|
try {
|
|
238
248
|
exec('git --version')
|
|
239
249
|
return true
|
|
240
|
-
}
|
|
241
|
-
catch (_) {}
|
|
250
|
+
} catch {}
|
|
242
251
|
}
|
|
243
252
|
|
|
244
|
-
function folderHasGit
|
|
253
|
+
function folderHasGit(cwd) {
|
|
245
254
|
try {
|
|
246
255
|
exec('git status', { stdio: 'ignore', cwd })
|
|
247
256
|
return true
|
|
248
|
-
}
|
|
249
|
-
catch (_) {}
|
|
257
|
+
} catch {}
|
|
250
258
|
}
|
|
251
259
|
|
|
252
|
-
function initializeGit
|
|
260
|
+
function initializeGit(projectFolder) {
|
|
253
261
|
if (hasGit() !== true) {
|
|
254
|
-
logger.log(
|
|
262
|
+
logger.log(
|
|
263
|
+
'Git is not installed on the system, so skipping Git repo initialization.'
|
|
264
|
+
)
|
|
255
265
|
return
|
|
256
266
|
}
|
|
257
267
|
|
|
258
268
|
if (folderHasGit(projectFolder) === true) {
|
|
259
|
-
logger.log(
|
|
269
|
+
logger.log(
|
|
270
|
+
'A parent of the project folder is already a Git repository, so skipping Git initialization.'
|
|
271
|
+
)
|
|
260
272
|
return
|
|
261
273
|
}
|
|
262
274
|
|
|
@@ -267,16 +279,20 @@ function initializeGit (projectFolder) {
|
|
|
267
279
|
|
|
268
280
|
// Provide useful feedback to the user if they have GPG signing enabled to avoid feeling that the process is hanging
|
|
269
281
|
try {
|
|
270
|
-
const needsSigning = exec('git config --get commit.gpgsign', {
|
|
282
|
+
const needsSigning = exec('git config --get commit.gpgsign', {
|
|
283
|
+
cwd: projectFolder
|
|
284
|
+
})
|
|
285
|
+
.toString()
|
|
286
|
+
.trim()
|
|
271
287
|
if (needsSigning === 'true') {
|
|
272
288
|
logger.log('Creating initial commit (waiting for GPG signing)...')
|
|
273
289
|
}
|
|
274
|
-
}
|
|
275
|
-
catch (_) {}
|
|
290
|
+
} catch {}
|
|
276
291
|
|
|
277
|
-
exec('git commit -m "Initialize the project 🚀" --no-verify', {
|
|
278
|
-
|
|
279
|
-
|
|
292
|
+
exec('git commit -m "Initialize the project 🚀" --no-verify', {
|
|
293
|
+
cwd: projectFolder
|
|
294
|
+
})
|
|
295
|
+
} catch {
|
|
280
296
|
logger.warn('Could not initialize Git repository. Please do this manually.')
|
|
281
297
|
return
|
|
282
298
|
}
|
|
@@ -292,14 +308,16 @@ const quasarConfigFilenameList = [
|
|
|
292
308
|
'quasar.conf.js' // legacy
|
|
293
309
|
]
|
|
294
310
|
|
|
295
|
-
function ensureOutsideProject
|
|
311
|
+
function ensureOutsideProject() {
|
|
296
312
|
let dir = process.cwd()
|
|
297
313
|
|
|
298
|
-
while (dir.length && dir[
|
|
314
|
+
while (dir.length && dir[dir.length - 1] !== sep) {
|
|
299
315
|
for (const name of quasarConfigFilenameList) {
|
|
300
316
|
const filename = join(dir, name)
|
|
301
317
|
if (existsSync(filename)) {
|
|
302
|
-
logger.fatal(
|
|
318
|
+
logger.fatal(
|
|
319
|
+
'Error. This command must NOT be executed inside of a Quasar project folder.'
|
|
320
|
+
)
|
|
303
321
|
}
|
|
304
322
|
}
|
|
305
323
|
|
|
@@ -324,10 +342,10 @@ const commonPrompts = {
|
|
|
324
342
|
productName: {
|
|
325
343
|
type: 'text',
|
|
326
344
|
name: 'productName',
|
|
327
|
-
message:
|
|
345
|
+
message:
|
|
346
|
+
'Project product name: (must start with letter if building mobile apps)',
|
|
328
347
|
initial: 'Quasar App',
|
|
329
|
-
validate: val =>
|
|
330
|
-
(val && val.length > 0) || 'Invalid product name'
|
|
348
|
+
validate: val => (val && val.length > 0) || 'Invalid product name'
|
|
331
349
|
},
|
|
332
350
|
|
|
333
351
|
description: {
|
|
@@ -336,8 +354,7 @@ const commonPrompts = {
|
|
|
336
354
|
message: 'Project description:',
|
|
337
355
|
initial: 'A Quasar Project',
|
|
338
356
|
format: escapeString,
|
|
339
|
-
validate: val =>
|
|
340
|
-
val.length > 0 || 'Invalid project description'
|
|
357
|
+
validate: val => val.length > 0 || 'Invalid project description'
|
|
341
358
|
},
|
|
342
359
|
|
|
343
360
|
license: {
|
|
@@ -348,7 +365,7 @@ const commonPrompts = {
|
|
|
348
365
|
}
|
|
349
366
|
}
|
|
350
367
|
|
|
351
|
-
export async function injectAuthor
|
|
368
|
+
export async function injectAuthor(scope) {
|
|
352
369
|
const author = getGitUser()
|
|
353
370
|
|
|
354
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
|
|
File without changes
|