From e7d4f6488976cf8c8400f45b21663fb4dea2a531 Mon Sep 17 00:00:00 2001 From: Timothy J Warren Date: Mon, 28 Mar 2016 14:11:05 -0400 Subject: [PATCH] Remove gulp in favor of npm scripts --- .istanbul.yml | 9 ++++++ gulpfile.js | 87 --------------------------------------------------- package.json | 27 +++++++++------- 3 files changed, 24 insertions(+), 99 deletions(-) create mode 100644 .istanbul.yml delete mode 100644 gulpfile.js diff --git a/.istanbul.yml b/.istanbul.yml new file mode 100644 index 0000000..51f02d4 --- /dev/null +++ b/.istanbul.yml @@ -0,0 +1,9 @@ +reporting: + print: summary + reports: + - lcov + - lcovonly + - clover + - html + - text + dir: ./coverage \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js deleted file mode 100644 index f44752f..0000000 --- a/gulpfile.js +++ /dev/null @@ -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']); \ No newline at end of file diff --git a/package.json b/package.json index 1190477..91a34f5 100644 --- a/package.json +++ b/package.json @@ -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" } }