rnbuilder 0.5.16 → 0.5.18

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.16 darwin-arm64 node-v18.11.0
23
+ rnbuilder/0.5.18 darwin-arm64 node-v14.21.1
24
24
  $ rnbuilder --help [COMMAND]
25
25
  USAGE
26
26
  $ rnbuilder COMMAND
@@ -58,7 +58,7 @@ EXAMPLE
58
58
  hello world from ./src/build.ts!
59
59
  ```
60
60
 
61
- _See code: [src/commands/build.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.5.16/src/commands/build.ts)_
61
+ _See code: [src/commands/build.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.5.18/src/commands/build.ts)_
62
62
 
63
63
  ## `rnbuilder codepush [BUILD]`
64
64
 
@@ -77,7 +77,7 @@ EXAMPLE
77
77
  Push changes to existing apps ./src/firebase-sync-udids.ts!
78
78
  ```
79
79
 
80
- _See code: [src/commands/codepush.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.5.16/src/commands/codepush.ts)_
80
+ _See code: [src/commands/codepush.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.5.18/src/commands/codepush.ts)_
81
81
 
82
82
  ## `rnbuilder help [COMMAND]`
83
83
 
@@ -109,7 +109,7 @@ EXAMPLE
109
109
  initialize environment for first run from ./src/initialize.ts!
110
110
  ```
111
111
 
112
- _See code: [src/commands/initialize.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.5.16/src/commands/initialize.ts)_
112
+ _See code: [src/commands/initialize.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.5.18/src/commands/initialize.ts)_
113
113
 
114
114
  ## `rnbuilder match-nuke [BUILD]`
115
115
 
@@ -128,7 +128,7 @@ EXAMPLE
128
128
  Nuke certificates ./src/match-nuke.ts!
129
129
  ```
130
130
 
131
- _See code: [src/commands/match-nuke.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.5.16/src/commands/match-nuke.ts)_
131
+ _See code: [src/commands/match-nuke.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.5.18/src/commands/match-nuke.ts)_
132
132
 
133
133
  ## `rnbuilder sync-udids [BUILD]`
134
134
 
@@ -147,5 +147,5 @@ EXAMPLE
147
147
  Sync device UDIDs from firebase from ./src/firebase-sync-udids.ts!
148
148
  ```
149
149
 
150
- _See code: [src/commands/sync-udids.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.5.16/src/commands/sync-udids.ts)_
150
+ _See code: [src/commands/sync-udids.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.5.18/src/commands/sync-udids.ts)_
151
151
  <!-- commandsstop -->
@@ -15,7 +15,7 @@ export default class Build extends Command {
15
15
  name: string;
16
16
  }[];
17
17
  askForMissingFields: (flags: any) => Promise<any>;
18
- updateAppVersion(targets: string[], env: string, client?: string, versionNumber?: string): void;
18
+ getJsonFile(env: string): string;
19
19
  runPlatforms(target: string[], parameters: any, otherParams: any): void;
20
20
  run(): Promise<void>;
21
21
  }
@@ -7,7 +7,6 @@ const command_1 = require("@oclif/command");
7
7
  const inquirer = require("inquirer");
8
8
  const shell = require("shelljs");
9
9
  const utils_1 = require("../utils");
10
- const fs = require("fs");
11
10
  class Build extends command_1.Command {
12
11
  constructor() {
13
12
  super(...arguments);
@@ -95,12 +94,11 @@ class Build extends command_1.Command {
95
94
  }
96
95
  }
97
96
  else if (result.distribute === 'store') {
98
- const appVersion = utils_1.getAppVersion(result.env, result.client, result.target);
99
97
  postQuestions.push({
100
- type: 'input',
101
- name: 'version_number',
102
- message: 'What is the version number?',
103
- suffix: appVersion ? ` (latest: ${appVersion.version})` : ' (e.g: 1.0.0)',
98
+ type: 'list',
99
+ name: 'version',
100
+ message: 'What is the version bump?',
101
+ choices: ['patch', 'minor', 'major'],
104
102
  validate: (input) => {
105
103
  if (!input) {
106
104
  return 'You need to specify the version';
@@ -148,38 +146,26 @@ class Build extends command_1.Command {
148
146
  return result;
149
147
  };
150
148
  }
151
- updateAppVersion(targets, env, client, versionNumber) {
149
+ getJsonFile(env) {
152
150
  let fileName = 'app';
153
151
  if (env !== 'prod') {
154
152
  fileName = `${fileName}.${env}`;
155
153
  }
156
- const appVersions = require(process.cwd() + `/${fileName}.json`);
157
- targets.forEach((t) => {
158
- const appVersion = utils_1.getAppVersion(env, client, t);
159
- const newVersion = Object.assign(Object.assign({}, appVersion), { build: appVersion.build + 1, buildDate: new Date().toDateString() });
160
- if (versionNumber) {
161
- newVersion.version = versionNumber;
162
- }
163
- if (client) {
164
- appVersions[client] = Object.assign(Object.assign({}, appVersions[client]), { [t]: newVersion });
165
- }
166
- else {
167
- appVersions[t] = newVersion;
168
- }
169
- });
170
- const json = JSON.stringify(appVersions, null, 2);
171
- fs.writeFileSync(process.cwd() + `/${fileName}.json`, json);
154
+ const file = process.cwd() + `/${fileName}.json`;
155
+ return file;
172
156
  }
173
157
  runPlatforms(target, parameters, otherParams) {
174
158
  target.forEach((t) => {
175
- shell.exec(`bundle exec fastlane ${t} build ${parameters.join(' ')} --env ${otherParams.env}`);
159
+ const cmd = `bundle exec fastlane ${t} build ${parameters.join(' ')} --env ${otherParams.env}`;
160
+ shell.exec(cmd);
176
161
  });
177
162
  }
178
163
  async run() {
179
164
  const { flags } = this.parse(Build);
180
165
  const params = await this.askForMissingFields(flags);
181
166
  const { client, target } = params, otherParams = tslib_1.__rest(params, ["client", "target"]);
182
- const parameters = utils_1.buildKeyValuePairs(otherParams);
167
+ const jsonFile = this.getJsonFile(otherParams.env);
168
+ const parameters = utils_1.buildKeyValuePairs(Object.assign(Object.assign({}, otherParams), { json_file: jsonFile }));
183
169
  shell.exec(`git reset --hard && git checkout ${params.branch} && git pull`);
184
170
  shell.cd('fastlane');
185
171
  shell.exec('bundle update --bundler');
@@ -189,18 +175,12 @@ class Build extends command_1.Command {
189
175
  shell.cd('../');
190
176
  if (client) {
191
177
  client.forEach((c) => {
192
- this.updateAppVersion(target, otherParams.env, c, otherParams.version_number);
193
- shell.exec(`git add . && git commit -m "bump version ${c} - ${otherParams.env}"`);
194
- shell.exec('git pull --rebase && git push');
195
178
  shell.cd(`fastlane/clients/${c}`);
196
- this.runPlatforms(target, parameters, otherParams);
179
+ this.runPlatforms(target, Object.assign(Object.assign({}, parameters), { client: c }), otherParams);
197
180
  shell.cd('../..');
198
181
  });
199
182
  }
200
183
  else {
201
- this.updateAppVersion(target, otherParams.env, undefined, otherParams.version_number);
202
- shell.exec(`git add . && git commit -m "bump version - ${otherParams.env}"`);
203
- shell.exec('git pull --rebase && git push');
204
184
  shell.cd('fastlane');
205
185
  this.runPlatforms(target, parameters, otherParams);
206
186
  }
@@ -1 +1 @@
1
- {"version":"0.5.16","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"}]},"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.18","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"}]},"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.16",
4
+ "version": "0.5.18",
5
5
  "author": "Tuan Luong @r0b0t3d",
6
6
  "bin": {
7
7
  "rnbuilder": "./bin/run"