-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.js
61 lines (48 loc) · 2.43 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
/**
* @license
* Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
'use strict';
const path = require('path');
const gulp = require('gulp');
const nodemon = require('gulp-nodemon');
const clean = require('./gulp-tasks/clean.js');
const buildElements = require('./gulp-tasks/build-elements');
const copyAssets = require('./gulp-tasks/copy-assets');
const copyBower = require('./gulp-tasks/copy-bower');
const runTests = require('./gulp-tasks/test');
const jsLinter = require('./gulp-tasks/js-linter');
global.config = {
appName: 'etoolsTpm',
polymerJsonPath: path.join(process.cwd(), 'polymer.json'),
build: {
rootDirectory: 'build',
bundledDirectory: '',
unbundledDirectory: 'unbundled',
bundleType: 'bundled' // We will only be using a bundled build
},
sourceCodeDirectory: './src'
};
const project = require('./gulp-tasks/project.js');
const source = require('./gulp-tasks/project-source');
const dependencies = require('./gulp-tasks/project-dependencies');
gulp.task('watch', function () {
gulp.watch(['./src/elements/**/*.*'], gulp.series(jsLinter, buildElements));
gulp.watch(['./src/*.*', './src/assets/**/*.*'], gulp.series(copyAssets));
gulp.watch(['./bower_components/**/*.*'], gulp.series(copyBower()));
});
gulp.task('lint', gulp.series(jsLinter));
gulp.task('test', gulp.series(clean.build, gulp.parallel(buildElements, copyAssets, copyBower()), runTests));
gulp.task('startServer', function () { nodemon({ script: 'express.js' }) });
gulp.task('devBuild', gulp.series(clean.build, jsLinter, gulp.parallel(buildElements, copyAssets, copyBower())));
gulp.task('prodBuild', gulp.series(clean.build, copyBower('toSrc'), buildElements, project.merge(source, dependencies), clean.bowerInSrc));
gulp.task('precommit', gulp.series('lint', 'test'));
//Run dev server and watch changes
gulp.task('devup', gulp.series('devBuild', gulp.parallel('startServer', 'watch')));
//Minify scripts, run prod server and watch changes
gulp.task('default', gulp.series([ 'prodBuild']));