aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-06-01 22:54:35 +0200
committerFlorian Dold <florian.dold@gmail.com>2016-06-01 22:54:35 +0200
commit06d22e443eebe456912995b95958dc96df0a7280 (patch)
treed8e60f65a1115f3a3de6ecb193437611bdadea2d
parent7a83d5977fe7192451e86586f6be2d2704b9450a (diff)
include .d.ts. files in source distributionv0.0.0
-rw-r--r--gulpfile.js62
1 files changed, 51 insertions, 11 deletions
diff --git a/gulpfile.js b/gulpfile.js
index 2b42f3ef7..85a0f6c2b 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -44,6 +44,7 @@ const fs = require("fs");
const del = require("del");
const through = require('through2');
const File = require('vinyl');
+const Stream = require('stream').Stream
const paths = {
ts: {
@@ -70,6 +71,7 @@ const paths = {
"lib/module-trampoline.js",
"popup/**/*.{html,css}",
"pages/**/*.{html,css}",
+ "lib/**/*.d.ts",
],
extra: [
"AUTHORS",
@@ -113,11 +115,6 @@ const paths = {
],
};
-paths.srcdist = [].concat(paths.ts.release,
- paths.ts.dev,
- paths.dist,
- paths.extra);
-
const tsBaseArgs = {
target: "es5",
@@ -164,6 +161,41 @@ function gglob(ps) {
}
+// Concatenate node streams,
+// taken from dominictarr's event-stream module
+function concatStreams (/*streams...*/) {
+ var toMerge = [].slice.call(arguments);
+ if (toMerge.length === 1 && (toMerge[0] instanceof Array)) {
+ toMerge = toMerge[0]; //handle array as arguments object
+ }
+ var stream = new Stream();
+ stream.setMaxListeners(0); // allow adding more than 11 streams
+ var endCount = 0;
+ stream.writable = stream.readable = true;
+
+ toMerge.forEach(function (e) {
+ e.pipe(stream, {end: false});
+ var ended = false;
+ e.on('end', function () {
+ if (ended) return;
+ ended = true;
+ endCount++;
+ if (endCount == toMerge.length)
+ stream.emit('end');
+ })
+ })
+ stream.write = function (data) {
+ this.emit('data', data);
+ }
+ stream.destroy = function () {
+ toMerge.forEach(function (e) {
+ if (e.destroy) e.destroy();
+ })
+ }
+ return stream;
+}
+
+
gulp.task("clean", function () {
return del("build/ext");
});
@@ -225,12 +257,20 @@ gulp.task("package-unstable", ["compile-prod", "dist-prod", "manifest-unstable"]
* Create source distribution.
*/
gulp.task("srcdist", [], function () {
- let name = String.prototype.concat("taler-wallet-webex-", manifest.version_name);
- return gulp.src(paths.srcdist, {buffer: false, stripBOM: false, base: "."})
- .pipe(rename(function (p) { p.dirname = name + "/" + p.dirname; }))
- .pipe(tar(name + "-src.tar"))
- .pipe(gzip())
- .pipe(gulp.dest("."));
+ const name = String.prototype.concat("taler-wallet-webex-", manifest.version_name);
+ const opts = {buffer: false, stripBOM: false, base: "."};
+ // We can't just concat patterns due to exclude patterns
+ const files = concatStreams(
+ gulp.src(paths.ts.release, opts),
+ gulp.src(paths.ts.dev, opts),
+ gulp.src(paths.dist, opts),
+ gulp.src(paths.extra, opts));
+
+ return files
+ .pipe(rename(function (p) { p.dirname = name + "/" + p.dirname; }))
+ .pipe(tar(name + "-src.tar"))
+ .pipe(gzip())
+ .pipe(gulp.dest("."));
});