microsoft/vscode-react-native

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
4f09f44912e7d07dae2f9825cb31092cc2d21244

Branches

Tags

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

Clone

HTTPS

Download ZIP

gulpfile.js

81lines · 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 sourcemaps = require('gulp-sourcemaps');
8var os = require('os');
9var path = require('path');
10var runSequence = require("run-sequence");
11var ts = require('gulp-typescript');
12
13var srcPath = 'src';
14var outPath = 'out';
15
16var sources = [
17 srcPath,
18].map(function (tsFolder) { return tsFolder + '/**/*.ts'; })
19 .concat(['test/*.ts']);
20
21// TODO: The file property should point to the generated source (this implementation adds an extra folder to the path)
22// We should also make sure that we always generate urls in all the path properties (We shouldn't have \\s. This seems to
23// be an issue on Windows platforms)
24gulp.task('build', function () {
25 var tsProject = ts.createProject('tsconfig.json');
26 return tsProject.src()
27 .pipe(sourcemaps.init())
28 .pipe(ts(tsProject))
29 .pipe(sourcemaps.write('.', {
30 includeContent: false,
31 sourceRoot: function (file) {
32 return path.relative(path.dirname(file.path), __dirname + '/src');
33 }
34 }))
35 .pipe(gulp.dest(outPath));
36});
37
38gulp.task('watch', ['build'], function (cb) {
39 log('Watching build sources...');
40 return gulp.watch(sources, ['build']);
41});
42
43gulp.task('default', function (callback) {
44 runSequence("clean", "build", "tslint", callback);
45});
46
47var lintSources = [
48 srcPath,
49].map(function (tsFolder) { return tsFolder + '/**/*.ts'; });
50lintSources = lintSources.concat([
51 '!src/typings/**'
52]);
53
54var tslint = require('gulp-tslint');
55gulp.task('tslint', function () {
56 return gulp.src(lintSources, { base: '.' })
57 .pipe(tslint())
58 .pipe(tslint.report('verbose'));
59});
60
61function test() {
62 throw new Error('To run tests, open the extension in VS Code and hit F5 with the "Launch Tests" configuration. Alternatively, on Mac OS, you can run "npm test" on the command line.');
63}
64
65gulp.task('build-test', ['build'], test);
66gulp.task('test', test);
67
68gulp.task('watch-build-test', ['build', 'build-test'], function () {
69 return gulp.watch(sources, ['build', 'build-test']);
70});
71
72gulp.task("clean", function () {
73 var del = require("del");
74 var pathsToDelete = [
75 outPath,
76 ".vscode-test"
77 ].map(function (folder) {
78 return folder + "/**";
79 });
80 return del(pathsToDelete, { force: true });
81});