-
Notifications
You must be signed in to change notification settings - Fork 5
/
cli.js
executable file
·54 lines (46 loc) · 1.17 KB
/
cli.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env node
var token,
drop,
pathLib = require('path'),
AirDrop = require(pathLib.join(__dirname, "..", "lib", "air-drop.js")),
package = require(pathLib.join(__dirname, "..", "package.json"));
if (process.argv.indexOf("-v") > -1) {
console.log(package.version);
process.exit();
}
if (process.argv.indexOf("--css") > -1) {
drop = AirDrop("main.css");
} else {
drop = AirDrop("main.js");
}
if (process.argv.indexOf("--minimize") > -1) drop.minimize();
drop.package();
while (token = process.argv.shift()) {
if (token === "--include" || token === "-i") {
drop.include(process.argv.shift());
}
else if (token === "--require" || token === "-r") {
drop.require(process.argv.shift());
}
else if (token === "--strip-function" || token === "-s") {
drop.stripFunction(process.argv.shift());
}
}
var trySource = function() {
setTimeout(function() {
if (drop.paths.length > 0) {
drop.source(function(err, source) {
if (err) {
process.stderr.write("Error: " + err);
}
else {
process.stdout.write(source);
}
});
}
else {
trySource();
}
}, 1000);
}
trySource();