forked from ulizama/TiFastlane
-
Notifications
You must be signed in to change notification settings - Fork 1
/
cli.js
executable file
·366 lines (298 loc) · 9.99 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
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
#!/usr/bin/env node
var program = require('commander')
, tifastlane = require('./')
, updateNotifier = require('update-notifier')
, pkg = require('./package.json')
, _ = require('underscore')
, chalk = require('chalk')
;
var notifier = updateNotifier({
pkg: pkg
});
/*
@ CLI
*/
program
.version(pkg.version, '-v, --version')
.usage('command [options]')
;
/*
@ Setup Function
*/
program.command('setup')
.description('Setup Tifastlane.cfg file')
.option('--config_file [value]', "Use another config file found in the root")
.option('-id, --apple-id [value]', '[email protected]')
.action(setup)
;
/*
@ Init Function
*/
program.command('init')
.description('Initialize of all components needed to work')
.option('-c, --config [value]', "Use another config file found in the root")
.option('-s, --smart', 'If your app is already on the App Store run init with -s')
.action(init)
;
/*
@ Send Function
*/
program.command('send')
.description('Send all available resources of App to iTunes Connect. Only one of those options are allowed')
.option('-c, --config [value]', "Use another config file found in the root")
.option('-t, --testflight', 'Send App to be Beta Test on TestFlight')
.option('--skip_binary_upload', 'Skip uploading an ipa to iTunes Connect')
.option('--skip_screenshots', "Don't upload the screenhsots")
.option('--skip_metadata', "Don't upload the metadata (e.g. title, description), this will still upload screenshots")
.option('--skip_build', 'Skip build of App Store IPA')
.option('--skip_verify', 'Skip verification of metadata on send command')
.option('--submit_for_review', 'Submit the new version for Review after uploading everything (DELIVER_SUBMIT_FOR_REVIEW)')
.option('--skip_waiting_for_build_processing',"Don't wait for the build to process. If set to true, the changelog won't be set (PILOT_SKIP_WAITING_FOR_BUILD_PROCESSING)")
.option('--automatic_release',"Should the app be automatically released once it's approved?")
.option('--distribution_name [value]','iOS Distribution Certificate to use')
.option('--pp_uuid [value]','Provisioning profile uuid')
.option('--legacy', 'Enable legacy build for Ti-CLI<6.0.2 and XCode<8.3')
.action(send)
;
/*
@ Status Function
*/
program.command('status')
.description('Display the App Information')
.option('-c, --config [value]', "Use another config file found in the root")
.action(status)
;
/*
@ Register Functions
*/
program.command('register [platform]')
.description('Register app and create provisioning profiles. You can target a specific platform: "appstore", "development", "adhoc" or leave empty for all')
.option('-c, --config [value]', "Use another config file found in the root")
.option('-i, --skip_itc', 'Skip the creation of the app on iTunes Connect')
.option('-m, --match', 'Use fastlane match to generate the profiles')
.option('-sp, --skip_profiles', '[sigh] Skip the creation of Provisioning Profiles')
.option('-si, --skip_install', '[sigh] Skip installation of new provisioning profiles')
.option('-sf, --skip_fetch_profiles', '[sigh] Skips the verification of existing profiles which is useful if you have thousands of profiles')
.action(register)
;
/*
@ Repair Profiles
*/
program.command('repairprofiles')
.description('Repairs all expired or invalid provisioning profiles')
.option('-c, --config [value]', "Use another config file found in the root")
.action(repairprofiles)
;
/*
@ Download Profiles
*/
program.command('downloadprofiles')
.description('Downloads all valid provisioning profiles')
.option('-c, --config [value]', "Use another config file found in the root")
.action(downloadprofiles)
;
/*
@ Snapshot Function
*/
// program.command('snapshot')
// .description('Take ScreenShot of Simulator to generate all images')
// .action(snapshot)
// ;
/*
@ Pem Function
*/
program.command('pem [password]')
.description('Automatically generate and renew your push notification profiles')
.option('-c, --config [value]', "Use another config file found in the root")
.option('-d, --development', 'Renew the development push certificate instead of the production one (PEM_DEVELOPMENT)')
.option('-g, --generate_p12', 'Generate a p12 file additionally to a PEM file (PEM_GENERATE_P12_FILE)')
.option('-s, --save_private_key', 'Set to save the private RSA key (PEM_SAVE_PRIVATEKEY)')
.option('-f, --force', 'Create a new push certificate, even if the current one is active for 30 more days (PEM_FORCE)')
.action(pem)
;
/*
@ Pilot Function
*/
program.command('pilot [Command]')
.description('The best way to manage your TestFlight testers and builds from your terminal. Default command is "upload"')
.option('-c, --config [value]', "Use another config file found in the root")
.option('[add]', 'Adds a new external tester. This will also add an existing tester to an app.')
.option('[builds]', 'Lists all builds for given application')
.option('[export]', 'Exports all external testers to a CSV file')
.option('[find]', 'Find a tester (internal or external) by their email address')
.option('[import]', 'Create external testers from a CSV file')
.option('[list]', 'Lists all registered testers, both internal and external')
.option('[remove]', 'Remove an external tester by their email address')
.option('-s, --skip_submission', 'Skip the distributing action of pilot and only upload the ipa file')
.action(pilot)
;
/*
@ Google Play Init Function
*/
program.command('playinit')
.description('Initalize the Google Play components')
.option('-c, --config [value]', "Use another config file found in the root")
.action(playinit)
;
/*
@ Google Play Send Function
*/
program.command('playsend')
.description('Send all available resources of App to Google Play Store')
.option('-c, --config [value]', "Use another config file found in the root")
.option('--skip_upload_apk', 'Skip uploading an APK to Google Play')
.option('--skip_upload_metadata', 'Whether to skip uploading metadata')
.option('--skip_upload_images', 'Whether to skip uploading images, screenshots not included')
.option('--skip_upload_screenshots', 'Whether to skip uploading SCREENSHOTS')
.option('--skip_upload_graphic_assets', 'Wether to sekip uploading all type of images, including screenshots')
.option('--skip_build', 'Skip build of APK')
.option('--bump_build_version', 'Automatically bump Android build version')
.option('-a, --track [value]', 'The Track to upload the Application to: production, beta, alpha or rollout')
.option('-r, --rollout [value]', 'The percentage of the rollout')
.option('--aab', 'Send the AAB instead of the APK')
.option('--validate_only', 'Whether to upload and validate but not publish immediately')
.action(playsend)
;
program.parse(process.argv);
if (program.args.length === 0 || typeof program.args[program.args.length - 1] === 'string') {
notifier.update && notifier.notify();
program.help();
}
/*
@ setup
*/
function setup(opts){
notifier.update && notifier.notify();
var options = _filterOptions(opts);
tifastlane.setup(options);
};
/*
@ init
*/
function init(opts) {
notifier.update && notifier.notify();
var options = _filterOptions(opts);
tifastlane.loadconfig(opts.config);
tifastlane.init(options);
};
/*
@ status
*/
function status(opts) {
notifier.update && notifier.notify();
var options = _filterOptions(opts);
tifastlane.loadconfig(opts.config);
tifastlane.status();
};
/*
@ send
*/
function send(opts) {
notifier.update && notifier.notify();
var options = _filterOptions(opts);
tifastlane.loadconfig(opts.config);
tifastlane.send(options);
};
/*
@ register
*/
function register(platform, opts) {
notifier.update && notifier.notify();
var options = _filterOptions(opts);
options.platform = platform || '';
tifastlane.loadconfig(opts.config);
tifastlane.register(options);
};
/*
@ repairprofiles
*/
function repairprofiles(opts) {
notifier.update && notifier.notify();
var options = _filterOptions(opts);
tifastlane.loadconfig(opts.config);
tifastlane.repairprofiles(options);
};
/*
@ downloadprofiles
*/
function downloadprofiles(opts) {
notifier.update && notifier.notify();
var options = _filterOptions(opts);
tifastlane.loadconfig(opts.config);
tifastlane.downloadprofiles(options);
};
/*
@ pem
*/
function pem(env, opts) {
notifier.update && notifier.notify();
var options = _filterOptions(opts);
options.password = (!env) ? null : env;
tifastlane.loadconfig(opts.config);
tifastlane.pem(options);
};
/*
@ snapshot
*/
// function snapshot(opts) {
// tifastlane.loadconfig(opts.config);
// tifastlane.snapshot();
// };
/*
@ pilot
*/
function pilot(env, opts) {
notifier.update && notifier.notify();
var options = _filterOptions(opts);
options.command = (!env) ? 'upload' : env;
var availableCommands = [ 'add', 'builds', 'export', 'find', 'import', 'list', 'remove', 'upload' ]
, commandValid = false
;
availableCommands.forEach(function(_command){
if(options.command == _command){
commandValid = true;
}
});
if(!commandValid){
console.log(chalk.red('Incorrect [Command]'));
console.log(chalk.yellow('Example:') + chalk.cyan(' tifast pilot builds'));
console.log('\n');
return;
}
tifastlane.loadconfig(opts.config);
tifastlane.pilot(options);
};
/*
@ playinit
*/
function playinit(opts) {
tifastlane.loadconfig(opts.config);
tifastlane.playinit(opts);
};
/*
@ playsend
*/
function playsend(opts) {
notifier.update && notifier.notify();
var options = _filterOptions(opts);
tifastlane.loadconfig(opts.config);
tifastlane.playsend(options);
};
/*
@ filterOptions
*/
function _filterOptions(o) {
var opts = o.parent ? _filterOptions(o.parent) : {};
_.each(o, function (v, k) {
if (k[0] !== '_' && !_.isObject(v)) {
opts[k] = v;
}
});
return opts;
};
/*
@
*/
/*
@
*/