-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.babel.js
109 lines (83 loc) · 2.79 KB
/
gulpfile.babel.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
/**
* Created by Henry Huang on 10/28/17.
*/
import gulp from 'gulp';
import gutil from 'gulp-util';
import merge from 'merge-stream';
import clean from 'gulp-clean';
import webpack from 'webpack';
import runSequance from 'run-sequence';
import zip from 'gulp-zip';
import webpackConfig from './webpack.config';
import buildSemantic from './assets/vendor/Semantic-UI/tasks/build';
import release from './gulptasks/release';
const semanticDist = './assets/vendor/Semantic-UI/dist';
gulp.task('default', () => {
gutil.log('This is imhof Gulp!');
});
gulp.task('build', () => {
runSequance('build:webpack', 'build:others', () => {
gutil.log('Imhof builded!');
});
});
gulp.task('dist', () => {
runSequance('dist:copy', 'dist:archive', () => {
gutil.log('Imhof dist done!');
});
});
gulp.task('build:others', () => {
gutil.log('Imhof others builded!');
});
gulp.task('build:semantic', buildSemantic);
gulp.task('build:webpack', (callback) => {
const wConfig = Object.create(webpackConfig);
webpack(wConfig, (err, stats) => {
if (err) throw new gutil.PluginError('build:webpack', err);
gutil.log('[build:webpack]', stats.toString({
colors: true
}));
if (callback) {
callback();
}
});
});
gulp.task('dist:copy', () => {
const helpers = gulp.src(['helpers/**/*'])
.pipe(gulp.dest('dist/helpers/'));
const models = gulp.src(['models/**/*'])
.pipe(gulp.dest('dist/models/'));
const services = gulp.src(['services/**/*'])
.pipe(gulp.dest('dist/services/'));
const publicFolder = gulp.src(['public/**/*'])
.pipe(gulp.dest('dist/public/'));
const routes = gulp.src(['routes/**/*'])
.pipe(gulp.dest('dist/routes/'));
const utils = gulp.src(['utils/**/*'])
.pipe(gulp.dest('dist/utils/'));
const scripts = gulp.src(['scripts/build/**/*'])
.pipe(gulp.dest('dist/scripts/build/'));
const views = gulp.src(['views/**/*'])
.pipe(gulp.dest('dist/views/'));
const imhof_secret = gulp.src(['imhof-secret/**/*'])
.pipe(gulp.dest('dist/imhof-secret/'));
const semantic = gulp.src(['assets/vendor/Semantic-UI/dist/**/*'])
.pipe(gulp.dest('dist/assets/vendor/Semantic-UI/dist/'));
const dist = gulp.src(['package.json', 'app.js', 'config.js', 'pm2.*.config.js'])
.pipe(gulp.dest('dist/'));
return merge(helpers, models, services, publicFolder, routes, utils, scripts, views, imhof_secret, semantic, dist);
});
gulp.task('dist:archive', () => {
const distFolder = __dirname;
return gulp.src('dist/**/*', {
dot: true
}).pipe(zip('imhof-dist.zip'))
.pipe(gulp.dest(distFolder));
});
gulp.task('test', () => {
gutil.log('Imhof tested!');
});
gulp.task('clean', () => {
return gulp.src([semanticDist, 'dist/', 'dist.zip', 'imhof-dist.zip'], {read: false})
.pipe(clean());
});
gulp.task('release', release);