Remove gulp in favor of npm scripts

This commit is contained in:
Timothy Warren 2016-03-28 14:11:05 -04:00
parent 43cc0a451e
commit e7d4f64889
3 changed files with 24 additions and 99 deletions

9
.istanbul.yml Normal file
View File

@ -0,0 +1,9 @@
reporting:
print: summary
reports:
- lcov
- lcovonly
- clover
- html
- text
dir: ./coverage

View File

@ -1,87 +0,0 @@
'use strict';
const documentation = require('gulp-documentation'),
eslint = require('gulp-eslint'),
gulp = require('gulp'),
istanbul = require('gulp-istanbul'),
jscs = require('gulp-jscs'),
mocha = require('gulp-mocha'),
pipe = require('gulp-pipe'),
sloc = require('gulp-sloc');
const SRC_FILES = ['lib/**/*.js'];
const TEST_FILES = [
'test/*_test.js',
'test/adapters/*_test.js'
];
const MOCHA_OPTIONS = {
ui: 'tdd',
bail: true,
reporter: 'dot',
timeout: 10000,
};
gulp.task('lint', () => {
pipe(gulp.src(SRC_FILES), [
eslint(),
eslint.format(),
eslint.failAfterError()
]);
pipe(gulp.src(SRC_FILES), [
jscs(),
jscs.reporter()
]);
});
gulp.task('lint-tests', ['lint'], () => {
pipe(gulp.src(['test/**/*.js']), [
eslint(),
eslint.format(),
eslint.failAfterError()
]);
pipe(gulp.src(['test/**/*.js']), [
jscs(),
jscs.reporter()
]);
});
gulp.task('sloc', () => gulp.src(SRC_FILES).pipe(sloc()));
gulp.task('test-sloc', () => gulp.src(TEST_FILES).pipe(sloc()));
gulp.task('docs', () => {
gulp.src(['lib/*.js'])
.pipe(documentation({format: 'html'}))
.pipe(gulp.dest('docs'));
gulp.src(['lib/*.js'])
.pipe(documentation({format: 'md'}))
.pipe(gulp.dest('.'));
});
gulp.task('mocha', ['lint-tests', 'sloc'], () => {
return gulp.src(TEST_FILES)
.pipe(mocha(MOCHA_OPTIONS))
.once('error', () => {
process.exit(1);
})
.once('end', () => {
process.exit();
});
});
gulp.task('test', ['test-sloc', 'lint-tests'], function(cb) {
return pipe(gulp.src(SRC_FILES), [
istanbul(),
istanbul.hookRequire()
]).on('finish', () => {
pipe(gulp.src(TEST_FILES), [
mocha(MOCHA_OPTIONS),
istanbul.writeReports({
dir: './coverage',
reporters: ['clover', 'lcov', 'lcovonly', 'html', 'text'],
}),
]);
});
});
gulp.task('default', ['lint', 'sloc', 'docs', 'test']);

View File

@ -48,21 +48,24 @@
"documentation": "",
"eslint": "^2.4.0",
"glob": "~6.0.4",
"gulp": "~3.9.0",
"gulp-documentation": "^2.2.0",
"gulp-eslint": "^2.0.0",
"gulp-istanbul": "^0.10.3",
"gulp-jscs": "^3.0.2",
"gulp-mocha": "^2.2.0",
"gulp-pipe": "^1.0.4",
"gulp-sloc": "~1.0.4",
"globstar": "^1.0.0",
"istanbul": "~0.4.2",
"mocha": "^2.4.5"
"jscs": "^2.11.0",
"mocha": "^2.4.5",
"npm-run-all": "^1.6.0",
"nsp": "^2.2.1"
},
"license": "MIT",
"scripts": {
"predocs": "documentation build -f md -o API.md lib/*.js",
"docs": "documentation build -f html -o docs lib/*.js",
"test": "gulp test"
"audit": "nsp check",
"build": "npm-run-all --parallel lint:src lint:tests docs coverage",
"coverage": "istanbul cover ./node_modules/mocha/bin/_mocha",
"default": "npm-run-all --parallel audit lint:src lint:tests && npm run test",
"predocs": "globstar -- documentation build -f md -o API.md \"lib/*.js\"",
"docs": "globstar -- documentation build -f html -o docs \"lib/*.js\"",
"lint": "npm-run-all lint:tests lint:src",
"lint:src": "jscs ./lib && eslint ./lib",
"lint:tests": "jscs ./test && eslint ./test",
"test": "mocha -R dot"
}
}