microsoft/vscode-react-native

Public

mirrored fromhttps://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
10d7a8ffbe4bf6bf2ba104b8afb0894183b4633e

Branches

Tags

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

Clone

HTTPS

Download ZIP

gulpfile.js

77lines · modecode

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