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