-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
51 lines (42 loc) · 1.37 KB
/
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env node
const notifier = require('update-notifier');
const sade = require('sade');
const { error } = require('./util');
const pkg = require('./package');
const ver = process.version;
const min = pkg.engines.node;
if (
ver
.substring(1)
.localeCompare(min.match(/\d+/g).join('.'), 'en', { numeric: true }) === -1
) {
return error(
`You are using Node ${ver} but sciterjs-cli requires Node ${min}. Please upgrade Node to continue!`,
1
);
}
const commands = require('./commands');
notifier({ pkg }).notify();
process.on('unhandledRejection', (reason, promise) => {
if (reason instanceof Error) {
if (reason.stack) {
console.error(`process.on('unhandledRejection') ${reason.stack}`);
} else {
console.error(
`process.on('unhandledRejection') ${reason.name}: ${reason.message}`
);
}
} else {
console.error(`process.on('unhandledRejection') ${reason}`);
}
// error(err.stack || err.message);
});
let prog = sade('sciterjs-cli').version(pkg.version);
const createCommand = prog
.command('create [template] [dest]')
.describe('Create a new application');
commands.createOptions.forEach(option => {
createCommand.option(option.name, option.description, option.default);
});
createCommand.action(commands.create);
prog.parse(process.argv);