From 5c982221c90b0a476597f7131d17fb0178270b56 Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Thu, 27 Dec 2018 12:52:57 -0700 Subject: [PATCH] rename then arg to exec in task definition function --- gulpfile.js/index.js | 30 ++++++++++++++++-------------- gulpfile.js/lib/task.js | 2 +- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/gulpfile.js/index.js b/gulpfile.js/index.js index 9b9bd91..79047b3 100644 --- a/gulpfile.js/index.js +++ b/gulpfile.js/index.js @@ -23,73 +23,73 @@ const { remove, lintCss, lintJs, format, build, pack, previewPages, previewServe const cleanTask = task({ name: 'clean', desc: 'Clean files and folders generated by build', - then: remove(['build', 'public']), + exec: remove(['build', 'public']), }) const lintCssTask = task({ name: 'lint:css', desc: 'Lint the CSS source files using stylelint (standard config)', - then: lintCss(cssFileGlobs), + exec: lintCss(cssFileGlobs), }) const lintJsTask = task({ name: 'lint:js', desc: 'Lint the JavaScript source files using eslint (JavaScript Standard Style)', - then: lintJs(jsFileGlobs), + exec: lintJs(jsFileGlobs), }) const lintTask = task({ name: 'lint', desc: 'Lint the CSS and JavaScript source files', - then: parallel(lintCssTask, lintJsTask), + exec: parallel(lintCssTask, lintJsTask), }) const formatTask = task({ name: 'format', desc: 'Format the JavaScript source files using prettify (JavaScript Standard Style)', - then: format(jsFileGlobs), + exec: format(jsFileGlobs), }) const buildTask = task({ name: 'build', desc: 'Build and stage the UI assets for bundling', - then: build(srcDir, destDir, tree().nodes.some((name) => ~name.indexOf('preview'))), + exec: build(srcDir, destDir, tree().nodes.some((name) => ~name.indexOf('preview'))), }) const bundleBuildTask = task({ name: 'bundle:build', desc: 'Lint the source files and build and stage the UI assets for bundling', - then: series(cleanTask, lintTask, buildTask), + exec: series(cleanTask, lintTask, buildTask), }) const bundlePackTask = task({ name: 'bundle:pack', desc: 'Create a bundle of the staged UI assets for publishing', - then: pack(destDir, buildDir, bundleName), + exec: pack(destDir, buildDir, bundleName), }) const bundleTask = task({ name: 'bundle', desc: 'Clean, lint, build, and bundle the UI for publishing', - then: series(bundleBuildTask, bundlePackTask), + exec: series(bundleBuildTask, bundlePackTask), }) const previewPagesTask = task({ name: 'preview:pages', desc: 'Generate pages for the preview by applying the specified layout template', - then: previewPages(srcDir, destDir, previewSiteSrcDir, previewSiteDestDir, livereload), + exec: previewPages(srcDir, destDir, previewSiteSrcDir, previewSiteDestDir, livereload), }) const previewBuildTask = task({ name: 'preview:build', desc: 'Process and stage the UI assets and generate pages for the preview', - then: parallel(buildTask, previewPagesTask), + exec: parallel(buildTask, previewPagesTask), }) const previewServeTask = task({ name: 'preview:serve', desc: 'Launch server to preview UI', - then: previewServe(previewSiteDestDir, { + exec: previewServe(previewSiteDestDir, { port: 5252, livereload, watch: { src: [srcDir, previewSiteSrcDir], onChange: previewBuildTask }, @@ -99,11 +99,13 @@ const previewServeTask = task({ const previewTask = task({ name: 'preview', desc: 'Generate a preview site and launch a server to view it', - then: series(previewBuildTask, previewServeTask), + exec: series(previewBuildTask, previewServeTask), }) +const defaultTask = task({ name: 'default', desc: `(${bundleTask.displayName})`, exec: series(bundleTask) }) + module.exports = exportTasks( - task({ name: 'default', desc: `(${bundleTask.displayName})`, then: series(bundleTask) }), + defaultTask, cleanTask, lintTask, formatTask, diff --git a/gulpfile.js/lib/task.js b/gulpfile.js/lib/task.js index aa4f9d1..9878f27 100644 --- a/gulpfile.js/lib/task.js +++ b/gulpfile.js/lib/task.js @@ -2,7 +2,7 @@ const metadata = require('undertaker/lib/helpers/metadata') -module.exports = ({ name, desc, anon, then: fn }) => { +module.exports = ({ name, desc, exec: fn }) => { if (name) { const displayName = fn.displayName if (displayName === '' || displayName === '') { -- 2.11.0