2016-01-18 16:38:52 +01:00
#! /usr/bin/env node
2016-01-24 14:07:22 +01:00
import 'source-map-support/register' ;
2016-01-18 16:38:52 +01:00
import path from 'path' ;
import program from 'commander' ;
2016-01-29 07:09:36 +01:00
import buildApp from './build/buildApp' ;
2016-01-18 16:38:52 +01:00
const packageJson = require ( path . join ( '..' , 'package' ) ) ;
if ( require . main === module ) {
program
. version ( packageJson . version )
2016-01-18 18:17:12 +01:00
. arguments ( '<targetUrl> [dest]' )
2016-01-23 19:02:23 +01:00
. action ( function ( targetUrl , appDir ) {
2016-01-18 16:38:52 +01:00
program . targetUrl = targetUrl ;
2016-01-29 04:37:54 +01:00
program . out = appDir ;
2016-01-18 16:38:52 +01:00
} )
2016-01-29 04:37:54 +01:00
. option ( '-n, --name <value>' , 'app name' )
2016-01-18 18:17:12 +01:00
. option ( '-p, --platform <value>' , '\'linux\', \'win32\', or \'darwin\'' )
. option ( '-a, --arch <value>' , '\'ia32\' or \'x64\'' )
. option ( '-e, --electron-version <value>' , 'electron version to package, without the \'v\', see https://github.com/atom/electron/releases' )
. option ( '-o, --overwrite' , 'if output directory for a platform already exists, replaces it rather than skipping it, defaults to false' )
2016-01-18 16:38:52 +01:00
. option ( '-c, --conceal' , 'packages the source code within your app into an archive, defaults to false, see http://electron.atom.io/docs/v0.36.0/tutorial/application-packaging/' )
2016-01-22 04:35:05 +01:00
. option ( '--counter' , 'if the target app should use a persistant counter badge in the dock (OSX only), defaults to false' )
2016-01-26 07:24:47 +01:00
. option ( '-i, --icon <value>' , 'the icon file to use as the icon for the app (should be a .icns file on OSX, .png for Windows and Linux)' )
2016-01-23 16:02:44 +01:00
. option ( '--width <value>' , 'set window width, defaults to 1280px' , parseInt )
. option ( '--height <value>' , 'set window height, defaults to 800px' , parseInt )
2016-01-22 15:42:56 +01:00
. option ( '-m, --show-menu-bar' , 'set menu bar visible, defaults to false' )
2016-01-19 04:30:42 +01:00
. option ( '-u, --user-agent <value>' , 'set the user agent string for the app' )
2016-01-22 04:59:57 +01:00
. option ( '--honest' , 'prevent the nativefied app from changing the user agent string to masquerade as a regular chrome browser' )
2016-01-25 16:42:28 +01:00
. option ( '--insecure' , 'ignore certificate related errors' )
2016-01-18 16:38:52 +01:00
. parse ( process . argv ) ;
if ( ! process . argv . slice ( 2 ) . length ) {
program . help ( ) ;
}
2016-01-24 13:40:32 +01:00
buildApp ( program , ( error , appPath ) => {
if ( error ) {
console . error ( error ) ;
return ;
}
console . log ( ` App built to ${ appPath } ` ) ;
} ) ;
2016-01-18 16:38:52 +01:00
}