rnbuilder 0.5.24 → 0.5.25

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
@@ -20,7 +20,7 @@ $ npm install -g rnbuilder
20
20
  $ rnbuilder COMMAND
21
21
  running command...
22
22
  $ rnbuilder (-v|--version|version)
23
- rnbuilder/0.5.24 darwin-arm64 node-v16.19.0
23
+ rnbuilder/0.5.25 darwin-arm64 node-v16.19.0
24
24
  $ rnbuilder --help [COMMAND]
25
25
  USAGE
26
26
  $ rnbuilder COMMAND
@@ -59,7 +59,7 @@ EXAMPLE
59
59
  hello world from ./src/build.ts!
60
60
  ```
61
61
 
62
- _See code: [src/commands/build.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.5.24/src/commands/build.ts)_
62
+ _See code: [src/commands/build.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.5.25/src/commands/build.ts)_
63
63
 
64
64
  ## `rnbuilder codepush [BUILD]`
65
65
 
@@ -78,7 +78,7 @@ EXAMPLE
78
78
  Push changes to existing apps ./src/firebase-sync-udids.ts!
79
79
  ```
80
80
 
81
- _See code: [src/commands/codepush.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.5.24/src/commands/codepush.ts)_
81
+ _See code: [src/commands/codepush.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.5.25/src/commands/codepush.ts)_
82
82
 
83
83
  ## `rnbuilder help [COMMAND]`
84
84
 
@@ -110,7 +110,7 @@ EXAMPLE
110
110
  initialize environment for first run from ./src/initialize.ts!
111
111
  ```
112
112
 
113
- _See code: [src/commands/initialize.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.5.24/src/commands/initialize.ts)_
113
+ _See code: [src/commands/initialize.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.5.25/src/commands/initialize.ts)_
114
114
 
115
115
  ## `rnbuilder match-nuke [BUILD]`
116
116
 
@@ -129,7 +129,7 @@ EXAMPLE
129
129
  Nuke certificates ./src/match-nuke.ts!
130
130
  ```
131
131
 
132
- _See code: [src/commands/match-nuke.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.5.24/src/commands/match-nuke.ts)_
132
+ _See code: [src/commands/match-nuke.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.5.25/src/commands/match-nuke.ts)_
133
133
 
134
134
  ## `rnbuilder setup [SETUP]`
135
135
 
@@ -147,7 +147,7 @@ EXAMPLE
147
147
  hello world from ./src/setup.ts!
148
148
  ```
149
149
 
150
- _See code: [src/commands/setup.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.5.24/src/commands/setup.ts)_
150
+ _See code: [src/commands/setup.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.5.25/src/commands/setup.ts)_
151
151
 
152
152
  ## `rnbuilder sync-udids [BUILD]`
153
153
 
@@ -166,5 +166,5 @@ EXAMPLE
166
166
  Sync device UDIDs from firebase from ./src/firebase-sync-udids.ts!
167
167
  ```
168
168
 
169
- _See code: [src/commands/sync-udids.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.5.24/src/commands/sync-udids.ts)_
169
+ _See code: [src/commands/sync-udids.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.5.25/src/commands/sync-udids.ts)_
170
170
  <!-- commandsstop -->
@@ -205,6 +205,8 @@ class Build extends command_1.Command {
205
205
  shell.exec('bundle update cocoapods');
206
206
  shell.cd('../');
207
207
  shell.exec('yarn install && npx pod-install');
208
+ // Clean fastlane builds
209
+ shell.exec('rm -rf fastlane/builds');
208
210
  // Clean android if any
209
211
  if (target.includes('android')) {
210
212
  shell.cd('./android');
@@ -11,6 +11,8 @@ const client_1 = require("../utils/setup/client");
11
11
  const env_1 = require("../utils/env");
12
12
  const apple_1 = require("../utils/setup/apple");
13
13
  const onesignal_1 = require("../utils/setup/onesignal");
14
+ const common_1 = require("../utils/common");
15
+ const fastlane_1 = require("../utils/setup/fastlane");
14
16
  class Setup extends command_1.Command {
15
17
  async run() {
16
18
  const envVars = env_1.readEnvVars(path.join(process.cwd(), 'template/env.template'));
@@ -79,6 +81,22 @@ class Setup extends command_1.Command {
79
81
  const prodEnvVars = env_1.updateServiceDomain(envVars, 'app');
80
82
  env_1.setEnvValue('APP_NAME', appName, prodEnvVars);
81
83
  env_1.saveEnvValues(prodEnvVars, path.join(process.cwd(), `/configs/${client}/.env.prod`));
84
+ // Setup fastlane
85
+ const { firebaseIosApp, firebaseAndroidApp } = await fastlane_1.setupFastlane({
86
+ client,
87
+ });
88
+ const fastlaneDir = path.join(process.cwd(), `fastlane/${client}/fastlane`);
89
+ const fastlaneEnvVars = env_1.readEnvVars(path.join(fastlaneDir, '/.env'));
90
+ env_1.setEnvValue('CLIENT', client, fastlaneEnvVars);
91
+ env_1.setEnvValue('APP_IDENTIFIER', bundleId, fastlaneEnvVars);
92
+ env_1.setEnvValue('APP_NAME', appName, fastlaneEnvVars);
93
+ env_1.setEnvValue('XCODEPROJ_SCHEME', `${client} prod`, fastlaneEnvVars);
94
+ env_1.setEnvValue('APPLE_TEAM_ID', appleTeamId, fastlaneEnvVars);
95
+ env_1.setEnvValue('ITC_TEAM_ID', itcTeamId, fastlaneEnvVars);
96
+ env_1.setEnvValue('FLAVOR', common_1.capitalize(client), fastlaneEnvVars);
97
+ env_1.setEnvValue('FIREBASE_IOS_APP', firebaseIosApp, fastlaneEnvVars);
98
+ env_1.setEnvValue('FIREBASE_ANDROID_APP', firebaseAndroidApp, fastlaneEnvVars);
99
+ env_1.saveEnvValues(fastlaneEnvVars, fastlaneDir + '/.env');
82
100
  }
83
101
  }
84
102
  exports.default = Setup;
@@ -6,3 +6,4 @@ export declare const getAppVersion: (env: string, client?: string | undefined, t
6
6
  };
7
7
  export declare const copyDir: (src: string, dest: string) => Promise<unknown>;
8
8
  export declare const normalise: (input: string) => string;
9
+ export declare const capitalize: (string: string) => string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalise = exports.copyDir = exports.getAppVersion = exports.getDirectories = exports.buildKeyValuePairs = void 0;
3
+ exports.capitalize = exports.normalise = exports.copyDir = exports.getAppVersion = exports.getDirectories = exports.buildKeyValuePairs = void 0;
4
4
  const fs = require("fs");
5
5
  exports.buildKeyValuePairs = (params) => Object.keys(params).map(key => `${key}:${params[key]}`);
6
6
  exports.getDirectories = (path) => {
@@ -46,3 +46,6 @@ exports.copyDir = (src, dest) => new Promise((resolve, reject) => {
46
46
  });
47
47
  });
48
48
  exports.normalise = (input) => input.replace(/'/g, '').trim();
49
+ exports.capitalize = (string) => {
50
+ return string.charAt(0).toUpperCase() + string.slice(1);
51
+ };
@@ -0,0 +1,4 @@
1
+ export declare const setupFastlane: ({ client }: any) => Promise<{
2
+ firebaseIosApp: any;
3
+ firebaseAndroidApp: any;
4
+ }>;
@@ -0,0 +1,43 @@
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 fastlaneDir = path.join(process.cwd(), `fastlane/${client}/fastlane`);
9
+ // Copy template folders
10
+ await common_1.copyDir(path.join(process.cwd(), 'template/fastlane'), fastlaneDir);
11
+ const { firebaseServiceAccountFile, firebaseIosApp, firebaseAndroidApp, jsonKeyFile, } = inquirer.prompt([
12
+ {
13
+ type: 'input',
14
+ name: 'firebaseServiceAccountFile',
15
+ message: 'Firebase Service Account file?',
16
+ },
17
+ {
18
+ type: 'input',
19
+ name: 'firebaseIosApp',
20
+ message: 'What is Firebase iOS App Id?',
21
+ },
22
+ {
23
+ type: 'input',
24
+ name: 'firebaseAndroidApp',
25
+ message: 'What is Firebase Android App Id?',
26
+ },
27
+ {
28
+ type: 'input',
29
+ name: 'jsonKeyFile',
30
+ message: 'Path to json file? See https://docs.fastlane.tools/actions/supply/#setup',
31
+ },
32
+ ]);
33
+ if (firebaseServiceAccountFile) {
34
+ await common_1.copyDir(common_1.normalise(firebaseServiceAccountFile), path.join(fastlaneDir, 'firebase.json'));
35
+ }
36
+ if (jsonKeyFile) {
37
+ await common_1.copyDir(common_1.normalise(jsonKeyFile), path.join(fastlaneDir, '../key.json'));
38
+ }
39
+ return {
40
+ firebaseIosApp,
41
+ firebaseAndroidApp,
42
+ };
43
+ };
@@ -1 +1 @@
1
- {"version":"0.5.24","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"]},"env":{"name":"env","type":"option","char":"e","description":"Set the environment: prod, adhoc, staging","options":["staging","adhoc","prod"]},"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"}},"args":[{"name":"build"}]},"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"}]},"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-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"}]},"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"}]},"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.5.25","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"]},"env":{"name":"env","type":"option","char":"e","description":"Set the environment: prod, adhoc, staging","options":["staging","adhoc","prod"]},"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"}},"args":[{"name":"build"}]},"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"}]},"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-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"}]},"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"}]},"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.5.24",
4
+ "version": "0.5.25",
5
5
  "author": "Tuan Luong @r0b0t3d",
6
6
  "bin": {
7
7
  "rnbuilder": "./bin/run"