Skip to content

Commit a98752e

Browse files
committed
Automatically prep _references.d.ts during publish (Fixes #11)
1 parent d478ff7 commit a98752e

File tree

2 files changed

+11
-19
lines changed

2 files changed

+11
-19
lines changed

build/publish.js

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,14 @@
11
var gulp = require('gulp'),
2-
runSequence = require('run-sequence'),
3-
replace = require('gulp-replace'),
4-
spawn = require('child_process').spawn;
2+
replace = require('gulp-replace');
53

6-
gulp.task('publish', function () {
7-
return runSequence('publish-prep', 'publish-action', 'publish-clean');
8-
});
9-
10-
gulp.task('publish-prep', function () {
11-
return gulp.src('_references.d.ts')
12-
.pipe(replace(/^\/{3}.*tsd\.d\.ts.*$/, '//$0'))
4+
gulp.task('prepublish', function () {
5+
return gulp.src(['_references.d.ts'])
6+
.pipe(replace(/^(\/{3}\s*<[^>]*tsd\.d\.ts[^>]*\/>)/g, '//$1'))
137
.pipe(gulp.dest('.'));
148
});
159

16-
gulp.task('publish-action', function (done) {
17-
spawn('npm', ['publish'], { stdio: 'inherit' }).on('close', done);
18-
});
19-
20-
gulp.task('publish-clean', function () {
10+
gulp.task('postpublish', function () {
2111
return gulp.src('_references.d.ts')
22-
.pipe(replace(/^\/{2}(\/{3}.*tsd\.d\.ts.*)$/, '$1'))
12+
.pipe(replace(/^\/{2}(\/{3}\s*<[^>]*tsd\.d\.ts[^>]*\/>)/ig, '$1'))
2313
.pipe(gulp.dest('.'));
2414
});

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@
1818
"licence": "MIT",
1919
"main": "./dist/index.js",
2020
"scripts": {
21-
"test": "grunt test",
22-
"coverage": "grunt coverage",
21+
"prepublish": "gulp prepublish",
22+
"postpublish": "gulp postpublish",
23+
"test": "gulp build && gulp ci",
24+
"coverage": "gulp coverage",
2325
"lint": "jshint lib/",
2426
"benchmark": "node ./benchmarks/mongodb.js",
25-
"build": "grunt build"
27+
"build": "gulp build"
2628
},
2729
"typescript": {
2830
"definition": "iridium.d.ts"

0 commit comments

Comments
 (0)