-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
44 lines (37 loc) · 1.19 KB
/
gulpfile.js
File metadata and controls
44 lines (37 loc) · 1.19 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
42
43
44
const proc = require('child_process');
const gulp = require('gulp');
const del = require('del');
const gulpSequence = require("gulp-sequence");
const outputDir = 'Output';
const nodeModulesDir = 'node_modules';
// Asynchronously executes a given command line, and displays error if found.
// Errouneous execution will stop the Gulp process.
// Returns a promise.
const executeProcess = toExec => {
return new Promise((resolve, reject) => {
proc.exec(toExec, (error, stdout, stderr) => {
if (error) {
error.stack = stdout;
reject(error);
}
else {
resolve();
}
});
});
};
gulp.task('compile', done => {
executeProcess(`${__dirname}/node_modules/.bin/tsc`)
.then(done())
.catch(done);
});
gulp.task('clean', () => {
del.sync(`${outputDir}/**`);
})
gulp.task('build', ['compile']);
gulp.task('copy-files', () => {
return gulp
.src([`!${outputDir}/**/*`, `!${nodeModulesDir}/**/*`, '**/*.json', 'README.md'])
.pipe(gulp.dest(outputDir))
});
gulp.task('clean-build', gulpSequence('clean', ['build', 'copy-files']));