-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
executable file
·138 lines (137 loc) · 4.5 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/usr/bin/env node
const updateNotifier = require('update-notifier');
const pkg = require('./package.json');
updateNotifier({
pkg: pkg,
updateCheckInterval : 60 * 60 * 1000
}).notify({
defer: false
});
const {
build, generatePages
} = require('./src/command');
const args = require('yargs')
.command('generate pages [src]', 'generates page.min.json out of page markup, script, sttyles and variables', yargs => {
yargs.positional('src', {
describe: 'path of cordova project',
default: './',
type: 'string',
normalize: true
});
}, args => generatePages(args.src))
.command('build', 'build for target platform', yargs => {
yargs.command('android [src] [dest] [options]', 'build for android', yargs => {
yargs.positional('src', {
describe: 'path of cordova project',
default: './',
type: 'string',
normalize: true
});
yargs.positional('dest', {
describe: 'path of build directory',
type: 'string',
normalize: true
})
.option('cav', {
alias: 'cordovaAndroidVersion',
describe: 'Cordova Android Version'
})
.option('aks', {
alias: 'aKeyStore',
describe: '(Android) path to keystore',
type: 'string'
})
.option('axm', {
alias: 'androidXMigrationEnabled',
describe: 'Run android x migration (true or false)',
default: false,
type: 'boolean'
})
.option('asp', {
alias: 'aStorePassword',
describe: '(Android) password to keystore',
type: 'string'
})
.option('aka', {
alias: 'aKeyAlias',
describe: '(Android) Alias name',
type: 'string'
})
.option('akp', {
alias: 'aKeyPassword',
describe: '(Android) password for key.',
type: 'string'
})
.option('p', {
alias: 'packageType',
describe: 'apk (or) bundle',
default: 'apk',
choices: ['apk', 'bundle']
})
}, args => {
args.platform = 'android';
build(args)
})
.command('ios [src] [dest] [options]', 'build for iOS', yargs => {
yargs.positional('src', {
describe: 'path of cordova project',
default: './',
type: 'string',
normalize: true
});
yargs.positional('dest', {
describe: 'path of build directory',
type: 'string',
normalize: true
})
.option('civ', {
alias: 'cordovaIosVersion',
describe: 'Cordova iOS Version'
})
.option('ic', {
alias: 'iCertificate',
describe: '(iOS) path of p12 certificate to use',
type: 'string'
})
.option('icp', {
alias: 'iCertificatePassword',
describe: '(iOS) password to unlock certificate',
type: 'string'
})
.option('ipf', {
alias: 'iProvisioningFile',
describe: '(iOS) path of the provisional profile to use',
type: 'string'
});
}, args => {
args.platform = 'ios';
build(args)
})
.option('cv', {
alias: 'cordovaVersion',
describe: 'Cordova Version'
})
.option('bt', {
alias: 'buildType',
describe: 'development (or) debug (or) production (or) release',
default: 'debug',
coerce: (val) => {
if (val === 'development') {
return 'debug';
}
if (val === 'production') {
return 'release';
}
return val;
},
choices: ['development', 'debug', 'production', 'release']
})
.option('ah', {
alias: 'allowHooks',
describe: 'true or false',
default: true,
type: 'boolean'
}).demandCommand(1);
})
.help('h')
.alias('h', 'help').argv;