Skip to content

Commit 90f1146

Browse files
authoredMay 18, 2020
fix(ui): the logs from creator should be displayed in the UI (#5493)
With `logWithSpinner`, the log would be output to the console instead. Fixes #5240 Fixes #5445
1 parent 16d2701 commit 90f1146

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed
 

Diff for: ‎packages/@vue/cli/lib/Creator.js

+5-12
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ const {
3232
log,
3333
warn,
3434
error,
35-
logWithSpinner,
36-
stopSpinner,
3735

3836
hasGit,
3937
hasProjectGit,
@@ -126,7 +124,7 @@ module.exports = class Creator extends EventEmitter {
126124
const pm = new PackageManager({ context, forcePackageManager: packageManager })
127125

128126
await clearConsole()
129-
logWithSpinner(`✨`, `Creating project in ${chalk.yellow(context)}.`)
127+
log(`✨`, `Creating project in ${chalk.yellow(context)}.`)
130128
this.emit('creation', { event: 'creating' })
131129

132130
// get latest CLI plugin version
@@ -164,13 +162,12 @@ module.exports = class Creator extends EventEmitter {
164162
// so that vue-cli-service can setup git hooks.
165163
const shouldInitGit = this.shouldInitGit(cliOptions)
166164
if (shouldInitGit) {
167-
logWithSpinner(`🗃`, `Initializing git repository...`)
165+
log(`🗃`, `Initializing git repository...`)
168166
this.emit('creation', { event: 'git-init' })
169167
await run('git init')
170168
}
171169

172170
// install plugins
173-
stopSpinner()
174171
log(`⚙\u{fe0f} Installing CLI plugins. This might take a while...`)
175172
log()
176173
this.emit('creation', { event: 'plugins-install' })
@@ -205,7 +202,7 @@ module.exports = class Creator extends EventEmitter {
205202
}
206203

207204
// run complete cbs if any (injected by generators)
208-
logWithSpinner('⚓', `Running completion hooks...`)
205+
log('⚓', `Running completion hooks...`)
209206
this.emit('creation', { event: 'completion-hooks' })
210207
for (const cb of afterInvokeCbs) {
211208
await cb()
@@ -216,9 +213,8 @@ module.exports = class Creator extends EventEmitter {
216213

217214
if (!generator.files['README.md']) {
218215
// generate README.md
219-
stopSpinner()
220216
log()
221-
logWithSpinner('📄', 'Generating README.md...')
217+
log('📄', 'Generating README.md...')
222218
await writeFileTree(context, {
223219
'README.md': generateReadme(generator.pkg, packageManager)
224220
})
@@ -252,7 +248,6 @@ module.exports = class Creator extends EventEmitter {
252248
}
253249

254250
// log instructions
255-
stopSpinner()
256251
log()
257252
log(`🎉 Successfully created project ${chalk.yellow(name)}.`)
258253
if (!cliOptions.skipGetStarted) {
@@ -330,13 +325,11 @@ module.exports = class Creator extends EventEmitter {
330325
} else if (name.endsWith('.json') || /^\./.test(name) || path.isAbsolute(name)) {
331326
preset = await loadLocalPreset(path.resolve(name))
332327
} else if (name.includes('/')) {
333-
logWithSpinner(`Fetching remote preset ${chalk.cyan(name)}...`)
328+
log(`Fetching remote preset ${chalk.cyan(name)}...`)
334329
this.emit('creation', { event: 'fetch-remote-preset' })
335330
try {
336331
preset = await loadRemotePreset(name, clone)
337-
stopSpinner()
338332
} catch (e) {
339-
stopSpinner()
340333
error(`Failed fetching remote preset ${chalk.cyan(name)}:`)
341334
throw e
342335
}

0 commit comments

Comments
 (0)
Please sign in to comment.