rnbuilder 0.6.81 → 0.6.83

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -40,7 +40,7 @@ $ npm install -g rnbuilder
40
40
  $ rnbuilder COMMAND
41
41
  running command...
42
42
  $ rnbuilder (-v|--version|version)
43
- rnbuilder/0.6.81 darwin-arm64 node-v24.13.0
43
+ rnbuilder/0.6.83 darwin-arm64 node-v24.13.0
44
44
  $ rnbuilder --help [COMMAND]
45
45
  USAGE
46
46
  $ rnbuilder COMMAND
@@ -59,7 +59,6 @@ USAGE
59
59
  * [`rnbuilder initialize`](#rnbuilder-initialize)
60
60
  * [`rnbuilder match-check [MATCH-CHECK]`](#rnbuilder-match-check-match-check)
61
61
  * [`rnbuilder match-nuke [BUILD]`](#rnbuilder-match-nuke-build)
62
- * [`rnbuilder onesignal [BUILD]`](#rnbuilder-onesignal-build)
63
62
  * [`rnbuilder reject-review [REJECT-REVIEW]`](#rnbuilder-reject-review-reject-review)
64
63
  * [`rnbuilder setup [SETUP]`](#rnbuilder-setup-setup)
65
64
  * [`rnbuilder setup-gcp`](#rnbuilder-setup-gcp)
@@ -98,7 +97,7 @@ EXAMPLE
98
97
  hello world from ./src/build.ts!
99
98
  ```
100
99
 
101
- _See code: [src/commands/build.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.6.81/src/commands/build.ts)_
100
+ _See code: [src/commands/build.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.6.83/src/commands/build.ts)_
102
101
 
103
102
  ## `rnbuilder check-version [MATCH-CHECK]`
104
103
 
@@ -117,7 +116,7 @@ EXAMPLE
117
116
  Nuke certificates ./src/match-check.ts!
118
117
  ```
119
118
 
120
- _See code: [src/commands/check-version.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.6.81/src/commands/check-version.ts)_
119
+ _See code: [src/commands/check-version.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.6.83/src/commands/check-version.ts)_
121
120
 
122
121
  ## `rnbuilder codepush [BUILD]`
123
122
 
@@ -136,7 +135,7 @@ EXAMPLE
136
135
  Push changes to existing apps ./src/firebase-sync-udids.ts!
137
136
  ```
138
137
 
139
- _See code: [src/commands/codepush.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.6.81/src/commands/codepush.ts)_
138
+ _See code: [src/commands/codepush.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.6.83/src/commands/codepush.ts)_
140
139
 
141
140
  ## `rnbuilder google-key [MATCH-CHECK]`
142
141
 
@@ -155,7 +154,7 @@ EXAMPLE
155
154
  Nuke certificates ./src/match-check.ts!
156
155
  ```
157
156
 
158
- _See code: [src/commands/google-key.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.6.81/src/commands/google-key.ts)_
157
+ _See code: [src/commands/google-key.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.6.83/src/commands/google-key.ts)_
159
158
 
160
159
  ## `rnbuilder help [COMMAND]`
161
160
 
@@ -187,7 +186,7 @@ EXAMPLE
187
186
  initialize environment for first run from ./src/initialize.ts!
188
187
  ```
189
188
 
190
- _See code: [src/commands/initialize.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.6.81/src/commands/initialize.ts)_
189
+ _See code: [src/commands/initialize.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.6.83/src/commands/initialize.ts)_
191
190
 
192
191
  ## `rnbuilder match-check [MATCH-CHECK]`
193
192
 
@@ -206,7 +205,7 @@ EXAMPLE
206
205
  Check match certificates ./src/match-check.ts!
207
206
  ```
208
207
 
209
- _See code: [src/commands/match-check.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.6.81/src/commands/match-check.ts)_
208
+ _See code: [src/commands/match-check.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.6.83/src/commands/match-check.ts)_
210
209
 
211
210
  ## `rnbuilder match-nuke [BUILD]`
212
211
 
@@ -225,29 +224,7 @@ EXAMPLE
225
224
  Nuke certificates ./src/match-nuke.ts!
226
225
  ```
227
226
 
228
- _See code: [src/commands/match-nuke.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.6.81/src/commands/match-nuke.ts)_
229
-
230
- ## `rnbuilder onesignal [BUILD]`
231
-
232
- Create and upload push cerfiticate to One Signal
233
-
234
- ```
235
- USAGE
236
- $ rnbuilder onesignal [BUILD]
237
-
238
- OPTIONS
239
- -c, --client=client Select client that you want to sync udids
240
- -h, --help show CLI help
241
- --android_gcm_sender_id=android_gcm_sender_id
242
- --android_token=android_token
243
- --auth_token=auth_token Auth token for OneSignal
244
-
245
- EXAMPLE
246
- $ rnbuilder onesignal
247
- Create and upload push certificate to One Signal from ./src/commands/onesignal.ts!
248
- ```
249
-
250
- _See code: [src/commands/onesignal.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.6.81/src/commands/onesignal.ts)_
227
+ _See code: [src/commands/match-nuke.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.6.83/src/commands/match-nuke.ts)_
251
228
 
252
229
  ## `rnbuilder reject-review [REJECT-REVIEW]`
253
230
 
@@ -265,7 +242,7 @@ EXAMPLE
265
242
  $ rnbuilder reject-review
266
243
  ```
267
244
 
268
- _See code: [src/commands/reject-review.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.6.81/src/commands/reject-review.ts)_
245
+ _See code: [src/commands/reject-review.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.6.83/src/commands/reject-review.ts)_
269
246
 
270
247
  ## `rnbuilder setup [SETUP]`
271
248
 
@@ -283,7 +260,7 @@ EXAMPLE
283
260
  hello world from ./src/setup.ts!
284
261
  ```
285
262
 
286
- _See code: [src/commands/setup.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.6.81/src/commands/setup.ts)_
263
+ _See code: [src/commands/setup.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.6.83/src/commands/setup.ts)_
287
264
 
288
265
  ## `rnbuilder setup-gcp`
289
266
 
@@ -297,7 +274,7 @@ OPTIONS
297
274
  -h, --help show CLI help
298
275
  ```
299
276
 
300
- _See code: [src/commands/setup-gcp.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.6.81/src/commands/setup-gcp.ts)_
277
+ _See code: [src/commands/setup-gcp.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.6.83/src/commands/setup-gcp.ts)_
301
278
 
302
279
  ## `rnbuilder submit-review [SUBMIT-REVIEW]`
303
280
 
@@ -316,7 +293,7 @@ EXAMPLE
316
293
  Push changes to existing apps ./src/firebase-sync-udids.ts!
317
294
  ```
318
295
 
319
- _See code: [src/commands/submit-review.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.6.81/src/commands/submit-review.ts)_
296
+ _See code: [src/commands/submit-review.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.6.83/src/commands/submit-review.ts)_
320
297
 
321
298
  ## `rnbuilder sync-udids [BUILD]`
322
299
 
@@ -335,5 +312,5 @@ EXAMPLE
335
312
  Sync device UDIDs from firebase from ./src/firebase-sync-udids.ts!
336
313
  ```
337
314
 
338
- _See code: [src/commands/sync-udids.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.6.81/src/commands/sync-udids.ts)_
315
+ _See code: [src/commands/sync-udids.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.6.83/src/commands/sync-udids.ts)_
339
316
  <!-- commandsstop -->
@@ -1,21 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const command_1 = require("@oclif/command");
4
- const child_process_1 = require("child_process");
5
- const path = require("path");
6
- const common_1 = require("../utils/common");
4
+ const gcp_1 = require("../utils/setup/gcp");
7
5
  class SetupGcp extends command_1.Command {
8
6
  async run() {
9
- var _a, _b, _c, _d, _e;
10
- const configs = common_1.getFastlaneConfigs();
11
- const gcp = (_a = configs.gcp) !== null && _a !== void 0 ? _a : {};
12
- const scriptPath = path.join(__dirname, '../../scripts/setup_gcp_impersonation.sh');
13
- const result = child_process_1.spawnSync('bash', [scriptPath], {
14
- stdio: 'inherit',
15
- env: Object.assign(Object.assign({}, process.env), { GCP_PROJECT_ID: (_b = gcp.projectId) !== null && _b !== void 0 ? _b : '', GCP_USER_EMAIL: (_c = gcp.userEmail) !== null && _c !== void 0 ? _c : '', GCP_SERVICE_ACCOUNTS: ((_d = gcp.serviceAccounts) !== null && _d !== void 0 ? _d : []).join(',') }),
16
- });
17
- if (result.status !== 0) {
18
- this.exit((_e = result.status) !== null && _e !== void 0 ? _e : 1);
7
+ const status = gcp_1.runGcpSetup();
8
+ if (status !== 0) {
9
+ this.exit(status !== null && status !== void 0 ? status : 1);
19
10
  }
20
11
  }
21
12
  }
@@ -7,13 +7,13 @@ const fs = require("fs");
7
7
  const inquirer = require("inquirer");
8
8
  const path = require("path");
9
9
  const app_icon_1 = require("../utils/setup/app-icon");
10
+ const applinks_1 = require("../utils/setup/applinks");
10
11
  const android_keystore_1 = require("../utils/setup/android-keystore");
11
12
  const launch_screen_1 = require("../utils/setup/launch-screen");
12
13
  const client_1 = require("../utils/setup/client");
13
14
  const env_1 = require("../utils/env");
14
15
  const apple_1 = require("../utils/setup/apple");
15
16
  const common_1 = require("../utils/common");
16
- const fastlane_1 = require("../utils/setup/fastlane");
17
17
  const firebase_1 = require("../utils/setup/firebase");
18
18
  function addAppJsonEntry({ client, appName }) {
19
19
  const appJsonPath = path.join(process.cwd(), 'app.json');
@@ -30,6 +30,7 @@ function addAppJsonEntry({ client, appName }) {
30
30
  }
31
31
  class Setup extends command_1.Command {
32
32
  async run() {
33
+ var _a;
33
34
  const questions = [
34
35
  {
35
36
  type: 'input',
@@ -49,11 +50,12 @@ class Setup extends command_1.Command {
49
50
  ];
50
51
  const { client } = await inquirer.prompt(questions);
51
52
  let envPath = path.join(process.cwd(), `configs/${client}/.env.prod`);
52
- if (!common_1.checkFileExists(envPath)) {
53
+ const isExistingClient = common_1.checkFileExists(envPath);
54
+ if (!isExistingClient) {
53
55
  envPath = path.join(process.cwd(), 'template/env.template');
54
56
  }
55
57
  const envVars = env_1.readEnvVars(envPath);
56
- const { bundleId, applicationId, appName } = await client_1.createClientConfig(client);
58
+ const { bundleId, applicationId, appName } = await client_1.createClientConfig(client, isExistingClient ? (_a = envVars.APP_NAME) === null || _a === void 0 ? void 0 : _a.value : undefined);
57
59
  env_1.setEnvValue('CLIENT', client, envVars);
58
60
  const deeplinkHost = envVars.DEEP_LINK_HOST.value.replace('[client]', client);
59
61
  env_1.setEnvValue('DEEP_LINK_HOST', deeplinkHost, envVars);
@@ -70,6 +72,11 @@ class Setup extends command_1.Command {
70
72
  androidAssetFolder,
71
73
  });
72
74
  await android_keystore_1.prepareAndroidKeystore({ client, appName, configFolder: iosAssetFolder });
75
+ await applinks_1.addApplinksEntry({
76
+ client,
77
+ packageName: applicationId || bundleId,
78
+ configFolder: iosAssetFolder,
79
+ });
73
80
  const { launchScreen, launchScreenColor } = await launch_screen_1.prepareLaunchScreen({
74
81
  iosAssetFolder,
75
82
  androidAssetFolder,
@@ -112,7 +119,7 @@ class Setup extends command_1.Command {
112
119
  env_1.setEnvValue('APPLICATION_ID', applicationId, prodEnvVars);
113
120
  env_1.saveEnvValues(prodEnvVars, prodEnvPath);
114
121
  // Setup fastlane
115
- await fastlane_1.setupFastlane({ client });
122
+ const { googleApplicationCredentials } = await firebase_1.setupFastlane({ client });
116
123
  const fastlaneDir = path.join(process.cwd(), `fastlane/clients/${client}/fastlane`);
117
124
  const fastlaneEnvVars = env_1.readEnvVars(path.join(fastlaneDir, '/.env'));
118
125
  env_1.setEnvValue('CLIENT', client, fastlaneEnvVars);
@@ -133,6 +140,9 @@ class Setup extends command_1.Command {
133
140
  env_1.setEnvValue('ITC_TEAM_ID', itcTeamId, fastlaneEnvVars);
134
141
  }
135
142
  env_1.setEnvValue('FLAVOR', common_1.capitalize(client), fastlaneEnvVars);
143
+ if (googleApplicationCredentials) {
144
+ env_1.setEnvValue('GOOGLE_APPLICATION_CREDENTIALS', googleApplicationCredentials, fastlaneEnvVars);
145
+ }
136
146
  env_1.saveEnvValues(fastlaneEnvVars, fastlaneDir + '/.env');
137
147
  // Firebase apps + config files; needs the env files and fastlane .env written above.
138
148
  await firebase_1.provisionFirebase({ client, fastlaneDir });
@@ -0,0 +1,5 @@
1
+ export declare const addApplinksEntry: ({ client, packageName, configFolder, }: {
2
+ client: string;
3
+ packageName: string;
4
+ configFolder: string;
5
+ }) => Promise<void>;
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addApplinksEntry = void 0;
4
+ const fs = require("fs");
5
+ const inquirer = require("inquirer");
6
+ const path = require("path");
7
+ const shell = require("shelljs");
8
+ const common_1 = require("../common");
9
+ const DEFAULT_APPLINKS = '../../edular/edular-web/applinks.js';
10
+ const TABLE_END = '\n}\n\nmodule.exports';
11
+ const readKeystoreInfo = (infoPath) => {
12
+ const info = {};
13
+ fs.readFileSync(infoPath, 'utf-8')
14
+ .split('\n')
15
+ .forEach(line => {
16
+ const index = line.indexOf('=');
17
+ if (index !== -1) {
18
+ info[line.slice(0, index)] = line.slice(index + 1);
19
+ }
20
+ });
21
+ return info;
22
+ };
23
+ const getKeystoreSha256 = (configFolder) => {
24
+ var _a;
25
+ const keystorePath = path.join(configFolder, 'prod.keystore');
26
+ const infoPath = path.join(configFolder, 'keystore.info');
27
+ if (!fs.existsSync(keystorePath) || !fs.existsSync(infoPath)) {
28
+ return undefined;
29
+ }
30
+ const { storePassword, keyAlias } = readKeystoreInfo(infoPath);
31
+ const result = shell.exec(`keytool -list -v -keystore "${keystorePath}" -storepass "${storePassword}" -alias "${keyAlias}"`, { silent: true });
32
+ return (_a = /SHA256:\s*([0-9A-F:]+)/.exec(result.stdout)) === null || _a === void 0 ? void 0 : _a[1];
33
+ };
34
+ // The Play App Signing fingerprint is not known yet; add it by hand after the first upload.
35
+ exports.addApplinksEntry = async ({ client, packageName, configFolder, }) => {
36
+ const sha256 = getKeystoreSha256(configFolder);
37
+ if (!sha256) {
38
+ console.warn('No readable prod.keystore and keystore.info; skipping applinks.js update.');
39
+ return;
40
+ }
41
+ const { applinksPath } = await inquirer.prompt([
42
+ {
43
+ type: 'input',
44
+ name: 'applinksPath',
45
+ message: 'Path to edular-web applinks.js (empty to skip)?',
46
+ default: path.resolve(process.cwd(), DEFAULT_APPLINKS),
47
+ filter: common_1.normalise,
48
+ },
49
+ ]);
50
+ if (!applinksPath) {
51
+ return;
52
+ }
53
+ if (!fs.existsSync(applinksPath)) {
54
+ console.warn(`${applinksPath} not found; skipping applinks.js update.`);
55
+ return;
56
+ }
57
+ const source = fs.readFileSync(applinksPath, 'utf-8');
58
+ const tableStart = source.indexOf('const androidTargetParams');
59
+ const tableEnd = source.indexOf(TABLE_END);
60
+ if (tableStart === -1 || tableEnd === -1) {
61
+ console.warn('Unexpected applinks.js layout; skipping applinks.js update.');
62
+ return;
63
+ }
64
+ if (new RegExp(`\\n ${client}: \\{`).test(source.slice(tableStart))) {
65
+ console.log(`${client} already in applinks.js; add fingerprints by hand.`);
66
+ return;
67
+ }
68
+ const entry = [
69
+ ` ${client}: {`,
70
+ ` package_name: "${packageName}",`,
71
+ ' sha256_cert_fingerprints: [',
72
+ ' ...baseSha256,',
73
+ ` "${sha256}" // prod keystore`,
74
+ ' ]',
75
+ ' }',
76
+ ].join('\n');
77
+ fs.writeFileSync(applinksPath, `${source.slice(0, tableEnd)},\n${entry}${source.slice(tableEnd)}`, 'utf-8');
78
+ console.log(`Added ${client} to ${applinksPath}. Add the Play App Signing SHA-256 after the first Play upload.`);
79
+ };
@@ -1,4 +1,4 @@
1
- export declare const createClientConfig: (client: string) => Promise<{
1
+ export declare const createClientConfig: (client: string, existingAppName?: string | undefined) => Promise<{
2
2
  appName: any;
3
3
  bundleId: any;
4
4
  applicationId: any;
@@ -4,12 +4,13 @@ exports.createClientConfig = void 0;
4
4
  const inquirer = require("inquirer");
5
5
  const android_1 = require("./android");
6
6
  const ios_scheme_1 = require("./ios-scheme");
7
- exports.createClientConfig = async (client) => {
7
+ exports.createClientConfig = async (client, existingAppName) => {
8
8
  const { appName, bundleId, applicationId } = await inquirer.prompt([
9
9
  {
10
10
  type: 'input',
11
11
  name: 'appName',
12
12
  message: 'What is app name?',
13
+ default: existingAppName,
13
14
  },
14
15
  {
15
16
  type: 'input',
@@ -1,3 +1,10 @@
1
+ export declare const setupFastlane: ({ client }: {
2
+ client: string;
3
+ }) => Promise<{
4
+ googleApplicationCredentials: undefined;
5
+ } | {
6
+ googleApplicationCredentials: string;
7
+ }>;
1
8
  export declare const provisionFirebase: ({ client, fastlaneDir, }: {
2
9
  client: string;
3
10
  fastlaneDir: string;
@@ -1,10 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.provisionFirebase = void 0;
3
+ exports.provisionFirebase = exports.setupFastlane = void 0;
4
4
  const fs = require("fs");
5
5
  const inquirer = require("inquirer");
6
6
  const path = require("path");
7
7
  const shell = require("shelljs");
8
+ const common_1 = require("../common");
9
+ const gcp_1 = require("./gcp");
10
+ const env_1 = require("../env");
8
11
  // Firebase apps are provisioned by the project's own script with the operator's
9
12
  // `firebase login`. The client → Firebase project mapping lives in the project too.
10
13
  const CLIENTS_FILE = 'scripts/firebase-clients.json';
@@ -27,6 +30,37 @@ const pickProject = async (clients) => {
27
30
  ]);
28
31
  return project;
29
32
  };
33
+ exports.setupFastlane = async ({ client }) => {
34
+ const fastlaneDir = path.join(process.cwd(), `fastlane/clients/${client}/fastlane`);
35
+ // Merge template files in without overwriting existing client files —
36
+ // fills gaps left by a partial/previous setup run (e.g. missing .env).
37
+ await common_1.copyDir(path.join(process.cwd(), 'template/fastlane'), fastlaneDir, false);
38
+ const adcFiles = gcp_1.listAdcFiles();
39
+ if (!adcFiles.length) {
40
+ console.warn('No impersonated ADC file found in ~/.config/gcloud. Run the setup-gcp command, then set GOOGLE_APPLICATION_CREDENTIALS in the client fastlane .env.');
41
+ return { googleApplicationCredentials: undefined };
42
+ }
43
+ const { googleApplicationCredentials } = await inquirer.prompt([
44
+ {
45
+ type: 'list',
46
+ name: 'googleApplicationCredentials',
47
+ message: 'Impersonated ADC file for Google Play?',
48
+ choices: adcFiles,
49
+ default: '~/.config/gcloud/adc_fastlane.json',
50
+ },
51
+ ]);
52
+ return { googleApplicationCredentials: googleApplicationCredentials };
53
+ };
54
+ // fastlane/configs.json maps each Firebase project to its service account key
55
+ // under `serviceAccounts`; the key is copied into the client's fastlane dir.
56
+ const copyServiceAccountFile = async (project, fastlaneDir) => {
57
+ var _a;
58
+ const file = (_a = common_1.getFastlaneConfigs().serviceAccounts) === null || _a === void 0 ? void 0 : _a[project];
59
+ if (!file) {
60
+ throw new Error(`No service account key for ${project}; add it under serviceAccounts in fastlane/configs.json`);
61
+ }
62
+ await common_1.copyFile(path.resolve(process.cwd(), file), path.join(fastlaneDir, 'firebase.json'));
63
+ };
30
64
  // Needs configs/<client>/.env.prod and fastlane/clients/<client>/fastlane/.env written:
31
65
  // the script reads the package / bundle IDs and writes FIREBASE_ANDROID_APP / FIREBASE_IOS_APP.
32
66
  exports.provisionFirebase = async ({ client, fastlaneDir, }) => {
@@ -53,6 +87,11 @@ exports.provisionFirebase = async ({ client, fastlaneDir, }) => {
53
87
  if (result.code !== 0) {
54
88
  console.warn(`Firebase provisioning failed; fix the error above and re-run: node ${PROVISION_SCRIPT} ${client}`);
55
89
  }
90
+ const fastlaneEnvPath = path.join(fastlaneDir, '.env');
91
+ const fastlaneEnvVars = env_1.readEnvVars(fastlaneEnvPath);
92
+ await copyServiceAccountFile(clients[client].project, fastlaneDir);
93
+ env_1.setEnvValue('FIREBASE_SERVICE_ACCOUNT_FILE', 'firebase.json', fastlaneEnvVars);
94
+ env_1.saveEnvValues(fastlaneEnvVars, fastlaneEnvPath);
56
95
  const { apnsKey } = await inquirer.prompt([
57
96
  {
58
97
  type: 'confirm',
@@ -0,0 +1,2 @@
1
+ export declare const listAdcFiles: () => string[];
2
+ export declare const runGcpSetup: () => number | null;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runGcpSetup = exports.listAdcFiles = void 0;
4
+ const child_process_1 = require("child_process");
5
+ const fs = require("fs");
6
+ const os = require("os");
7
+ const path = require("path");
8
+ const common_1 = require("../common");
9
+ const ADC_DIR = path.join(os.homedir(), '.config/gcloud');
10
+ // Impersonated ADC files created by scripts/setup_gcp_impersonation.sh
11
+ exports.listAdcFiles = () => fs.existsSync(ADC_DIR)
12
+ ? fs
13
+ .readdirSync(ADC_DIR)
14
+ .filter(file => /^adc_.+\.json$/.test(file))
15
+ .sort()
16
+ .map(file => `~/.config/gcloud/${file}`)
17
+ : [];
18
+ exports.runGcpSetup = () => {
19
+ var _a, _b, _c, _d;
20
+ const gcp = (_a = common_1.getFastlaneConfigs().gcp) !== null && _a !== void 0 ? _a : {};
21
+ const scriptPath = path.join(__dirname, '../../../scripts/setup_gcp_impersonation.sh');
22
+ return child_process_1.spawnSync('bash', [scriptPath], {
23
+ stdio: 'inherit',
24
+ env: Object.assign(Object.assign({}, process.env), { GCP_PROJECT_ID: (_b = gcp.projectId) !== null && _b !== void 0 ? _b : '', GCP_USER_EMAIL: (_c = gcp.userEmail) !== null && _c !== void 0 ? _c : '', GCP_SERVICE_ACCOUNTS: ((_d = gcp.serviceAccounts) !== null && _d !== void 0 ? _d : []).join(',') }),
25
+ }).status;
26
+ };
@@ -1 +1 @@
1
- {"version":"0.6.81","commands":{"build":{"id":"build","description":"Build react native apps","pluginName":"rnbuilder","pluginType":"core","aliases":[],"examples":["$ rnbuilder build\nhello world from ./src/build.ts!\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"client":{"name":"client","type":"option","char":"c","description":"Set client that you want to build app"},"target":{"name":"target","type":"option","char":"t","description":"Set the build target: android, ios or both","options":["android","ios","android,ios"]},"env":{"name":"env","type":"option","char":"e","description":"Set the environment: prod, staging, dev"},"branch":{"name":"branch","type":"option","char":"b","description":"Set the source branch used to build the app"},"version":{"name":"version","type":"option","char":"v","description":"Set the version number for this build"},"installr":{"name":"installr","type":"option","char":"i","description":"If enabled, the build will be uploaded to installR"},"distribute":{"name":"distribute","type":"option","char":"d","description":"Specify where to distribute app"},"firebase":{"name":"firebase","type":"boolean","char":"f","description":"If enabled, the build will be uploaded to firebase","allowNo":false},"testersIos":{"name":"testersIos","type":"option","char":"t","description":"Tester ids for iOS distribution"},"testersAndroid":{"name":"testersAndroid","type":"option","char":"u","description":"Tester ids for Android distribution"},"gitReset":{"name":"gitReset","type":"boolean","char":"g","description":"Do git reset when building","allowNo":false},"cleanup":{"name":"cleanup","type":"boolean","char":"s","description":"Do cleanup when building","allowNo":false},"groupsIos":{"name":"groupsIos","type":"option","description":"Groups ids for iOS distribution"},"groupsAndroid":{"name":"groupsAndroid","type":"option","description":"Groups ids for Android distribution"},"skipCheckVersion":{"name":"skipCheckVersion","type":"boolean","description":"Skip checking current version on stores","allowNo":false},"install":{"name":"install","type":"boolean","char":"n","description":"Install dependencies before building","allowNo":false}},"args":[{"name":"build"}]},"check-version":{"id":"check-version","description":"Check live versions","pluginName":"rnbuilder","pluginType":"core","aliases":[],"examples":["$ rnbuilder check-version\n Nuke certificates ./src/match-check.ts!\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"client":{"name":"client","type":"option","char":"c","description":"Select client that you want to sync udids"}},"args":[{"name":"match-check"}]},"codepush":{"id":"codepush","description":"Push changes to existing apps","pluginName":"rnbuilder","pluginType":"core","aliases":[],"examples":["$ rnbuilder codepush\n Push changes to existing apps ./src/firebase-sync-udids.ts!\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"client":{"name":"client","type":"option","char":"c","description":"Select client that you want to push update"}},"args":[{"name":"build"}]},"google-key":{"id":"google-key","description":"Nuke certificates","pluginName":"rnbuilder","pluginType":"core","aliases":[],"examples":["$ rnbuilder match-check\n Nuke certificates ./src/match-check.ts!\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"client":{"name":"client","type":"option","char":"c","description":"Select client that you want to sync udids"}},"args":[{"name":"match-check"}]},"initialize":{"id":"initialize","description":"Initialize the environment for first run","pluginName":"rnbuilder","pluginType":"core","aliases":[],"examples":["$ rnbuilder initialize\ninitialize environment for first run from ./src/initialize.ts!\n"],"flags":{},"args":[]},"match-check":{"id":"match-check","description":"Check match certificates","pluginName":"rnbuilder","pluginType":"core","aliases":[],"examples":["$ rnbuilder match-check\n Check match certificates ./src/match-check.ts!\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"client":{"name":"client","type":"option","char":"c","description":"Select client that you want to check match certificates"}},"args":[{"name":"match-check"}]},"match-nuke":{"id":"match-nuke","description":"Nuke certificates","pluginName":"rnbuilder","pluginType":"core","aliases":[],"examples":["$ rnbuilder match-nuke\n Nuke certificates ./src/match-nuke.ts!\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"client":{"name":"client","type":"option","char":"c","description":"Select client that you want to sync udids"}},"args":[{"name":"build"}]},"onesignal":{"id":"onesignal","description":"Create and upload push cerfiticate to One Signal","pluginName":"rnbuilder","pluginType":"core","aliases":[],"examples":["$ rnbuilder onesignal\n Create and upload push certificate to One Signal from ./src/commands/onesignal.ts!\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"client":{"name":"client","type":"option","char":"c","description":"Select client that you want to sync udids"},"auth_token":{"name":"auth_token","type":"option","description":"Auth token for OneSignal"},"android_token":{"name":"android_token","type":"option"},"android_gcm_sender_id":{"name":"android_gcm_sender_id","type":"option"}},"args":[{"name":"build"}]},"reject-review":{"id":"reject-review","description":"Reject current App Store review version (In Review or Pending Developer Release)","pluginName":"rnbuilder","pluginType":"core","aliases":[],"examples":["$ rnbuilder reject-review\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"client":{"name":"client","type":"option","char":"c","description":"Select client to reject App Store review version"}},"args":[{"name":"reject-review"}]},"setup-gcp":{"id":"setup-gcp","description":"Setup GCP service account impersonation","pluginName":"rnbuilder","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"setup":{"id":"setup","description":"Setup new client","pluginName":"rnbuilder","pluginType":"core","aliases":[],"examples":["$ rnbuilder build\nhello world from ./src/setup.ts!\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"setup"}]},"submit-review":{"id":"submit-review","description":"Submit ios for review","pluginName":"rnbuilder","pluginType":"core","aliases":[],"examples":["$ rnbuilder submit-review\n Push changes to existing apps ./src/firebase-sync-udids.ts!\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"client":{"name":"client","type":"option","char":"c","description":"Select client that you want to push update"}},"args":[{"name":"submit-review"}]},"sync-udids":{"id":"sync-udids","description":"Sync device UDIDs from firebase","pluginName":"rnbuilder","pluginType":"core","aliases":[],"examples":["$ rnbuilder sync-udids\n Sync device UDIDs from firebase from ./src/firebase-sync-udids.ts!\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"client":{"name":"client","type":"option","char":"c","description":"Select client that you want to sync udids"}},"args":[{"name":"build"}]}}}
1
+ {"version":"0.6.83","commands":{"build":{"id":"build","description":"Build react native apps","pluginName":"rnbuilder","pluginType":"core","aliases":[],"examples":["$ rnbuilder build\nhello world from ./src/build.ts!\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"client":{"name":"client","type":"option","char":"c","description":"Set client that you want to build app"},"target":{"name":"target","type":"option","char":"t","description":"Set the build target: android, ios or both","options":["android","ios","android,ios"]},"env":{"name":"env","type":"option","char":"e","description":"Set the environment: prod, staging, dev"},"branch":{"name":"branch","type":"option","char":"b","description":"Set the source branch used to build the app"},"version":{"name":"version","type":"option","char":"v","description":"Set the version number for this build"},"installr":{"name":"installr","type":"option","char":"i","description":"If enabled, the build will be uploaded to installR"},"distribute":{"name":"distribute","type":"option","char":"d","description":"Specify where to distribute app"},"firebase":{"name":"firebase","type":"boolean","char":"f","description":"If enabled, the build will be uploaded to firebase","allowNo":false},"testersIos":{"name":"testersIos","type":"option","char":"t","description":"Tester ids for iOS distribution"},"testersAndroid":{"name":"testersAndroid","type":"option","char":"u","description":"Tester ids for Android distribution"},"gitReset":{"name":"gitReset","type":"boolean","char":"g","description":"Do git reset when building","allowNo":false},"cleanup":{"name":"cleanup","type":"boolean","char":"s","description":"Do cleanup when building","allowNo":false},"groupsIos":{"name":"groupsIos","type":"option","description":"Groups ids for iOS distribution"},"groupsAndroid":{"name":"groupsAndroid","type":"option","description":"Groups ids for Android distribution"},"skipCheckVersion":{"name":"skipCheckVersion","type":"boolean","description":"Skip checking current version on stores","allowNo":false},"install":{"name":"install","type":"boolean","char":"n","description":"Install dependencies before building","allowNo":false}},"args":[{"name":"build"}]},"check-version":{"id":"check-version","description":"Check live versions","pluginName":"rnbuilder","pluginType":"core","aliases":[],"examples":["$ rnbuilder check-version\n Nuke certificates ./src/match-check.ts!\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"client":{"name":"client","type":"option","char":"c","description":"Select client that you want to sync udids"}},"args":[{"name":"match-check"}]},"codepush":{"id":"codepush","description":"Push changes to existing apps","pluginName":"rnbuilder","pluginType":"core","aliases":[],"examples":["$ rnbuilder codepush\n Push changes to existing apps ./src/firebase-sync-udids.ts!\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"client":{"name":"client","type":"option","char":"c","description":"Select client that you want to push update"}},"args":[{"name":"build"}]},"google-key":{"id":"google-key","description":"Nuke certificates","pluginName":"rnbuilder","pluginType":"core","aliases":[],"examples":["$ rnbuilder match-check\n Nuke certificates ./src/match-check.ts!\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"client":{"name":"client","type":"option","char":"c","description":"Select client that you want to sync udids"}},"args":[{"name":"match-check"}]},"initialize":{"id":"initialize","description":"Initialize the environment for first run","pluginName":"rnbuilder","pluginType":"core","aliases":[],"examples":["$ rnbuilder initialize\ninitialize environment for first run from ./src/initialize.ts!\n"],"flags":{},"args":[]},"match-check":{"id":"match-check","description":"Check match certificates","pluginName":"rnbuilder","pluginType":"core","aliases":[],"examples":["$ rnbuilder match-check\n Check match certificates ./src/match-check.ts!\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"client":{"name":"client","type":"option","char":"c","description":"Select client that you want to check match certificates"}},"args":[{"name":"match-check"}]},"match-nuke":{"id":"match-nuke","description":"Nuke certificates","pluginName":"rnbuilder","pluginType":"core","aliases":[],"examples":["$ rnbuilder match-nuke\n Nuke certificates ./src/match-nuke.ts!\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"client":{"name":"client","type":"option","char":"c","description":"Select client that you want to sync udids"}},"args":[{"name":"build"}]},"reject-review":{"id":"reject-review","description":"Reject current App Store review version (In Review or Pending Developer Release)","pluginName":"rnbuilder","pluginType":"core","aliases":[],"examples":["$ rnbuilder reject-review\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"client":{"name":"client","type":"option","char":"c","description":"Select client to reject App Store review version"}},"args":[{"name":"reject-review"}]},"setup-gcp":{"id":"setup-gcp","description":"Setup GCP service account impersonation","pluginName":"rnbuilder","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"setup":{"id":"setup","description":"Setup new client","pluginName":"rnbuilder","pluginType":"core","aliases":[],"examples":["$ rnbuilder build\nhello world from ./src/setup.ts!\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"setup"}]},"submit-review":{"id":"submit-review","description":"Submit ios for review","pluginName":"rnbuilder","pluginType":"core","aliases":[],"examples":["$ rnbuilder submit-review\n Push changes to existing apps ./src/firebase-sync-udids.ts!\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"client":{"name":"client","type":"option","char":"c","description":"Select client that you want to push update"}},"args":[{"name":"submit-review"}]},"sync-udids":{"id":"sync-udids","description":"Sync device UDIDs from firebase","pluginName":"rnbuilder","pluginType":"core","aliases":[],"examples":["$ rnbuilder sync-udids\n Sync device UDIDs from firebase from ./src/firebase-sync-udids.ts!\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"client":{"name":"client","type":"option","char":"c","description":"Select client that you want to sync udids"}},"args":[{"name":"build"}]}}}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rnbuilder",
3
3
  "description": "React Native builder tool",
4
- "version": "0.6.81",
4
+ "version": "0.6.83",
5
5
  "author": "Tuan Luong @r0b0t3d",
6
6
  "bin": "./bin/run",
7
7
  "bugs": "https://github.com/r0b0t3d/rnbuilder/issues",
@@ -1,17 +0,0 @@
1
- import { Command, flags } from '@oclif/command';
2
- export default class OneSignalCertificate extends Command {
3
- static description: string;
4
- static examples: string[];
5
- static flags: {
6
- help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
7
- client: flags.IOptionFlag<string | undefined>;
8
- auth_token: flags.IOptionFlag<string | undefined>;
9
- android_token: flags.IOptionFlag<string | undefined>;
10
- android_gcm_sender_id: flags.IOptionFlag<string | undefined>;
11
- };
12
- static args: {
13
- name: string;
14
- }[];
15
- askForMissingFields: (flags: any) => Promise<any>;
16
- run(): Promise<void>;
17
- }
@@ -1,85 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- /* eslint-disable no-negated-condition */
5
- const command_1 = require("@oclif/command");
6
- const shell = require("shelljs");
7
- const inquirer = require("inquirer");
8
- const common_1 = require("../utils/common");
9
- inquirer.registerPrompt('checkbox-plus', require('inquirer-checkbox-plus-prompt'));
10
- class OneSignalCertificate extends command_1.Command {
11
- constructor() {
12
- super(...arguments);
13
- this.askForMissingFields = async (flags) => {
14
- const questions = [];
15
- if (!flags.client) {
16
- const clients = common_1.getDirectories('./fastlane/clients');
17
- if (clients.length > 0) {
18
- questions.push({
19
- type: 'checkbox-plus',
20
- name: 'client',
21
- message: 'What is the client?',
22
- pageSize: 100,
23
- highlight: true,
24
- searchable: true,
25
- default: [],
26
- source: (answersSoFar, input) => {
27
- input = input || '';
28
- return new Promise(resolve => {
29
- const result = clients.filter(client => client.includes(input.toLowerCase()));
30
- resolve(result);
31
- });
32
- },
33
- validate: (input) => {
34
- return new Promise(resolve => {
35
- if (input.length === 0) {
36
- resolve('You need to select at least 1 client');
37
- }
38
- else {
39
- resolve(true);
40
- }
41
- });
42
- },
43
- });
44
- }
45
- }
46
- let result = flags;
47
- if (questions.length > 0) {
48
- const answers = await inquirer.prompt(questions);
49
- result = Object.assign(Object.assign({}, flags), answers);
50
- }
51
- return result;
52
- };
53
- }
54
- async run() {
55
- const { flags } = this.parse(OneSignalCertificate);
56
- const params = await this.askForMissingFields(flags);
57
- const { client } = params, otherParams = tslib_1.__rest(params, ["client"]);
58
- const parameters = common_1.buildKeyValuePairs(otherParams);
59
- shell.exec('bundle install');
60
- if (client) {
61
- shell.cd(`fastlane/clients/${client}`);
62
- }
63
- shell.exec(`bundle exec fastlane sync_onesignal ${parameters.join(' ')}`);
64
- }
65
- }
66
- exports.default = OneSignalCertificate;
67
- OneSignalCertificate.description = 'Create and upload push cerfiticate to One Signal';
68
- OneSignalCertificate.examples = [
69
- `$ rnbuilder onesignal
70
- Create and upload push certificate to One Signal from ./src/commands/onesignal.ts!
71
- `,
72
- ];
73
- OneSignalCertificate.flags = {
74
- help: command_1.flags.help({ char: 'h' }),
75
- client: command_1.flags.string({
76
- char: 'c',
77
- description: 'Select client that you want to sync udids',
78
- }),
79
- auth_token: command_1.flags.string({
80
- description: 'Auth token for OneSignal',
81
- }),
82
- android_token: command_1.flags.string(),
83
- android_gcm_sender_id: command_1.flags.string(),
84
- };
85
- OneSignalCertificate.args = [{ name: 'build' }];
@@ -1,3 +0,0 @@
1
- export declare const setupFastlane: ({ client }: {
2
- client: string;
3
- }) => Promise<void>;
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setupFastlane = void 0;
4
- const common_1 = require("../common");
5
- const path = require("path");
6
- const inquirer = require("inquirer");
7
- exports.setupFastlane = async ({ client }) => {
8
- const clientDir = path.join(process.cwd(), `fastlane/clients/${client}`);
9
- const fastlaneDir = path.join(clientDir, 'fastlane');
10
- // Merge template files in without overwriting existing client files —
11
- // fills gaps left by a partial/previous setup run (e.g. missing .env).
12
- await common_1.copyDir(path.join(process.cwd(), 'template/fastlane'), fastlaneDir, false);
13
- const { firebaseServiceAccountFile, jsonKeyFile } = await inquirer.prompt([
14
- {
15
- type: 'input',
16
- name: 'firebaseServiceAccountFile',
17
- message: 'Firebase Service Account file (for App Distribution)?',
18
- default: process.env.FIREBASE_SERVICE_ACCOUNT_FILE,
19
- },
20
- {
21
- type: 'input',
22
- name: 'jsonKeyFile',
23
- message: 'Path to Google json file? See https://docs.fastlane.tools/actions/supply/#setup',
24
- },
25
- ]);
26
- if (firebaseServiceAccountFile) {
27
- await common_1.copyFile(common_1.normalise(firebaseServiceAccountFile), path.join(fastlaneDir, 'firebase.json'));
28
- }
29
- if (jsonKeyFile) {
30
- await common_1.copyFile(common_1.normalise(jsonKeyFile), path.join(clientDir, 'key.json'));
31
- }
32
- };