forked from rooey/chromeos-filesystem-onedrive
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
58 lines (50 loc) · 1.63 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
const gulp = require('gulp');
const rm = require('rimraf');
const zip = require('gulp-zip');
const eslint = require('gulp-eslint');
gulp.task('clean', done => {
rm('./dist', done);
});
gulp.task('copy-src-files', () => {
return gulp.src([
'./src/scripts/**/*.js',
'./src/styles/**/*.css',
'./src/icons/**/*.png',
'./src/_locales/**/*.json',
'./src/window.html',
'./src/manifest.json'
], {
base: 'src'
}).pipe(gulp.dest('./dist'));
});
gulp.task('copy-dependent-files', () => {
return gulp.src([
'./node_modules/jquery/dist/jquery.min.js',
'./node_modules/raven-js/dist/raven.js',
'./node_modules/bootstrap/dist/js/bootstrap.js',
'./node_modules/jquery-toast-plugin/dist/jquery.toast.min.js',
'./node_modules/bootstrap/dist/css/bootstrap.css',
'./node_modules/jquery-toast-plugin/dist/jquery.toast.min.css',
'./node_modules/bootstrap/dist/fonts/**/*'
], {
base: 'node_modules'
}).pipe(gulp.dest('./dist/node_modules'));
});
gulp.task('copy-files', gulp.parallel('copy-src-files', 'copy-dependent-files'));
gulp.task('package', () => {
const manifest = require('./dist/manifest.json');
const version = manifest.version;
return gulp.src('./dist/**/*').pipe(zip(`chromeos-filesystem-onedrive-${version}.zip`)).pipe(gulp.dest('./package'));
});
gulp.task('watch', () => {
gulp.watch('./src/**/*', gulp.task('default'));
});
gulp.task('lint', () => {
return gulp.src([
'./src/scripts/*.js'
]).pipe(eslint({
useEslintrc: true,
fix: true
})).pipe(eslint.format()).pipe(eslint.failAfterError());
});
gulp.task('default', gulp.series('clean', 'lint', 'copy-files', 'package'));