forked from dart-archive/js_facade_gen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
executable file
·31 lines (29 loc) · 973 Bytes
/
index.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
#!/usr/bin/env node
const main = require('./build/lib/main.js');
var args = require('minimist')(process.argv.slice(2), {
string: ['base-path'],
boolean: [
'semantic-diagnostics', 'skip-formatting', 'generate-html', 'rename-conflicting-types',
'explicit-static', 'trust-js-types', 'to-json'
],
default: {'base-path': ''},
alias: {
'base-path': 'basePath',
'semantic-diagnostics': 'semanticDiagnostics',
'skip-formatting': 'skipFormatting',
'generate-html': 'generateHTML',
'rename-conflicting-types': 'renameConflictingTypes',
'explicit-static': 'explicitStatic',
'trust-js-types': 'trustJSTypes',
'to-json': 'toJSON'
}
});
try {
var transpiler = new main.Transpiler(args);
if (args.destination) console.error('Transpiling', args._, 'to', args.destination);
transpiler.transpile(args._, args.destination);
} catch (e) {
if (e.name !== 'DartFacadeError') throw e;
console.error(e.message);
process.exit(1);
}