Commit 5c982221 authored by Dan Allen's avatar Dan Allen

rename then arg to exec in task definition function

parent 12493e37
......@@ -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,
......
......@@ -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 === '<series>' || displayName === '<parallel>') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment