Skip to content

Commit

Permalink
Automatically prep _references.d.ts during publish (Fixes #11)
Browse files Browse the repository at this point in the history
  • Loading branch information
notheotherben committed Jun 26, 2015
1 parent d478ff7 commit a98752e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
22 changes: 6 additions & 16 deletions build/publish.js
Original file line number Diff line number Diff line change
@@ -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('.'));
});
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit a98752e

Please sign in to comment.