blob: e97b9f0ffd28b9ea7501dafd7e53a20f2ec31d4b (
plain)
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
|
const { src, dest } = require('gulp');
const ts = require('gulp-typescript');
const inject = require('gulp-inject-string');
const TscWatchClient = require('tsc-watch/client');
function makeWatchCompiler(onFirstSuccess) {
const compileScripts = function() {
const watch = new TscWatchClient();
watch.on('first_success', onFirstSuccess);
watch.start('--noClear', '--sourceMap', '--project', '.');
return watch.tsc;
};
compileScripts.displayName = 'compile-scripts-watch';
return compileScripts;
}
function compileScripts() {
const tsProject = ts.createProject('tsconfig.json');
return tsProject
.src()
.pipe(tsProject())
.pipe(inject.replace('process.env.NODE_ENV', '"production"'))
.pipe(dest('build'));
}
compileScripts.displayName = 'compile-scripts';
exports.build = compileScripts;
exports.makeWatchCompiler = makeWatchCompiler;
|