feat(ui): display task duration

This commit is contained in:
Guillaume Chau
2018-06-20 17:13:40 +02:00
parent f86597bbea
commit 20b6f4e430
@@ -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'
})
}