mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-04-21 11:58:36 -05:00
feat(ui): display task duration
This commit is contained in:
@@ -288,6 +288,8 @@ async function run (id, context) {
|
||||
text: chalk.grey(`$ ${command} ${args.join(' ')}`)
|
||||
}, context)
|
||||
|
||||
task.time = Date.now()
|
||||
|
||||
process.env.VUE_CLI_CONTEXT = cwd.get()
|
||||
|
||||
const child = execa(command, args, {
|
||||
@@ -325,6 +327,14 @@ async function run (id, context) {
|
||||
|
||||
log('Task exit', command, args, 'code:', code, 'signal:', signal)
|
||||
|
||||
const duration = Date.now() - task.time
|
||||
const seconds = Math.round(duration / 10) / 100
|
||||
addLog({
|
||||
taskId: task.id,
|
||||
type: 'stdout',
|
||||
text: chalk.grey(`Total task duration: ${seconds}s`)
|
||||
}, context)
|
||||
|
||||
// Plugin API
|
||||
if (task.onExit) {
|
||||
await task.onExit({
|
||||
@@ -370,7 +380,7 @@ async function run (id, context) {
|
||||
}, context)
|
||||
notify({
|
||||
title: `Task completed`,
|
||||
message: `Task ${task.id} completed`,
|
||||
message: `Task ${task.id} completed in ${seconds}s.`,
|
||||
icon: 'done'
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user