microsoft/vscode-react-native
Publicmirrored from https://github.com/microsoft/vscode-react-nativeAvailable
gulpfile.js
60lines · 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 | var Q = require('q'); |
| 14 | |
| 15 | var sources = [ |
| 16 | 'src', |
| 17 | 'typings', |
| 18 | ].map(function(tsFolder) { return tsFolder + '/**/*.ts'; }) |
| 19 | .concat(['test/*.ts']); |
| 20 | |
| 21 | gulp.task('build', function () { |
| 22 | var tsProject = ts.createProject('src/tsconfig.json'); |
| 23 | return tsProject.src() |
| 24 | .pipe(sourcemaps.init()) |
| 25 | .pipe(ts(tsProject)) |
| 26 | .pipe(sourcemaps.write('.', { includeContent: false, sourceRoot: 'file:///' + __dirname })) |
| 27 | .pipe(gulp.dest('out')); |
| 28 | }); |
| 29 | |
| 30 | gulp.task('watch', ['build'], function(cb) { |
| 31 | log('Watching build sources...'); |
| 32 | return gulp.watch(sources, ['build']); |
| 33 | }); |
| 34 | |
| 35 | gulp.task('default', ['build']); |
| 36 | |
| 37 | var lintSources = [ |
| 38 | 'src', |
| 39 | ].map(function(tsFolder) { return tsFolder + '/**/*.ts'; }); |
| 40 | lintSources = lintSources.concat([ |
| 41 | '!src/typings/**' |
| 42 | ]); |
| 43 | |
| 44 | var tslint = require('gulp-tslint'); |
| 45 | gulp.task('tslint', function(){ |
| 46 | return gulp.src(lintSources, { base: '.' }) |
| 47 | .pipe(tslint()) |
| 48 | .pipe(tslint.report('verbose')); |
| 49 | }); |
| 50 | |
| 51 | function test() { |
| 52 | throw new Error('No tests yet'); |
| 53 | } |
| 54 | |
| 55 | gulp.task('build-test', ['build'], test); |
| 56 | gulp.task('test', test); |
| 57 | |
| 58 | gulp.task('watch-build-test', ['build', 'build-test'], function() { |
| 59 | return gulp.watch(sources, ['build', 'build-test']); |
| 60 | }); |
| 61 | |