2020-03-09 01:55:02 +01:00
|
|
|
//
|
|
|
|
// build task definitions
|
|
|
|
//
|
|
|
|
// run any task with "yarn build ${taskName}"
|
|
|
|
//
|
2021-02-04 19:15:23 +01:00
|
|
|
const livereload = require('gulp-livereload');
|
2020-11-03 00:41:28 +01:00
|
|
|
const {
|
|
|
|
createTask,
|
|
|
|
composeSeries,
|
|
|
|
composeParallel,
|
|
|
|
detectAndRunEntryTask,
|
2021-02-04 19:15:23 +01:00
|
|
|
} = require('./task');
|
|
|
|
const createManifestTasks = require('./manifest');
|
|
|
|
const createScriptTasks = require('./scripts');
|
|
|
|
const createStyleTasks = require('./styles');
|
|
|
|
const createStaticAssetTasks = require('./static');
|
|
|
|
const createEtcTasks = require('./etc');
|
2020-03-09 01:55:02 +01:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
const browserPlatforms = ['firefox', 'chrome', 'brave', 'opera'];
|
2020-03-09 01:55:02 +01:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
defineAllTasks();
|
|
|
|
detectAndRunEntryTask();
|
2020-03-09 01:55:02 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
function defineAllTasks() {
|
2021-02-04 19:15:23 +01:00
|
|
|
const staticTasks = createStaticAssetTasks({ livereload, browserPlatforms });
|
|
|
|
const manifestTasks = createManifestTasks({ browserPlatforms });
|
|
|
|
const styleTasks = createStyleTasks({ livereload });
|
|
|
|
const scriptTasks = createScriptTasks({ livereload, browserPlatforms });
|
2020-11-03 00:41:28 +01:00
|
|
|
const { clean, reload, zip } = createEtcTasks({
|
|
|
|
livereload,
|
|
|
|
browserPlatforms,
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
2020-03-09 01:55:02 +01:00
|
|
|
|
|
|
|
// build for development (livereload)
|
2020-08-19 18:27:05 +02:00
|
|
|
createTask(
|
|
|
|
'dev',
|
2020-03-09 01:55:02 +01:00
|
|
|
composeSeries(
|
|
|
|
clean,
|
|
|
|
styleTasks.dev,
|
|
|
|
composeParallel(
|
|
|
|
scriptTasks.dev,
|
|
|
|
staticTasks.dev,
|
|
|
|
manifestTasks.dev,
|
2020-07-14 17:20:41 +02:00
|
|
|
reload,
|
|
|
|
),
|
|
|
|
),
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2020-03-09 01:55:02 +01:00
|
|
|
|
|
|
|
// build for test development (livereload)
|
2020-08-19 18:27:05 +02:00
|
|
|
createTask(
|
|
|
|
'testDev',
|
2020-03-09 01:55:02 +01:00
|
|
|
composeSeries(
|
|
|
|
clean,
|
|
|
|
styleTasks.dev,
|
|
|
|
composeParallel(
|
|
|
|
scriptTasks.testDev,
|
|
|
|
staticTasks.dev,
|
|
|
|
manifestTasks.testDev,
|
2020-07-14 17:20:41 +02:00
|
|
|
reload,
|
|
|
|
),
|
|
|
|
),
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2020-03-09 01:55:02 +01:00
|
|
|
|
|
|
|
// build for prod release
|
2020-08-19 18:27:05 +02:00
|
|
|
createTask(
|
|
|
|
'prod',
|
2020-03-09 01:55:02 +01:00
|
|
|
composeSeries(
|
|
|
|
clean,
|
|
|
|
styleTasks.prod,
|
2020-11-03 00:41:28 +01:00
|
|
|
composeParallel(scriptTasks.prod, staticTasks.prod, manifestTasks.prod),
|
2020-03-09 01:55:02 +01:00
|
|
|
zip,
|
2020-07-14 17:20:41 +02:00
|
|
|
),
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2020-03-09 01:55:02 +01:00
|
|
|
|
|
|
|
// build for CI testing
|
2020-08-19 18:27:05 +02:00
|
|
|
createTask(
|
|
|
|
'test',
|
2020-03-09 01:55:02 +01:00
|
|
|
composeSeries(
|
|
|
|
clean,
|
|
|
|
styleTasks.prod,
|
2020-11-03 00:41:28 +01:00
|
|
|
composeParallel(scriptTasks.test, staticTasks.prod, manifestTasks.test),
|
2020-12-11 17:24:17 +01:00
|
|
|
zip,
|
2020-07-14 17:20:41 +02:00
|
|
|
),
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2020-03-09 01:55:02 +01:00
|
|
|
|
|
|
|
// special build for minimal CI testing
|
2021-02-04 19:15:23 +01:00
|
|
|
createTask('styles', styleTasks.prod);
|
2020-03-09 01:55:02 +01:00
|
|
|
}
|