-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcli.js
48 lines (40 loc) · 1.85 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env node
const program = require( 'commander' );
const packager = require( './' );
const programVersion = require( './package' ).version;
program.version( programVersion )
.usage( '<name> <version> <entry>' )
.option( '--out <path>', 'path of the output directory' )
.option( '--platform <platform>', 'platform of the package' )
.option( '--arch <arch>', 'architecture of the package' )
.option( '--overwrite', 'replace existing output' )
.option( '--pack <format>', 'pack the output directory' )
.option( '--launchui-version <version>', 'version of the launchui package' )
.option( '--launchui-cache <path>', 'path of the launchui cache' )
.option( '--company <company>', 'company name (win32)' )
.option( '--copyright <copyright>', 'copyright information (win32/darwin)' )
.option( '--identifier <identifier>', 'bundle identifier (darwin)' )
.option( '--category <category>', 'application category (darwin)' )
.option( '--icon <path>', 'path of the icon file (win32/darwin)' )
.option( '--license <path>', 'path of the license file' )
.option( '--dir <path>', 'path of the directory containing additional files' )
.option( '--files <pattern,...>', 'additional files to include in the package', value => value.split( ',' ) )
.parse( process.argv );
if ( program.args.length != 3 )
program.help();
const [ name, version, entry ] = program.args;
const {
out, platform, arch, overwrite, pack, launchuiVersion, launchuiCache,
company, copyright, identifier, category, icon, license, dir, files
} = program;
const opts = {
name, version, entry, out, platform, arch, overwrite, pack,
launchuiOpts: { version: launchuiVersion, cache: launchuiCache },
company, copyright, identifier, category, icon, license, dir, files
};
packager( opts, error => {
if ( error != null ) {
console.error( error );
process.exit( 1 );
}
} );