vuecssuiant-designantdreactantantd-vueenterprisefrontendui-designvue-antdvue-antd-uivue3vuecomponent
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1009 B
48 lines
1009 B
#!/usr/bin/env node |
|
|
|
'use strict'; |
|
|
|
require('colorful').colorful(); |
|
const gulp = require('gulp'); |
|
const program = require('commander'); |
|
|
|
program.on('--help', () => { |
|
console.log(' Usage:'.to.bold.blue.color); |
|
console.log(); |
|
}); |
|
|
|
program.parse(process.argv); |
|
|
|
function runTask(toRun) { |
|
const metadata = { task: toRun }; |
|
// Gulp >= 4.0.0 (doesn't support events) |
|
const taskInstance = gulp.task(toRun); |
|
if (taskInstance === undefined) { |
|
gulp.emit('task_not_found', metadata); |
|
return; |
|
} |
|
const start = process.hrtime(); |
|
gulp.emit('task_start', metadata); |
|
try { |
|
taskInstance.apply(gulp); |
|
metadata.hrDuration = process.hrtime(start); |
|
gulp.emit('task_stop', metadata); |
|
gulp.emit('stop'); |
|
} catch (err) { |
|
err.hrDuration = process.hrtime(start); |
|
err.task = metadata.task; |
|
gulp.emit('task_err', err); |
|
} |
|
} |
|
|
|
const task = program.args[0]; |
|
|
|
if (!task) { |
|
program.help(); |
|
} else { |
|
console.log('scripts run', task); |
|
|
|
require('./gulpfile'); |
|
|
|
runTask(task); |
|
}
|
|
|