From 75dd9f6ceb346292d19836c57c844a574db1c81f Mon Sep 17 00:00:00 2001 From: tanjinzhou <415800467@qq.com> Date: Wed, 10 Jul 2019 18:14:41 +0800 Subject: [PATCH] update gulp script --- antd-tools/gulpfile.js | 8 ++------ components/vc-slick/src/slider.js | 12 +++--------- components/vc-tree-select/src/util.js | 4 +--- scripts/gulpfile.js | 22 ++++++++++++++-------- scripts/run.js | 24 +++++++++++++++++++++++- 5 files changed, 43 insertions(+), 27 deletions(-) diff --git a/antd-tools/gulpfile.js b/antd-tools/gulpfile.js index 38a1509a7..b832a735b 100644 --- a/antd-tools/gulpfile.js +++ b/antd-tools/gulpfile.js @@ -145,14 +145,10 @@ function tag() { execSync(`git config --global user.name ${process.env.GITHUB_USER_NAME}`); execSync(`git tag ${version}`); execSync( - `git push https://${ - process.env.GITHUB_TOKEN - }@github.com/vueComponent/ant-design-vue.git ${version}:${version}`, + `git push https://${process.env.GITHUB_TOKEN}@github.com/vueComponent/ant-design-vue.git ${version}:${version}`, ); execSync( - `git push https://${ - process.env.GITHUB_TOKEN - }@github.com/vueComponent/ant-design-vue.git master:master`, + `git push https://${process.env.GITHUB_TOKEN}@github.com/vueComponent/ant-design-vue.git master:master`, ); console.log('tagged'); } diff --git a/components/vc-slick/src/slider.js b/components/vc-slick/src/slider.js index aa6d637ef..9dd7d76bd 100644 --- a/components/vc-slick/src/slider.js +++ b/components/vc-slick/src/slider.js @@ -110,9 +110,7 @@ export default { if (settings.centerMode) { if (settings.slidesToScroll > 1 && process.env.NODE_ENV !== 'production') { console.warn( - `slidesToScroll should be equal to 1 in centerMode, you are using ${ - settings.slidesToScroll - }`, + `slidesToScroll should be equal to 1 in centerMode, you are using ${settings.slidesToScroll}`, ); } settings.slidesToScroll = 1; @@ -121,16 +119,12 @@ export default { if (settings.fade) { if (settings.slidesToShow > 1 && process.env.NODE_ENV !== 'production') { console.warn( - `slidesToShow should be equal to 1 when fade is true, you're using ${ - settings.slidesToShow - }`, + `slidesToShow should be equal to 1 when fade is true, you're using ${settings.slidesToShow}`, ); } if (settings.slidesToScroll > 1 && process.env.NODE_ENV !== 'production') { console.warn( - `slidesToScroll should be equal to 1 when fade is true, you're using ${ - settings.slidesToScroll - }`, + `slidesToScroll should be equal to 1 when fade is true, you're using ${settings.slidesToScroll}`, ); } settings.slidesToShow = 1; diff --git a/components/vc-tree-select/src/util.js b/components/vc-tree-select/src/util.js index 06d21e695..b4a466f57 100644 --- a/components/vc-tree-select/src/util.js +++ b/components/vc-tree-select/src/util.js @@ -385,9 +385,7 @@ function processEntity(entity, wrapper) { if (currentEntity) { warning( false, - `Conflict! value of node '${entity.key}' (${value}) has already used by node '${ - currentEntity.key - }'.`, + `Conflict! value of node '${entity.key}' (${value}) has already used by node '${currentEntity.key}'.`, ); } wrapper.valueEntities[value] = entity; diff --git a/scripts/gulpfile.js b/scripts/gulpfile.js index 9bf23f5f1..3306f72e6 100644 --- a/scripts/gulpfile.js +++ b/scripts/gulpfile.js @@ -110,12 +110,18 @@ function copyHtml() { ); } -gulp.task('_site', done => { - dist(() => { +gulp.task( + '_site', + gulp.series(done => { + dist(() => { + copyHtml(); + done(); + }); + }), +); +gulp.task( + 'copy-html', + gulp.series(() => { copyHtml(); - done(); - }); -}); -gulp.task('copy-html', () => { - copyHtml(); -}); + }), +); diff --git a/scripts/run.js b/scripts/run.js index 531d774d2..bafb2eaae 100644 --- a/scripts/run.js +++ b/scripts/run.js @@ -13,6 +13,28 @@ program.on('--help', () => { 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) { @@ -22,5 +44,5 @@ if (!task) { require('./gulpfile'); - gulp.start(task); + runTask(task); }