forked from rockybars/atom-shell-packager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.js
executable file
·33 lines (27 loc) · 1.09 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
#!/usr/bin/env node
var fs = require('fs')
var args = require('minimist')(process.argv.slice(2), {boolean: ['prune', 'asar', 'all', 'overwrite', 'strict-ssl']})
var packager = require('./')
var usage = fs.readFileSync(__dirname + '/usage.txt').toString()
args.dir = args._[0]
args.name = args._[1]
var protocolSchemes = [].concat(args.protocol || [])
var protocolNames = [].concat(args['protocol-name'] || [])
if (protocolSchemes && protocolNames && protocolNames.length === protocolSchemes.length) {
args.protocols = protocolSchemes.map(function (scheme, i) {
return {schemes: [scheme], name: protocolNames[i]}
})
}
if (!args.dir || !args.name || !args.version || (!args.all && (!args.platform || !args.arch))) {
console.error(usage)
process.exit(1)
}
packager(args, function done (err, appPaths) {
if (err) {
if (err.message) console.error(err.message)
else console.error(err, err.stack)
process.exit(1)
}
if (appPaths.length > 1) console.error('Wrote new apps to:\n' + appPaths.join('\n'))
else if (appPaths.length === 1) console.error('Wrote new app to', appPaths[0])
})