microsoft/vscode-react-native

Public

mirrored from https://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
6e1795837687bce7dfd710cf28503ed1c18e55d8

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

gulpfile.js

76lines · modecode

1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT license. See LICENSE file in the project root for details.
3
4var child_process = require('child_process');
5var gulp = require('gulp');
6var log = require('gulp-util').log;
7var mocha = require('gulp-mocha');
8var sourcemaps = require('gulp-sourcemaps');
9var os = require('os');
10var path = require('path');
11var runSequence = require("run-sequence");
12var ts = require('gulp-typescript');
13
14var srcPath = 'src';
15var outPath = 'out';
16
17var sources = [
18 srcPath,
19].map(function(tsFolder) { return tsFolder + '/**/*.ts'; })
20 .concat(['test/*.ts']);
21
22// TODO: The file property should point to the generated source (this implementation adds an extra folder to the path)
23// We should also make sure that we always generate urls in all the path properties (We shouldn't have \\s. This seems to
24// be an issue on Windows platforms)
25gulp.task('build', function() {
26 var tsProject = ts.createProject('tsconfig.json');
27 return tsProject.src()
28 .pipe(sourcemaps.init())
29 .pipe(ts(tsProject))
30 .pipe(sourcemaps.write('.', {
31 includeContent: false,
32 sourceRoot: function(file) {
33 return path.relative(path.dirname(file.path), __dirname + '/src');
34 }
35 }))
36 .pipe(gulp.dest(outPath));
37});
38
39gulp.task('watch', ['build'], function(cb) {
40 log('Watching build sources...');
41 return gulp.watch(sources, ['build']);
42});
43
44gulp.task('default', function(callback) {
45 runSequence("clean", "build", "tslint", callback);
46});
47
48var lintSources = [
49 srcPath,
50].map(function(tsFolder) { return tsFolder + '/**/*.ts'; });
51lintSources = lintSources.concat([
52 '!src/typings/**'
53]);
54
55var tslint = require('gulp-tslint');
56gulp.task('tslint', function() {
57 return gulp.src(lintSources, { base: '.' })
58 .pipe(tslint())
59 .pipe(tslint.report('verbose'));
60});
61
62function test() {
63 throw new Error('No tests yet');
64}
65
66gulp.task('build-test', ['build'], test);
67gulp.task('test', test);
68
69gulp.task('watch-build-test', ['build', 'build-test'], function() {
70 return gulp.watch(sources, ['build', 'build-test']);
71});
72
73gulp.task("clean", function() {
74 var del = require("del");
75 return del([outPath + "/**"], { force: true });
76});