summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMike Morris <michael.patrick.morris@gmail.com>2014-07-09 12:34:29 -0700
committerMike Morris <michael.patrick.morris@gmail.com>2014-07-09 12:34:29 -0700
commitdb9cba928bba0cca7aa12cef0762b4c2a4b3dec2 (patch)
tree8d1e2fbc66d869e9642ab2b185b069bf43316a82 /bin
parentab36059fdada88e91d8cb88434287d226db3b73e (diff)
downloadqtlocation-mapboxgl-db9cba928bba0cca7aa12cef0762b4c2a4b3dec2.tar.gz
clean up pipes
Diffstat (limited to 'bin')
-rwxr-xr-xbin/build-style.js5
-rwxr-xr-xbin/fuzz-colors.js (renamed from bin/stringify.js)2
-rwxr-xr-xbin/fuzz-style.js24
-rwxr-xr-xbin/minify.js15
-rw-r--r--bin/package.json1
-rwxr-xr-xbin/parse.js28
6 files changed, 18 insertions, 57 deletions
diff --git a/bin/build-style.js b/bin/build-style.js
index 0d8d09adeb..9e131e05a8 100755
--- a/bin/build-style.js
+++ b/bin/build-style.js
@@ -2,10 +2,9 @@
'use strict';
var load = require('./load-style.js');
-var JSONStream = require('JSONStream');
-var stringify = require('./stringify');
+var minify = require('./minify');
var mkdirp = require('./mkdirp.js');
load(process.argv[2])
- .pipe(stringify())
+ .pipe(minify())
.pipe(mkdirp(process.argv[3]));
diff --git a/bin/stringify.js b/bin/fuzz-colors.js
index c65a54ed19..c3a64f9acd 100755
--- a/bin/stringify.js
+++ b/bin/fuzz-colors.js
@@ -23,4 +23,4 @@ module.exports = function() {
});
};
-// if (!module.parent) module.exports().pipe(process.stdout);
+if (!module.parent) process.stdin.pipe(module.exports()).pipe(process.stdout);
diff --git a/bin/fuzz-style.js b/bin/fuzz-style.js
deleted file mode 100755
index 79fe7e1cc8..0000000000
--- a/bin/fuzz-style.js
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env node
-'use strict';
-
-var concat = require('concat-stream');
-var fuzzer = require('fuzzer');
-fuzzer.seed(0);
-
-var read = process.stdin;
-var write = concat(function(buffer) {
- var json = JSON.parse(buffer);
-
- json.constants = Object.keys(json.constants).reduce(function(obj, key, index) {
- var value = json.constants[key];
- if (typeof value === 'string') {
- obj[key] = fuzzer.mutate.string(value);
- }
- return obj;
- }, {});
-
- var data = JSON.stringify(json);
- process.stdout.write(data);
-});
-
-read.pipe(write);
diff --git a/bin/minify.js b/bin/minify.js
new file mode 100755
index 0000000000..253b340019
--- /dev/null
+++ b/bin/minify.js
@@ -0,0 +1,15 @@
+#!/usr/bin/env node
+'use strict';
+
+var through = require('through2');
+
+module.exports = function() {
+ return through.obj(function(chunk, env, callback) {
+ var json = JSON.parse(chunk.toString());
+ var data = JSON.stringify(json);
+ this.push(data);
+ callback();
+ });
+};
+
+if (!module.parent) process.stdin.pipe(module.exports()).pipe(process.stdout);
diff --git a/bin/package.json b/bin/package.json
index bb8783d99c..4a428bde60 100644
--- a/bin/package.json
+++ b/bin/package.json
@@ -2,7 +2,6 @@
"name": "llmr-native",
"version": "0.0.1",
"dependencies": {
- "concat-stream": "^1.4.6",
"fuzzer": "^0.2.0",
"glsl-optimizer": "git://github.com/kkaefer/glsl-optimizer.git#amalgamation",
"mkdirp": "^0.5.0"
diff --git a/bin/parse.js b/bin/parse.js
deleted file mode 100755
index 15aad10166..0000000000
--- a/bin/parse.js
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env node
-'use strict';
-
-var concat = require('concat-stream');
-var through = require('through2');
-var fuzzer = require('fuzzer');
-fuzzer.seed(0);
-
-module.exports = function() {
- var read = through();
- var write = concat(function(buffer) {
- var json = JSON.parse(buffer);
-
- json.constants = Object.keys(json.constants).reduce(function(obj, key, index) {
- var value = json.constants[key];
- if (typeof value === 'string') {
- obj[key] = fuzzer.mutate.string(value);
- }
- return obj;
- }, {});
-
- var data = JSON.stringify(json);
- process.stdout.write(data);
- });
- read.pipe(write);
-};
-
-// if (!module.parent) module.exports().pipe(process.stdout);