forked from quxios/QMapEditor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.babel.js
More file actions
41 lines (36 loc) · 1.01 KB
/
Copy pathgulpfile.babel.js
File metadata and controls
41 lines (36 loc) · 1.01 KB
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
import gulp from 'gulp'
import del from 'del'
import babel from 'gulp-babel'
import minify from 'gulp-babel-minify'
import * as builder from 'electron-builder'
import fs from 'fs'
import path from 'path'
gulp.task("clean", () => {
return del([
'compiled/**/*',
'dist/**/*'
]);
});
gulp.task('copy', ['clean'], () => {
return gulp.src('./app/**/!(*.js|*.jsx|*.less)')
.pipe(gulp.dest('./compiled'));
});
gulp.task('buildES6', ['copy'], () => {
process.env.NODE_ENV = 'production';
return gulp.src('./app/**/*.{js,jsx}')
.pipe(babel())
.pipe(minify())
.pipe(gulp.dest('./compiled'));
})
gulp.task('pkg', ['buildES6'], () => {
const {
name, version, main, author, description, license, dependencies
} = require('./package.json');
const pkg = {
name, version,
main: path.relative('./app', main),
author, description, license, dependencies
}
fs.writeFileSync('./compiled/package.json', JSON.stringify(pkg, null, 2));
});
gulp.task('build', ['clean', 'copy', 'buildES6', 'pkg'])