parent
3835a69770
commit
8d622e6262
|
@ -6,7 +6,7 @@
|
|||
//
|
||||
// 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
|
||||
// the online minifier at http://marijnhaverbeke.nl/uglifyjs, and spit
|
||||
// out the result.
|
||||
|
@ -29,15 +29,14 @@ function help(ok) {
|
|||
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) {
|
||||
var arg = process.argv[i];
|
||||
if (arg == "--local" && i + 1 < process.argv.length) {
|
||||
var parts = process.argv[++i].split(/\s+/);
|
||||
local = parts[0];
|
||||
extraArgs = parts.slice(1);
|
||||
if (!extraArgs.length) extraArgs = ["-c", "-m"];
|
||||
args = parts.slice(1);
|
||||
} else if (arg == "--help") {
|
||||
help(true);
|
||||
} else if (arg[0] != "-") {
|
||||
|
@ -62,11 +61,8 @@ function walk(dir) {
|
|||
}
|
||||
|
||||
walk("lib/");
|
||||
walk("addon/");
|
||||
walk("mode/");
|
||||
|
||||
if (!local && !blob) help(false);
|
||||
|
||||
if (files.length) {
|
||||
console.log("Some speficied files were not found: " +
|
||||
files.map(function(a){return a.name;}).join(", "));
|
||||
|
@ -74,7 +70,7 @@ if (files.length) {
|
|||
}
|
||||
|
||||
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 {
|
||||
var data = new Buffer("js_code=" + require("querystring").escape(blob), "utf8");
|
||||
var req = require("http").request({
|
||||
|
|
Loading…
Reference in New Issue
Block a user