-
Notifications
You must be signed in to change notification settings - Fork 386
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This reverts commit cb9f380 so that we can move it to a `next` branch and leave `master` releasable.
- Loading branch information
Showing
42 changed files
with
1,017 additions
and
4,050 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Language: JavaScript | ||
BasedOnStyle: Google | ||
ColumnLimit: 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
node_modules/* | ||
build/ | ||
/lib/ | ||
/test/ | ||
types/ | ||
.idea | ||
.vscode | ||
docs/ | ||
npm-debug.log | ||
coverage | ||
*.js.map | ||
yarn-error.log | ||
**/*.js | ||
yarn-error.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,7 @@ language: node_js | |
node_js: | ||
- "4" | ||
- "6" | ||
- "8" | ||
- "9" | ||
- "7" | ||
|
||
script: | ||
- npm test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
'use strict'; | ||
|
||
require('source-map-support').install(); | ||
|
||
const clangFormat = require('clang-format'); | ||
const del = require('del'); | ||
const format = require('gulp-clang-format'); | ||
const gulp = require('gulp'); | ||
const merge = require('merge2'); | ||
const mocha = require('gulp-mocha'); | ||
const sourcemaps = require('gulp-sourcemaps'); | ||
const ts = require('gulp-typescript'); | ||
const tslint = require('gulp-tslint'); | ||
|
||
const outDir = 'build'; | ||
const sources = ['ts/lib/**/*.ts']; | ||
const tests = ['ts/test/**/*.ts']; | ||
const allFiles = ['*.js'].concat(sources, tests); | ||
|
||
let exitOnError = true; | ||
function onError() { | ||
if (exitOnError) { | ||
process.exit(1); | ||
} | ||
} | ||
|
||
gulp.task('test.check-format', () => { | ||
return gulp.src(allFiles) | ||
.pipe(format.checkFormat('file', clangFormat)) | ||
.on('warning', onError); | ||
}); | ||
|
||
gulp.task('format', () => { | ||
return gulp.src(allFiles, {base: '.'}) | ||
.pipe(format.format('file', clangFormat)) | ||
.pipe(gulp.dest('.')); | ||
}); | ||
|
||
gulp.task('test.check-lint', () => { | ||
return gulp.src(allFiles) | ||
.pipe(tslint({formatter: 'verbose'})) | ||
.pipe(tslint.report()) | ||
.on('warning', onError); | ||
}); | ||
|
||
gulp.task('clean', () => { | ||
return del([`${outDir}`]); | ||
}); | ||
|
||
gulp.task('compile', () => { | ||
const tsResult = gulp.src(sources) | ||
.pipe(sourcemaps.init()) | ||
.pipe(ts.createProject('tsconfig.json')()) | ||
.on('error', onError); | ||
return merge([ | ||
tsResult.dts.pipe(gulp.dest(`${outDir}/definitions`)), | ||
tsResult.js | ||
.pipe(sourcemaps.write( | ||
'.', {includeContent: false, sourceRoot: '../../src'})) | ||
.pipe(gulp.dest(`${outDir}/src`)), | ||
tsResult.js.pipe(gulp.dest(`${outDir}/src`)) | ||
]); | ||
}); | ||
|
||
gulp.task('test.compile', ['compile'], () => { | ||
return gulp.src(tests, {base: '.'}) | ||
.pipe(sourcemaps.init()) | ||
.pipe(ts.createProject('tsconfig.json')()) | ||
.on('error', onError) | ||
.pipe(sourcemaps.write('.', {includeContent: false, sourceRoot: '../..'})) | ||
.pipe(gulp.dest(`${outDir}/`)); | ||
}); | ||
|
||
gulp.task('test.unit', ['test.compile'], () => { | ||
return gulp.src([`${outDir}/test/**/*.js`]).pipe(mocha({verbose: true})); | ||
}); | ||
|
||
gulp.task('watch', () => { | ||
exitOnError = false; | ||
gulp.start(['test.compile']); | ||
// TODO: also run unit tests in a non-fatal way | ||
return gulp.watch(allFiles, ['test.compile']); | ||
}); | ||
|
||
gulp.task('test', ['test.unit', 'test.check-format', 'test.check-lint']); | ||
gulp.task('default', ['compile']); |
Oops, something went wrong.