-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
69 lines (57 loc) · 1.52 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
'use strict';
require('shelljs/global');
const gulp = require('gulp');
const babel = require('gulp-babel');
const ts = require('gulp-typescript');
const tslint = require('gulp-tslint');
const env = process.env.NODE_ENV;
const isProduction = env === 'production';
const isDebug = !isProduction;
const project = ts.createProject('tsconfig.json');
gulp.task('build', [
'build:js',
'build:ts',
'build:copy',
'build:client'
]);
gulp.task('build:js', () =>
gulp.src(['./src/**/*.js', '!./src/web/**/*.js'])
.pipe(babel({
presets: ['es2015', 'stage-3']
}))
.pipe(gulp.dest('./built/'))
);
gulp.task('build:ts', () =>
project
.src()
.pipe(project())
.pipe(babel({
presets: ['es2015', 'stage-3']
}))
.pipe(gulp.dest('./built/'))
);
gulp.task('build:client', ['build:ts', 'build:js'], () => {
const config = require('./built/config').default;
cd(isProduction ? './misskey-web/' : './../misskey-web/');
exec('npm install');
exec(`npm run build -- --url=${config.url} --recaptcha-sitekey=${config.recaptcha.siteKey}`);
cd(__dirname);
return gulp.src(isProduction ? './misskey-web/built/**/*' : './../misskey-web/built/**/*')
.pipe(gulp.dest('./built/web/client/'));
});
gulp.task('build:copy', () => {
gulp.src([
'./src/**/resources/**/*'
]).pipe(gulp.dest('./built/'));
gulp.src([
'./src/web/about/**/*'
]).pipe(gulp.dest('./built/web/about/'));
});
gulp.task('test', ['lint', 'build']);
gulp.task('lint', () =>
gulp.src('./src/**/*.ts')
.pipe(tslint({
formatter: "verbose"
}))
.pipe(tslint.report())
);