forked from rubyide/vscode-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
62 lines (49 loc) · 1.64 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
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var gulp = require('gulp');
var path = require('path');
var ts = require('gulp-typescript');
var sourcemaps = require('gulp-sourcemaps');
var log = require('gulp-util').log;
var runSequence = require('run-sequence');
var tsProject = ts.createProject('./src/tsconfig.json');
const inlineMap = true;
const inlineSource = false;
var watchedSources = [
'src/**/*',
'!src/debugger/tests/data/**'
];
var outDest = 'out';
gulp.task('default', function(callback) {
runSequence('build', callback);
});
gulp.task('build', function(callback) {
runSequence('internal-build', callback);
});
gulp.task('ts-watch', ['internal-build'], function(cb) {
log('Watching build sources...');
gulp.watch(watchedSources, ['internal-compile']);
});
//---- internal
// compile and copy everything to outDest
gulp.task('internal-build', function(callback) {
runSequence('internal-compile', callback);
});
gulp.task('internal-compile', function() {
var r = tsProject.src()
.pipe(sourcemaps.init())
.pipe(ts(tsProject)).js;
if (inlineMap && inlineSource) {
r = r.pipe(sourcemaps.write());
} else {
r = r.pipe(sourcemaps.write("../out", {
// no inlined source
includeContent: inlineSource,
// Return relative source map root directories per file.
sourceRoot: "../src"
}));
}
return r.pipe(gulp.dest(outDest));
});