-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
133 lines (113 loc) · 4.07 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/**
* Task running and building through Gulp.
* http://gulpjs.com/
*
* Make sure you're Gulp CLI is up to date with: `npm install -g gulp-cli`
*
* Groups of tasks are managed in sub files in ./lib/
*
* Use `gulp tasks` to get a helpful list of tasks.
*
* In general, try to use config files (like .babelrc) to manage
* options for processes. This will allow moving away from
* Gulp more easily if desired.
*/
'use strict';
// Dependencies
const gulp = require('gulp');
const js = require('./lib/gulp-js.js');
const styles = require('./lib/gulp-styles.js');
const html = require('./lib/gulp-html.js');
const misc = require('./lib/gulp-misc.js');
const assets = require('./lib/gulp-assets.js');
const develop = require('./lib/gulp-develop.js');
const cms = require('./lib/gulp-cms.js');
const tasks = require('./lib/gulp-tasks.js');
const publish = require('./lib/gulp-publish.js');
const googleDrive = require('./lib/gulp-google-drive.js');
// Make default just list of tasks
gulp.task('default', tasks.list);
// Google
gulp.task('google:share', googleDrive.share);
gulp.task('google:owner', googleDrive.owner);
gulp.task('google:new-doc', googleDrive.newDoc);
gulp.task('google:new-sheet', googleDrive.newSheet);
gulp.task('google:new-content-sheet', googleDrive.newContentSheet);
gulp.task('google:api', googleDrive.apiInfo);
// CMS
gulp.task('cms:info', cms.config);
gulp.task('cms:lcd', cms.lcd);
// HTML
gulp.task('html:lint-simple', html.lintSimple);
gulp.task('html:lint', html.lint);
gulp.task('html:build', html.htmlSvelte);
// JS
gulp.task('js:lint', js.lint);
gulp.task('js:test', js.test);
gulp.task('js:build', js.js);
// Styles
gulp.task('styles:lint', styles.lint);
gulp.task('styles:build', styles.styles);
// Develop
gulp.task('develop:server', develop.server);
// Publish
gulp.task('publish:build-token', publish.buildToken);
gulp.task('publish:compare-token', publish.compareToken);
gulp.task('publish:info', publish.info);
gulp.task('publish:open', publish.open);
gulp.task('publish:publish', publish.publish);
// Combine publish and build token
const allPublish = gulp.series('publish:build-token', 'publish:publish');
allPublish.description =
'Exports publish token to build folder and then publishes.';
gulp.task('publish', allPublish);
// Misc
gulp.task('clean', misc.clean);
// Assets
gulp.task('assets', assets.allAssets);
// Main HTML tasks
const simpleHTML = gulp.series('html:build', 'html:lint-simple');
simpleHTML.description = 'Build and (simple) lint HTML';
gulp.task('html:simple', simpleHTML);
const allHTML = gulp.series('html:build', 'html:lint');
allHTML.description = 'Build and lint HTML';
gulp.task('html', allHTML);
// Main JS task
const allJS = gulp.series(gulp.parallel('js:lint', 'js:test'), 'js:build');
allJS.description = 'Lint, test, and build JS.';
gulp.task('js', allJS);
// Main Styles task
const allStyles = gulp.series('styles:lint', 'styles:build');
allStyles.description = 'Lint, and build CSS from SASS.';
gulp.task('styles', allStyles);
// Main development task
const allBuild = gulp.parallel('html:simple', 'styles', 'js', 'assets');
allBuild.description = 'Full project build.';
gulp.task('build', allBuild);
// Combined watch task
async function allWatch() {
gulp.watch(['styles/**/*.scss'], gulp.series('styles'));
gulp.watch(
['templates/**/*', 'config.*json', 'package.json', 'content.json'],
gulp.series('html:simple')
);
gulp.watch(['templates/**/*', 'app/**/*', 'config.json'], gulp.series('js'));
gulp.watch(['assets/**/*'], gulp.series('assets'));
}
allWatch.description =
'Watch project for changes, and re-run specific build steps.';
gulp.task('watch', allWatch);
// Main development task
const allDevelop = gulp.series(
'build',
gulp.parallel('develop:server', 'watch')
);
allDevelop.description = 'Build, run web server, and watch for changes.';
gulp.task('develop', allDevelop);
// Deploy, which wraps publish
const deploy = gulp.series('clean', 'build', 'publish');
deploy.description =
'Cleans the build directory, runs the full build, and publishes to S3.';
gulp.task('deploy', deploy);
// Task list
gulp.task('tasks', tasks.list);