forked from plugCubed/plugCubed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
78 lines (58 loc) · 2.76 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
/* eslint-env node */
'use strict';
const fs = require('graceful-fs');
const path = require('path');
const gulp = require('gulp');
const HubRegistry = require('gulp-hub');
let devVersionExists;
try {
fs.accessSync(path.resolve('src', 'dev', 'version.js')); // eslint-disable-line no-sync
devVersionExists = true;
} catch (err) {
devVersionExists = false;
}
Object.defineProperties(global, {
devVersionExists: {
value: devVersionExists
},
versions: {
value: ['alpha', devVersionExists && 'dev', 'release']
}
});
const regex = ['tasks/**/*.js'];
const hub = new HubRegistry(regex);
gulp.registry(hub);
gulp.task('minify:alpha', gulp.parallel('minify:alphaJS', 'minify:alphaCSS', (done) => done()));
gulp.task('minify:release', gulp.parallel('minify:releaseJS', 'minify:releaseCSS', (done) => done()));
gulp.task('build:alpha', gulp.series('test:alpha', 'clean:alpha', 'replace:linksalpha', 'requirejs:alpha', 'autoprefixer:alpha', 'template:alpha', 'minify:alpha', (done) => done()));
gulp.task('build:extensions', gulp.series('extensions:copy', [ 'replace:extensionChrome', 'replace:extensionMaxthon'], ['extensions:Chrome', 'extensions:Firefox', 'extensions:Opera', 'extensions:Maxthon'], (done) => done()));
gulp.task('build:release', gulp.series('test:release', 'clean:release', 'replace:linksrelease', 'requirejs:release', 'autoprefixer:release', 'template:release', ['build:extensions', 'minify:release'], (done) => done()));
if (devVersionExists) {
gulp.task('build:all', gulp.parallel('build:alpha', 'build:dev', 'build:release', (done) => done()));
gulp.task('test:all', gulp.parallel('test:alpha', 'test:dev', 'test:release', (done) => done()));
gulp.task('build:dev', gulp.series('test:dev', 'clean:dev', 'replace:linksdev', 'requirejs:dev', 'autoprefixer:dev', 'template:dev', (done) => done()));
gulp.task('watch:dev', (done) => {
const devWatcher = gulp.watch('**/*.{css,js}', {
cwd: path.resolve('src', 'dev')
}, ['build:dev']);
devWatcher.on('change', (event) => {
console.log(`File ${event.path} was ${event.type} running build:dev task...`);
});
});
}
gulp.task('watch:alpha', (done) => {
const alphaWatcher = gulp.watch('**/*.{css,js}', {
cwd: path.resolve('src', 'alpha')
}, ['build:alpha']);
alphaWatcher.on('change', (event) => {
console.log(`File ${event.path} was ${event.type} running build:alpha task...`);
});
});
gulp.task('watch:release', (done) => {
const releaseWatcher = gulp.watch('**/*.{css,js}', {
cwd: path.resolve('src', 'release')
}, ['build:release']);
releaseWatcher.on('change', (event) => {
console.log(`File ${event.path} was ${event.type} running build:release task...`);
});
});