microsoft/vscode-react-native
Publicmirrored from https://github.com/microsoft/vscode-react-nativeAvailable
gulpfile.js
59lines · modecode
| 1 | /*--------------------------------------------------------- |
| 2 | * Copyright (C) Microsoft Corporation. All rights reserved. |
| 3 | *--------------------------------------------------------*/ |
| 4 | |
| 5 | var child_process = require('child_process'); |
| 6 | var gulp = require('gulp'); |
| 7 | var mocha = require('gulp-mocha'); |
| 8 | var sourcemaps = require('gulp-sourcemaps'); |
| 9 | var ts = require('gulp-typescript'); |
| 10 | var log = require('gulp-util').log; |
| 11 | var os = require('os'); |
| 12 | var path = require('path'); |
| 13 | |
| 14 | var sources = [ |
| 15 | 'src', |
| 16 | 'typings', |
| 17 | ].map(function(tsFolder) { return tsFolder + '/**/*.ts'; }) |
| 18 | .concat(['test/*.ts']); |
| 19 | |
| 20 | gulp.task('build', function () { |
| 21 | var tsProject = ts.createProject('src/tsconfig.json'); |
| 22 | return tsProject.src() |
| 23 | .pipe(sourcemaps.init()) |
| 24 | .pipe(ts(tsProject)) |
| 25 | .pipe(sourcemaps.write('.', { includeContent: false, sourceRoot: 'file:///' + __dirname + '/src/' })) |
| 26 | .pipe(gulp.dest('out')); |
| 27 | }); |
| 28 | |
| 29 | gulp.task('watch', ['build'], function(cb) { |
| 30 | log('Watching build sources...'); |
| 31 | return gulp.watch(sources, ['build']); |
| 32 | }); |
| 33 | |
| 34 | gulp.task('default', ['tslint', 'build']); |
| 35 | |
| 36 | var lintSources = [ |
| 37 | 'src', |
| 38 | ].map(function(tsFolder) { return tsFolder + '/**/*.ts'; }); |
| 39 | lintSources = lintSources.concat([ |
| 40 | '!src/typings/**' |
| 41 | ]); |
| 42 | |
| 43 | var tslint = require('gulp-tslint'); |
| 44 | gulp.task('tslint', function(){ |
| 45 | return gulp.src(lintSources, { base: '.' }) |
| 46 | .pipe(tslint()) |
| 47 | .pipe(tslint.report('verbose')); |
| 48 | }); |
| 49 | |
| 50 | function test() { |
| 51 | throw new Error('No tests yet'); |
| 52 | } |
| 53 | |
| 54 | gulp.task('build-test', ['build'], test); |
| 55 | gulp.task('test', test); |
| 56 | |
| 57 | gulp.task('watch-build-test', ['build', 'build-test'], function() { |
| 58 | return gulp.watch(sources, ['build', 'build-test']); |
| 59 | }); |
| 60 | |