Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
fix(d.ts): include only necessary imports
Browse files Browse the repository at this point in the history
  • Loading branch information
kellyethridge committed Apr 1, 2016
1 parent 8ccbd96 commit 2c292ac
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions build/tasks/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@ gulp.task('build-dts', function() {
return gulp.src(paths.tsSource)
.pipe(tools.sortFiles())
.pipe(through2.obj(function(file, enc, callback) { // extract all imports to importsToAdd
file.contents = new Buffer(tools.extractImports(file.contents.toString('utf8'), importsToAdd));
this.push(file);
if (file) {
file.contents = new Buffer(tools.extractImports(file.contents.toString('utf8'), importsToAdd));
this.push(file);
}
return callback();
}))
.pipe(concat(jsName)) // concat all selected files to jsName (now without their imports)
.pipe(insert.transform(function(contents) { // re-add extracted imports on top
return tools.createImportBlock(importsToAdd) + contents;
}))
.pipe(to5(assign({}, compilerOptions.dts()))); // compile to d.ts from file jsName. d.ts file is in folder paths.packageName
});

Expand Down

0 comments on commit 2c292ac

Please sign in to comment.