-
Notifications
You must be signed in to change notification settings - Fork 4
/
cmd.js
51 lines (41 loc) · 1.27 KB
/
cmd.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
var argv = require('minimist')(process.argv.slice(2));
var file = '';
if( argv.f ) file = argv.f;
else if( argv.file ) file = argv.file;
var namespace = '';
if( argv.n ) namespace = argv.n;
else if( argv.namespace ) namespace = argv.namespace;
var outfile = '';
if( argv.o ) outfile = argv.o;
else if( argv.outfile ) outfile = argv.outfile;
var wrappers = '';
if( argv.w ) wrappers = argv.w;
else if( argv.wrappers ) wrappers = argv.wrappers;
var watch = false;
if( argv.a !== undefined ) watch = true;
else if( argv.watch !== undefined ) watch = true;
var db = false;
if( argv.d ) db = argv.d;
else if( argv.database ) db = argv.database;
var definitions = false;
if( argv.e ) definitions = argv.e;
else if( argv.definitions ) definitions = argv.definitions;
var babelify = '';
if( argv.b ) babelify = argv.b;
else if( argv.babelify ) babelify = argv.babelify;
if( !file || !namespace ) {
console.log('file [-f || --file], namespace [-n || --namespace] and outfile [-o || --outfile] required');
console.log('See docs: https://github.com/CSTARS/es6-to-plv8');
return;
}
var es6ToPlv8 = require('./index');
es6ToPlv8({
namespace: namespace,
file: file,
outfile: outfile,
wrappers: wrappers,
definitions: definitions,
babelify : babelify,
watch : watch,
db : db
});