create-quasar 1.5.5 → 1.6.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/.eslintrc.cjs +10 -2
- package/index.js +88 -92
- package/package.json +10 -9
- package/templates/app/index.js +2 -3
- package/templates/app/quasar-v1/index.js +2 -3
- package/templates/app/quasar-v1/js/BASE/src/router/routes.js +0 -1
- package/templates/app/quasar-v1/js/index.js +8 -9
- package/templates/app/quasar-v1/js/lint/_.eslintrc.js +6 -4
- package/templates/app/quasar-v1/ts/index.js +8 -9
- package/templates/app/quasar-v1/ts/lint/_.eslintrc.js +1 -0
- package/templates/app/quasar-v2/index.js +2 -3
- package/templates/app/quasar-v2/js-vite/BASE/src/router/routes.js +0 -1
- package/templates/app/quasar-v2/js-vite/index.js +9 -10
- package/templates/app/quasar-v2/js-vite/lint/_.eslintrc.cjs +1 -0
- package/templates/app/quasar-v2/js-vite-beta/BASE/quasar.config.js +1 -1
- package/templates/app/quasar-v2/js-vite-beta/BASE/src/router/routes.js +0 -1
- package/templates/app/quasar-v2/js-vite-beta/index.js +9 -10
- package/templates/app/quasar-v2/js-vite-beta/lint/_.eslintrc.cjs +1 -0
- package/templates/app/quasar-v2/js-webpack/BASE/src/router/routes.js +0 -1
- package/templates/app/quasar-v2/js-webpack/index.js +9 -10
- package/templates/app/quasar-v2/js-webpack/lint/_.eslintrc.cjs +1 -0
- package/templates/app/quasar-v2/js-webpack-beta/BASE/_package.json +1 -1
- package/templates/app/quasar-v2/js-webpack-beta/BASE/quasar.config.js +5 -5
- package/templates/app/quasar-v2/js-webpack-beta/BASE/src/router/routes.js +0 -1
- package/templates/app/quasar-v2/js-webpack-beta/index.js +9 -10
- package/templates/app/quasar-v2/js-webpack-beta/lint/_.eslintrc.cjs +1 -0
- package/templates/app/quasar-v2/ts-vite/index.js +10 -11
- package/templates/app/quasar-v2/ts-vite/lint/_.eslintrc.cjs +1 -0
- package/templates/app/quasar-v2/ts-vite-beta/BASE/quasar.config.ts +1 -1
- package/templates/app/quasar-v2/ts-vite-beta/index.js +10 -11
- package/templates/app/quasar-v2/ts-vite-beta/lint/_.eslintrc.cjs +1 -0
- package/templates/app/quasar-v2/ts-webpack/index.js +10 -11
- package/templates/app/quasar-v2/ts-webpack/lint/_.eslintrc.cjs +1 -0
- package/templates/app/quasar-v2/ts-webpack-beta/BASE/_package.json +1 -1
- package/templates/app/quasar-v2/ts-webpack-beta/BASE/quasar.config.ts +5 -0
- package/templates/app/quasar-v2/ts-webpack-beta/index.js +10 -11
- package/templates/app/quasar-v2/ts-webpack-beta/lint/_.eslintrc.cjs +1 -0
- package/templates/app-extension/ae-v1/index.js +7 -8
- package/templates/app-extension/index.js +2 -2
- package/templates/ui-kit/index.js +8 -9
- package/templates/ui-kit/quasar-v1/BASE/ui/build/script.app-ext.js +1 -1
- package/templates/ui-kit/quasar-v1/BASE/ui/build/script.clean.js +1 -1
- package/templates/ui-kit/quasar-v1/BASE/ui/dev/quasar.conf.js +1 -1
- package/templates/ui-kit/quasar-v1/index.js +9 -10
- package/templates/ui-kit/quasar-v2/index.js +9 -10
- package/utils/index.js +67 -46
- package/utils/logger.js +66 -43
- /package/templates/{.eslintrc.js → .eslintrc.cjs} +0 -0
- /package/templates/app/quasar-v1/js/{.eslintrc.js → .eslintrc.cjs} +0 -0
- /package/templates/app/quasar-v1/ts/{.eslintrc.js → .eslintrc.cjs} +0 -0
- /package/templates/app/quasar-v2/js-vite/{.eslintrc.js → .eslintrc.cjs} +0 -0
- /package/templates/app/quasar-v2/js-vite-beta/{.eslintrc.js → .eslintrc.cjs} +0 -0
- /package/templates/app/quasar-v2/js-webpack/{.eslintrc.js → .eslintrc.cjs} +0 -0
- /package/templates/app/quasar-v2/js-webpack-beta/{.eslintrc.js → .eslintrc.cjs} +0 -0
- /package/templates/app/quasar-v2/ts-vite/{.eslintrc.js → .eslintrc.cjs} +0 -0
- /package/templates/app/quasar-v2/ts-vite-beta/{.eslintrc.js → .eslintrc.cjs} +0 -0
- /package/templates/app/quasar-v2/ts-webpack/{.eslintrc.js → .eslintrc.cjs} +0 -0
- /package/templates/app/quasar-v2/ts-webpack-beta/{.eslintrc.js → .eslintrc.cjs} +0 -0
- /package/templates/app-extension/ae-v1/{.eslintrc.js → .eslintrc.cjs} +0 -0
- /package/templates/ui-kit/{.eslintrc.js → .eslintrc.cjs} +0 -0
- /package/templates/ui-kit/quasar-v2/{.eslintrc.js → .eslintrc.cjs} +0 -0
package/utils/index.js
CHANGED
|
@@ -1,33 +1,34 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync, existsSync } from 'node:fs'
|
|
2
|
+
import { fileURLToPath } from 'node:url'
|
|
3
|
+
import { sep, normalize, join as pathJoin, resolve, extname } from 'node:path'
|
|
4
|
+
import { spawn, execSync as exec } from 'node:child_process'
|
|
1
5
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const fglob = require('fast-glob')
|
|
8
|
-
const { yellow, green } = require('kolorist')
|
|
9
|
-
const exec = require('child_process').execSync
|
|
10
|
-
const spawn = require('child_process').spawn
|
|
6
|
+
import { emptyDirSync, ensureDirSync, ensureFileSync, copySync } from 'fs-extra/esm'
|
|
7
|
+
import promptUser from 'prompts'
|
|
8
|
+
import compileTemplate from 'lodash/template.js'
|
|
9
|
+
import fglob from 'fast-glob'
|
|
10
|
+
import { yellow, green } from 'kolorist'
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
import logger from './logger.js'
|
|
13
13
|
|
|
14
14
|
const TEMPLATING_FILE_EXTENSIONS = [ '', '.json', '.js', '.cjs', '.ts', '.vue', '.md', '.html', '.sass' ]
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
function join (importMetaUrl, targetPath) {
|
|
17
|
+
return fileURLToPath(new URL('./' + targetPath, importMetaUrl))
|
|
18
|
+
}
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
async function prompts (scope, questions, opts) {
|
|
20
21
|
const options = opts || {
|
|
21
22
|
onCancel: () => {
|
|
22
23
|
logger.fatal('Scaffolding cancelled')
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
const answers = await
|
|
27
|
+
const answers = await promptUser(questions, options)
|
|
27
28
|
Object.assign(scope, answers)
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
function createTargetDir (scope) {
|
|
31
32
|
console.log()
|
|
32
33
|
logger.log('Generating files...')
|
|
33
34
|
console.log()
|
|
@@ -36,24 +37,24 @@ module.exports.createTargetDir = function (scope) {
|
|
|
36
37
|
fn(scope.projectFolder)
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
function convertArrayToObject (arr) {
|
|
40
41
|
const acc = {}
|
|
41
42
|
arr.forEach(key => {
|
|
42
|
-
acc[key] = true
|
|
43
|
+
acc[ key ] = true
|
|
43
44
|
})
|
|
44
45
|
return acc
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
|
|
48
|
+
const runningPackageManager = (() => {
|
|
48
49
|
const userAgent = process.env.npm_config_user_agent
|
|
49
50
|
|
|
50
51
|
if (userAgent) {
|
|
51
|
-
return userAgent.split(' ')[0].split('/')[0]
|
|
52
|
+
return userAgent.split(' ')[ 0 ].split('/')[ 0 ]
|
|
52
53
|
}
|
|
53
54
|
})()
|
|
54
55
|
|
|
55
|
-
|
|
56
|
-
const files = fglob.sync(['**/*'], { cwd: templateDir })
|
|
56
|
+
function renderTemplate (templateDir, scope) {
|
|
57
|
+
const files = fglob.sync([ '**/*' ], { cwd: templateDir })
|
|
57
58
|
|
|
58
59
|
for (const rawPath of files) {
|
|
59
60
|
const targetRelativePath = rawPath.split('/').map(name => {
|
|
@@ -72,11 +73,11 @@ module.exports.renderTemplate = function (templateDir, scope) {
|
|
|
72
73
|
|
|
73
74
|
ensureFileSync(targetPath)
|
|
74
75
|
|
|
75
|
-
console.log(` ${green('-')} ${targetRelativePath}`)
|
|
76
|
+
console.log(` ${ green('-') } ${ targetRelativePath }`)
|
|
76
77
|
|
|
77
78
|
if (TEMPLATING_FILE_EXTENSIONS.includes(extension)) {
|
|
78
79
|
const rawContent = readFileSync(sourcePath, 'utf-8')
|
|
79
|
-
const template = compileTemplate(rawContent, {
|
|
80
|
+
const template = compileTemplate(rawContent, { interpolate: /<%=([\s\S]+?)%>/g })
|
|
80
81
|
|
|
81
82
|
const newContent = extension === '.json'
|
|
82
83
|
? JSON.stringify(JSON.parse(template(scope)), null, 2)
|
|
@@ -90,13 +91,13 @@ module.exports.renderTemplate = function (templateDir, scope) {
|
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
93
|
|
|
93
|
-
|
|
94
|
+
function isValidPackageName (projectName) {
|
|
94
95
|
return /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(
|
|
95
96
|
projectName
|
|
96
97
|
)
|
|
97
98
|
}
|
|
98
99
|
|
|
99
|
-
|
|
100
|
+
function inferPackageName (projectFolder) {
|
|
100
101
|
return projectFolder
|
|
101
102
|
.trim()
|
|
102
103
|
.toLowerCase()
|
|
@@ -105,7 +106,7 @@ module.exports.inferPackageName = function (projectFolder) {
|
|
|
105
106
|
.replace(/[^a-z0-9-~]+/g, '-')
|
|
106
107
|
}
|
|
107
108
|
|
|
108
|
-
|
|
109
|
+
function escapeString (val) {
|
|
109
110
|
return JSON.stringify(val).slice(1, -1)
|
|
110
111
|
}
|
|
111
112
|
|
|
@@ -130,20 +131,20 @@ function getGitUser () {
|
|
|
130
131
|
*
|
|
131
132
|
* @param {Object} scope Data from questionnaire.
|
|
132
133
|
*/
|
|
133
|
-
|
|
134
|
+
function printFinalMessage (scope) {
|
|
134
135
|
const verPrefix = scope.quasarVersion ? scope.quasarVersion + '.' : ''
|
|
135
136
|
const message = `
|
|
136
137
|
To get started:
|
|
137
|
-
${yellow(`
|
|
138
|
-
cd ${scope.projectFolderName}${ scope.skipDepsInstall !== true && scope.packageManager === false ? `
|
|
138
|
+
${ yellow(`
|
|
139
|
+
cd ${ scope.projectFolderName }${ scope.skipDepsInstall !== true && scope.packageManager === false ? `
|
|
139
140
|
yarn #or: npm install
|
|
140
141
|
yarn lint --fix # or: npm run lint -- --fix` : '' }${ scope.skipDepsInstall !== true ? `
|
|
141
142
|
quasar dev # or: yarn quasar dev # or: npx quasar dev` : '' }
|
|
142
|
-
`)}
|
|
143
|
-
Documentation can be found at: https://${verPrefix}quasar.dev
|
|
143
|
+
`) }
|
|
144
|
+
Documentation can be found at: https://${ verPrefix }quasar.dev
|
|
144
145
|
|
|
145
146
|
Quasar is relying on donations to evolve. We'd be very grateful if you can
|
|
146
|
-
read our manifest on "Why donations are important": https://${verPrefix}quasar.dev/why-donate
|
|
147
|
+
read our manifest on "Why donations are important": https://${ verPrefix }quasar.dev/why-donate
|
|
147
148
|
Donation campaign: https://donate.quasar.dev
|
|
148
149
|
Any amount is very welcome.
|
|
149
150
|
If invoices are required, please first contact Razvan Stoenescu.
|
|
@@ -166,7 +167,7 @@ function runCommand (cmd, args, options) {
|
|
|
166
167
|
Object.assign({
|
|
167
168
|
cwd: process.cwd(),
|
|
168
169
|
stdio: 'inherit',
|
|
169
|
-
shell: true
|
|
170
|
+
shell: true
|
|
170
171
|
}, options)
|
|
171
172
|
)
|
|
172
173
|
|
|
@@ -174,7 +175,7 @@ function runCommand (cmd, args, options) {
|
|
|
174
175
|
console.log()
|
|
175
176
|
|
|
176
177
|
if (code) {
|
|
177
|
-
console.log(` ${cmd} FAILED...`)
|
|
178
|
+
console.log(` ${ cmd } FAILED...`)
|
|
178
179
|
console.log()
|
|
179
180
|
reject()
|
|
180
181
|
}
|
|
@@ -185,7 +186,7 @@ function runCommand (cmd, args, options) {
|
|
|
185
186
|
})
|
|
186
187
|
}
|
|
187
188
|
|
|
188
|
-
|
|
189
|
+
function installDeps (scope) {
|
|
189
190
|
return runCommand(
|
|
190
191
|
scope.packageManager,
|
|
191
192
|
[ 'install' ],
|
|
@@ -193,12 +194,12 @@ module.exports.installDeps = function (scope) {
|
|
|
193
194
|
)
|
|
194
195
|
}
|
|
195
196
|
|
|
196
|
-
|
|
197
|
+
function lintFolder (scope) {
|
|
197
198
|
return runCommand(
|
|
198
199
|
scope.packageManager,
|
|
199
200
|
scope.packageManager === 'npm'
|
|
200
|
-
? ['run', 'lint', '--', '--fix']
|
|
201
|
-
: ['run', 'lint', '--fix'],
|
|
201
|
+
? [ 'run', 'lint', '--', '--fix' ]
|
|
202
|
+
: [ 'run', 'lint', '--fix' ],
|
|
202
203
|
{ cwd: scope.projectFolder }
|
|
203
204
|
)
|
|
204
205
|
}
|
|
@@ -211,18 +212,18 @@ const quasarConfigFilenameList = [
|
|
|
211
212
|
'quasar.conf.js' // legacy
|
|
212
213
|
]
|
|
213
214
|
|
|
214
|
-
|
|
215
|
+
function ensureOutsideProject () {
|
|
215
216
|
let dir = process.cwd()
|
|
216
217
|
|
|
217
|
-
while (dir.length && dir[dir.length - 1] !== sep) {
|
|
218
|
+
while (dir.length && dir[ dir.length - 1 ] !== sep) {
|
|
218
219
|
for (const name of quasarConfigFilenameList) {
|
|
219
|
-
const filename =
|
|
220
|
+
const filename = pathJoin(dir, name)
|
|
220
221
|
if (existsSync(filename)) {
|
|
221
|
-
logger.fatal(
|
|
222
|
+
logger.fatal('Error. This command must NOT be executed inside of a Quasar project folder.')
|
|
222
223
|
}
|
|
223
224
|
}
|
|
224
225
|
|
|
225
|
-
dir = normalize(
|
|
226
|
+
dir = normalize(pathJoin(dir, '..'))
|
|
226
227
|
}
|
|
227
228
|
}
|
|
228
229
|
|
|
@@ -235,7 +236,7 @@ const SCRIPT_TYPES = [
|
|
|
235
236
|
{ title: 'Typescript', value: 'ts' }
|
|
236
237
|
]
|
|
237
238
|
|
|
238
|
-
|
|
239
|
+
const commonPrompts = {
|
|
239
240
|
quasarVersion: {
|
|
240
241
|
type: 'select',
|
|
241
242
|
name: 'quasarVersion',
|
|
@@ -258,7 +259,7 @@ module.exports.commonPrompts = {
|
|
|
258
259
|
message: 'Project product name: (must start with letter if building mobile apps)',
|
|
259
260
|
initial: 'Quasar App',
|
|
260
261
|
validate: val =>
|
|
261
|
-
val && val.length > 0 || 'Invalid product name'
|
|
262
|
+
(val && val.length > 0) || 'Invalid product name'
|
|
262
263
|
},
|
|
263
264
|
|
|
264
265
|
description: {
|
|
@@ -266,7 +267,7 @@ module.exports.commonPrompts = {
|
|
|
266
267
|
name: 'description',
|
|
267
268
|
message: 'Project description:',
|
|
268
269
|
initial: 'A Quasar Project',
|
|
269
|
-
format:
|
|
270
|
+
format: escapeString,
|
|
270
271
|
validate: val =>
|
|
271
272
|
val.length > 0 || 'Invalid project description'
|
|
272
273
|
},
|
|
@@ -307,3 +308,23 @@ module.exports.commonPrompts = {
|
|
|
307
308
|
message: 'Issue reporting URL: (eg https://github.com/quasarframework/quasar/issues)'
|
|
308
309
|
}
|
|
309
310
|
}
|
|
311
|
+
|
|
312
|
+
export default {
|
|
313
|
+
logger,
|
|
314
|
+
|
|
315
|
+
join,
|
|
316
|
+
prompts,
|
|
317
|
+
createTargetDir,
|
|
318
|
+
convertArrayToObject,
|
|
319
|
+
runningPackageManager,
|
|
320
|
+
renderTemplate,
|
|
321
|
+
isValidPackageName,
|
|
322
|
+
inferPackageName,
|
|
323
|
+
|
|
324
|
+
printFinalMessage,
|
|
325
|
+
installDeps,
|
|
326
|
+
lintFolder,
|
|
327
|
+
ensureOutsideProject,
|
|
328
|
+
|
|
329
|
+
commonPrompts
|
|
330
|
+
}
|
package/utils/logger.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
import {
|
|
2
2
|
bgGreen, green,
|
|
3
3
|
inverse,
|
|
4
4
|
bgRed, red,
|
|
5
5
|
bgYellow, yellow,
|
|
6
6
|
black, white,
|
|
7
7
|
underline
|
|
8
|
-
}
|
|
8
|
+
} from 'kolorist'
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
import readline from 'node:readline'
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Pills
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
const successPill = msg => bgGreen(black(` ${msg} `))
|
|
17
|
-
const infoPill = msg => inverse(` ${msg} `)
|
|
18
|
-
const errorPill = msg => bgRed(white(` ${msg} `))
|
|
19
|
-
const warningPill = msg => bgYellow(black(` ${msg} `))
|
|
16
|
+
const successPill = msg => bgGreen(black(` ${ msg } `))
|
|
17
|
+
const infoPill = msg => inverse(` ${ msg } `)
|
|
18
|
+
const errorPill = msg => bgRed(white(` ${ msg } `))
|
|
19
|
+
const warningPill = msg => bgYellow(black(` ${ msg } `))
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Main approach
|
|
@@ -27,11 +27,9 @@ const banner = 'Quasar ' + dot
|
|
|
27
27
|
const greenBanner = green(banner)
|
|
28
28
|
const redBanner = red(banner)
|
|
29
29
|
const yellowBanner = yellow(banner)
|
|
30
|
-
const tipBanner = `${green('App')} ${dot} ${successPill('TIP')} ${dot} 🚀 `
|
|
30
|
+
const tipBanner = `${ green('App') } ${ dot } ${ successPill('TIP') } ${ dot } 🚀 `
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
module.exports.clearConsole = process.stdout.isTTY
|
|
32
|
+
const clearConsole = process.stdout.isTTY
|
|
35
33
|
? () => {
|
|
36
34
|
// Fill screen with blank lines. Then move to 0 (beginning of visible part) and clear it
|
|
37
35
|
const blank = '\n'.repeat(process.stdout.rows)
|
|
@@ -41,34 +39,34 @@ module.exports.clearConsole = process.stdout.isTTY
|
|
|
41
39
|
}
|
|
42
40
|
: () => {}
|
|
43
41
|
|
|
44
|
-
|
|
45
|
-
console.log(msg ? ` ${tipBanner} ${msg}` : '')
|
|
42
|
+
function tip (msg) {
|
|
43
|
+
console.log(msg ? ` ${ tipBanner } ${ msg }` : '')
|
|
46
44
|
}
|
|
47
45
|
|
|
48
|
-
|
|
49
|
-
console.log(msg ? ` ${greenBanner} ${msg}` : '')
|
|
46
|
+
function log (msg) {
|
|
47
|
+
console.log(msg ? ` ${ greenBanner } ${ msg }` : '')
|
|
50
48
|
}
|
|
51
49
|
|
|
52
|
-
|
|
50
|
+
function warn (msg, pill) {
|
|
53
51
|
if (msg !== void 0) {
|
|
54
52
|
const pillBanner = pill !== void 0
|
|
55
53
|
? bgYellow(black('', pill, '')) + ' '
|
|
56
54
|
: ''
|
|
57
55
|
|
|
58
|
-
console.warn(` ${yellowBanner} ⚠️ ${pillBanner}${msg}`)
|
|
56
|
+
console.warn(` ${ yellowBanner } ⚠️ ${ pillBanner }${ msg }`)
|
|
59
57
|
}
|
|
60
58
|
else {
|
|
61
59
|
console.warn()
|
|
62
60
|
}
|
|
63
61
|
}
|
|
64
62
|
|
|
65
|
-
|
|
63
|
+
function fatal (msg, pill) {
|
|
66
64
|
if (msg !== void 0) {
|
|
67
65
|
const pillBanner = pill !== void 0
|
|
68
66
|
? errorPill(pill) + ' '
|
|
69
67
|
: ''
|
|
70
68
|
|
|
71
|
-
console.error(`\n ${redBanner} ⚠️ ${pillBanner}${msg}\n`)
|
|
69
|
+
console.error(`\n ${ redBanner } ⚠️ ${ pillBanner }${ msg }\n`)
|
|
72
70
|
}
|
|
73
71
|
else {
|
|
74
72
|
console.error()
|
|
@@ -81,54 +79,79 @@ module.exports.fatal = function (msg, pill) {
|
|
|
81
79
|
* Extended approach - Status & pills
|
|
82
80
|
*/
|
|
83
81
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
console.log(` ${greenBanner} ${successPill(title)} ${green(dot + ' ' + msg)}`)
|
|
82
|
+
function success (msg, title = 'SUCCESS') {
|
|
83
|
+
console.log(` ${ greenBanner } ${ successPill(title) } ${ green(dot + ' ' + msg) }`)
|
|
87
84
|
}
|
|
88
|
-
|
|
89
|
-
return ` ${greenBanner} ${successPill(title)} ${green(dot + ' ' + msg)}`
|
|
85
|
+
function getSuccess (msg, title) {
|
|
86
|
+
return ` ${ greenBanner } ${ successPill(title) } ${ green(dot + ' ' + msg) }`
|
|
90
87
|
}
|
|
91
88
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
console.log(` ${greenBanner} ${infoPill(title)} ${green(dot)} ${msg}`)
|
|
89
|
+
function info (msg, title = 'INFO') {
|
|
90
|
+
console.log(` ${ greenBanner } ${ infoPill(title) } ${ green(dot) } ${ msg }`)
|
|
95
91
|
}
|
|
96
|
-
|
|
97
|
-
return ` ${greenBanner} ${infoPill(title)} ${green(dot)} ${msg}`
|
|
92
|
+
function getInfo (msg, title) {
|
|
93
|
+
return ` ${ greenBanner } ${ infoPill(title) } ${ green(dot) } ${ msg }`
|
|
98
94
|
}
|
|
99
95
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
console.log(` ${redBanner} ${errorPill(title)} ${red(dot + ' ' + msg)}`)
|
|
96
|
+
function error (msg, title = 'ERROR') {
|
|
97
|
+
console.log(` ${ redBanner } ${ errorPill(title) } ${ red(dot + ' ' + msg) }`)
|
|
103
98
|
}
|
|
104
|
-
|
|
105
|
-
return ` ${redBanner} ${errorPill(title)} ${red(dot + ' ' + msg)}`
|
|
99
|
+
function getError (msg, title = 'ERROR') {
|
|
100
|
+
return ` ${ redBanner } ${ errorPill(title) } ${ red(dot + ' ' + msg) }`
|
|
106
101
|
}
|
|
107
102
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
console.log(` ${yellowBanner} ${warningPill(title)} ${yellow(dot + ' ' + msg)}`)
|
|
103
|
+
function warning (msg, title = 'WARNING') {
|
|
104
|
+
console.log(` ${ yellowBanner } ${ warningPill(title) } ${ yellow(dot + ' ' + msg) }`)
|
|
111
105
|
}
|
|
112
|
-
|
|
113
|
-
return ` ${yellowBanner} ${warningPill(title)} ${yellow(dot + ' ' + msg)}`
|
|
106
|
+
function getWarning (msg, title = 'WARNING') {
|
|
107
|
+
return ` ${ yellowBanner } ${ warningPill(title) } ${ yellow(dot + ' ' + msg) }`
|
|
114
108
|
}
|
|
115
109
|
|
|
116
110
|
/**
|
|
117
111
|
* Progress related
|
|
118
112
|
*/
|
|
119
113
|
|
|
120
|
-
|
|
114
|
+
function progress (msg, token) {
|
|
121
115
|
const parseMsg = token !== void 0
|
|
122
116
|
? text => text.replace('___', underline(green(token)))
|
|
123
117
|
: text => text
|
|
124
118
|
|
|
125
|
-
|
|
119
|
+
info(parseMsg(msg), 'WAIT')
|
|
126
120
|
|
|
127
121
|
const startTime = Date.now()
|
|
128
122
|
|
|
129
123
|
return msg => {
|
|
130
124
|
const diffTime = +new Date() - startTime
|
|
131
|
-
|
|
132
|
-
|
|
125
|
+
success(`${ parseMsg(msg) } ${ dot } ${ diffTime }ms`, 'DONE')
|
|
126
|
+
log()
|
|
133
127
|
}
|
|
134
128
|
}
|
|
129
|
+
|
|
130
|
+
export default {
|
|
131
|
+
successPill,
|
|
132
|
+
infoPill,
|
|
133
|
+
errorPill,
|
|
134
|
+
warningPill,
|
|
135
|
+
|
|
136
|
+
dot,
|
|
137
|
+
|
|
138
|
+
clearConsole,
|
|
139
|
+
tip,
|
|
140
|
+
log,
|
|
141
|
+
warn,
|
|
142
|
+
fatal,
|
|
143
|
+
|
|
144
|
+
success,
|
|
145
|
+
getSuccess,
|
|
146
|
+
|
|
147
|
+
info,
|
|
148
|
+
getInfo,
|
|
149
|
+
|
|
150
|
+
error,
|
|
151
|
+
getError,
|
|
152
|
+
|
|
153
|
+
warning,
|
|
154
|
+
getWarning,
|
|
155
|
+
|
|
156
|
+
progress
|
|
157
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|