chore(lint): re-enable clang-format on tools/

This commit is contained in:
Alex Eagle
2016-05-25 19:54:34 -07:00
parent 83723671af
commit 5936624d11
6 changed files with 30 additions and 42 deletions

View File

@ -3,16 +3,30 @@
// THIS CHECK SHOULD BE THE FIRST THING IN THIS FILE
// This is to ensure that we catch env issues before we error while requiring other dependencies.
require('./tools/check-environment')(
{requiredNpmVersion: '>=3.5.3 <4.0.0', requiredNodeVersion: '>=5.4.1 <6.0.0'});
{requiredNpmVersion: '>=3.5.3 <4.0.0', requiredNodeVersion: '>=5.4.1 <6.0.0'});
let gulp = require('gulp');
const gulp = require('gulp');
const path = require('path');
const srcsToFmt = ['tools/**/*.ts'];
gulp.task('tools:build', (done) => {
tsc('tools/', done)
gulp.task('lint', () => {
const format = require('gulp-clang-format');
const clangFormat = require('clang-format');
return gulp.src(srcsToFmt).pipe(
format.checkFormat('file', clangFormat, {verbose: true, fail: true}));
});
gulp.task('format', () => {
const format = require('gulp-clang-format');
const clangFormat = require('clang-format');
return gulp.src(srcsToFmt, { base: '.' }).pipe(
format.format('file', clangFormat)).pipe(gulp.dest('.'));
});
gulp.task('tools:build', (done) => { tsc('tools/', done); });
gulp.task('serve', () => {
let connect = require('gulp-connect');
@ -23,9 +37,7 @@ gulp.task('serve', () => {
port: 8000,
livereload: false,
open: false,
middleware: (connect, opt) => {
return [cors()];
}
middleware: (connect, opt) => [cors()]
});
});
@ -33,9 +45,9 @@ gulp.task('serve', () => {
function tsc(projectPath, done) {
let child_process = require('child_process');
child_process.spawn(
`${__dirname}/node_modules/.bin/tsc`,
['-p', `${__dirname}/projectPath`],
{stdio: 'inherit'}
).on('close', (errorCode) => done(errorCode));
child_process
.spawn(
`${__dirname}/node_modules/.bin/tsc`, ['-p', path.join(__dirname, projectPath)],
{stdio: 'inherit'})
.on('close', (errorCode) => done(errorCode));
}