From a98752efe23d611a78ca02cd92ab312c94d5593c Mon Sep 17 00:00:00 2001 From: Benjamin Pannell Date: Fri, 26 Jun 2015 21:29:14 +0200 Subject: [PATCH] Automatically prep _references.d.ts during publish (Fixes #11) --- build/publish.js | 22 ++++++---------------- package.json | 8 +++++--- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/build/publish.js b/build/publish.js index aba16fd..5f3ee71 100644 --- a/build/publish.js +++ b/build/publish.js @@ -1,24 +1,14 @@ var gulp = require('gulp'), - runSequence = require('run-sequence'), - replace = require('gulp-replace'), - spawn = require('child_process').spawn; + replace = require('gulp-replace'); -gulp.task('publish', function () { - return runSequence('publish-prep', 'publish-action', 'publish-clean'); -}); - -gulp.task('publish-prep', function () { - return gulp.src('_references.d.ts') - .pipe(replace(/^\/{3}.*tsd\.d\.ts.*$/, '//$0')) +gulp.task('prepublish', function () { + return gulp.src(['_references.d.ts']) + .pipe(replace(/^(\/{3}\s*<[^>]*tsd\.d\.ts[^>]*\/>)/g, '//$1')) .pipe(gulp.dest('.')); }); -gulp.task('publish-action', function (done) { - spawn('npm', ['publish'], { stdio: 'inherit' }).on('close', done); -}); - -gulp.task('publish-clean', function () { +gulp.task('postpublish', function () { return gulp.src('_references.d.ts') - .pipe(replace(/^\/{2}(\/{3}.*tsd\.d\.ts.*)$/, '$1')) + .pipe(replace(/^\/{2}(\/{3}\s*<[^>]*tsd\.d\.ts[^>]*\/>)/ig, '$1')) .pipe(gulp.dest('.')); }); \ No newline at end of file diff --git a/package.json b/package.json index 82baaea..df7008c 100644 --- a/package.json +++ b/package.json @@ -18,11 +18,13 @@ "licence": "MIT", "main": "./dist/index.js", "scripts": { - "test": "grunt test", - "coverage": "grunt coverage", + "prepublish": "gulp prepublish", + "postpublish": "gulp postpublish", + "test": "gulp build && gulp ci", + "coverage": "gulp coverage", "lint": "jshint lib/", "benchmark": "node ./benchmarks/mongodb.js", - "build": "grunt build" + "build": "gulp build" }, "typescript": { "definition": "iridium.d.ts"