Revert "Update compress"

This reverts commit 3835a69770.
This commit is contained in:
Baegus 2014-10-04 20:09:43 +02:00
parent 3835a69770
commit 8d622e6262

View File

@ -6,7 +6,7 @@
// //
// bin/compress codemirror runmode javascript xml // bin/compress codemirror runmode javascript xml
// //
// Will take lib/codemirror.js, addon/runmode/runmode.js, // Will take lib/codemirror.js, lib/util/runmode.js,
// mode/javascript/javascript.js, and mode/xml/xml.js, run them though // mode/javascript/javascript.js, and mode/xml/xml.js, run them though
// the online minifier at http://marijnhaverbeke.nl/uglifyjs, and spit // the online minifier at http://marijnhaverbeke.nl/uglifyjs, and spit
// out the result. // out the result.
@ -29,15 +29,14 @@ function help(ok) {
process.exit(ok ? 0 : 1); process.exit(ok ? 0 : 1);
} }
var local = null, args = [], extraArgs = null, files = [], blob = ""; var local = null, args = null, files = [], blob = "";
for (var i = 2; i < process.argv.length; ++i) { for (var i = 2; i < process.argv.length; ++i) {
var arg = process.argv[i]; var arg = process.argv[i];
if (arg == "--local" && i + 1 < process.argv.length) { if (arg == "--local" && i + 1 < process.argv.length) {
var parts = process.argv[++i].split(/\s+/); var parts = process.argv[++i].split(/\s+/);
local = parts[0]; local = parts[0];
extraArgs = parts.slice(1); args = parts.slice(1);
if (!extraArgs.length) extraArgs = ["-c", "-m"];
} else if (arg == "--help") { } else if (arg == "--help") {
help(true); help(true);
} else if (arg[0] != "-") { } else if (arg[0] != "-") {
@ -62,11 +61,8 @@ function walk(dir) {
} }
walk("lib/"); walk("lib/");
walk("addon/");
walk("mode/"); walk("mode/");
if (!local && !blob) help(false);
if (files.length) { if (files.length) {
console.log("Some speficied files were not found: " + console.log("Some speficied files were not found: " +
files.map(function(a){return a.name;}).join(", ")); files.map(function(a){return a.name;}).join(", "));
@ -74,7 +70,7 @@ if (files.length) {
} }
if (local) { if (local) {
require("child_process").spawn(local, args.concat(extraArgs), {stdio: ["ignore", process.stdout, process.stderr]}); require("child_process").spawn(local, args, {stdio: ["ignore", process.stdout, process.stderr]});
} else { } else {
var data = new Buffer("js_code=" + require("querystring").escape(blob), "utf8"); var data = new Buffer("js_code=" + require("querystring").escape(blob), "utf8");
var req = require("http").request({ var req = require("http").request({