2015-03-23 02:51:19 +00:00
|
|
|
#!/usr/bin/env node
|
2015-05-06 13:46:47 +00:00
|
|
|
var args = require('minimist')(process.argv.slice(2), {boolean: ['prune', 'asar']})
|
2015-03-23 02:51:19 +00:00
|
|
|
var packager = require('./')
|
|
|
|
|
|
|
|
args.dir = args._[0]
|
|
|
|
args.name = args._[1]
|
|
|
|
|
2015-04-05 04:28:06 +00:00
|
|
|
var protocolSchemes = [].concat(args.protocol || [])
|
|
|
|
var protocolNames = [].concat(args['protocol-name'] || [])
|
2015-04-05 04:13:27 +00:00
|
|
|
|
|
|
|
if (protocolSchemes && protocolNames && protocolNames.length === protocolSchemes.length) {
|
2015-04-05 04:28:06 +00:00
|
|
|
args.protocols = protocolSchemes.map(function (scheme, i) {
|
2015-04-05 04:13:27 +00:00
|
|
|
return {schemes: [scheme], name: protocolNames[i]}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2015-03-23 02:51:19 +00:00
|
|
|
if (!args.dir || !args.name) {
|
2015-04-27 19:09:24 +00:00
|
|
|
console.error('Usage: electron-packager <sourcedir> <Appname>')
|
2015-03-23 02:51:19 +00:00
|
|
|
process.exit(1)
|
|
|
|
}
|
2015-05-06 19:11:03 +00:00
|
|
|
console.log('args', args)
|
2015-03-23 02:51:19 +00:00
|
|
|
packager(args, function done (err, appPath) {
|
|
|
|
if (err) {
|
2015-05-06 19:11:03 +00:00
|
|
|
console.error(err.stack)
|
2015-04-04 16:47:01 +00:00
|
|
|
process.exit(1)
|
2015-03-23 02:51:19 +00:00
|
|
|
}
|
2015-04-04 16:47:01 +00:00
|
|
|
|
2015-03-23 02:51:19 +00:00
|
|
|
console.error('Wrote new app to', appPath)
|
|
|
|
})
|