rnbuilder 0.5.7 → 0.5.10

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.7 darwin-arm64 node-v16.13.0
23
+ rnbuilder/0.5.10 darwin-arm64 node-v16.13.0
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.7/src/commands/build.ts)_
61
+ _See code: [src/commands/build.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.5.10/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.7/src/commands/codepush.ts)_
80
+ _See code: [src/commands/codepush.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.5.10/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.7/src/commands/initialize.ts)_
112
+ _See code: [src/commands/initialize.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.5.10/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.7/src/commands/match-nuke.ts)_
131
+ _See code: [src/commands/match-nuke.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.5.10/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.7/src/commands/sync-udids.ts)_
150
+ _See code: [src/commands/sync-udids.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.5.10/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[], client?: string, versionNumber?: string): void;
18
+ updateAppVersion(targets: string[], env: string, client?: string, versionNumber?: string): void;
19
19
  runPlatforms(target: string[], parameters: any, otherParams: any): void;
20
20
  run(): Promise<void>;
21
21
  }
@@ -12,7 +12,7 @@ class Build extends command_1.Command {
12
12
  constructor() {
13
13
  super(...arguments);
14
14
  this.askForMissingFields = async (flags) => {
15
- const questions = [];
15
+ let questions = [];
16
16
  if (!flags.client) {
17
17
  const clients = utils_1.getDirectories('./fastlane/clients');
18
18
  if (clients.length > 0) {
@@ -65,8 +65,23 @@ class Build extends command_1.Command {
65
65
  if (result.branch) {
66
66
  shell.exec(`git checkout ${result.branch} && git pull --rebase`);
67
67
  }
68
+ questions = [];
69
+ if (result.env === 'prod') {
70
+ questions.push({
71
+ type: 'list',
72
+ name: 'distribute',
73
+ message: 'What would you like to distribute to?',
74
+ default: 'store',
75
+ choices: ['store', 'firebase'],
76
+ filter(val) {
77
+ return val.toLowerCase();
78
+ },
79
+ });
80
+ const answers = await inquirer.prompt(questions);
81
+ result = Object.assign(Object.assign({}, result), answers);
82
+ }
68
83
  const postQuestions = [];
69
- if (result.env !== 'prod') {
84
+ if (result.env !== 'prod' || result.distribute === 'firebase') {
70
85
  postQuestions.push({
71
86
  type: 'confirm',
72
87
  name: 'firebase',
@@ -83,7 +98,7 @@ class Build extends command_1.Command {
83
98
  }
84
99
  }
85
100
  else {
86
- const appVersion = utils_1.getAppVersion(result.client, result.target);
101
+ const appVersion = utils_1.getAppVersion(result.env, result.client, result.target);
87
102
  postQuestions.push({
88
103
  type: 'input',
89
104
  name: 'version_number',
@@ -136,10 +151,14 @@ class Build extends command_1.Command {
136
151
  return result;
137
152
  };
138
153
  }
139
- updateAppVersion(targets, client, versionNumber) {
140
- const appVersions = require(process.cwd() + '/app.json');
154
+ updateAppVersion(targets, env, client, versionNumber) {
155
+ let fileName = 'app';
156
+ if (env !== 'prod') {
157
+ fileName = `${fileName}.${env}`;
158
+ }
159
+ const appVersions = require(process.cwd() + `/${fileName}.json`);
141
160
  targets.forEach((t) => {
142
- const appVersion = utils_1.getAppVersion(client, t);
161
+ const appVersion = utils_1.getAppVersion(env, client, t);
143
162
  const newVersion = Object.assign(Object.assign({}, appVersion), { build: appVersion.build + 1, buildDate: new Date().toDateString() });
144
163
  if (versionNumber) {
145
164
  newVersion.version = versionNumber;
@@ -152,7 +171,7 @@ class Build extends command_1.Command {
152
171
  }
153
172
  });
154
173
  const json = JSON.stringify(appVersions, null, 2);
155
- fs.writeFileSync(process.cwd() + '/app.json', json);
174
+ fs.writeFileSync(process.cwd() + `/${fileName}.json`, json);
156
175
  }
157
176
  runPlatforms(target, parameters, otherParams) {
158
177
  target.forEach((t) => {
@@ -166,11 +185,11 @@ class Build extends command_1.Command {
166
185
  const parameters = utils_1.buildKeyValuePairs(otherParams);
167
186
  if (client) {
168
187
  client.forEach((c) => {
169
- this.updateAppVersion(target, c, otherParams.version_number);
188
+ this.updateAppVersion(target, otherParams.env, c, otherParams.version_number);
170
189
  });
171
190
  }
172
191
  else {
173
- this.updateAppVersion(target, undefined, otherParams.version_number);
192
+ this.updateAppVersion(target, otherParams.env, undefined, otherParams.version_number);
174
193
  }
175
194
  shell.exec('git add . && git commit -m "bump version" && git push');
176
195
  shell.cd('fastlane');
@@ -58,7 +58,7 @@ class CodePush extends command_1.Command {
58
58
  if (client) {
59
59
  envPath += `/clients/${client}/fastlane`;
60
60
  }
61
- const appVersion = utils_1.getAppVersion(client, target);
61
+ const appVersion = utils_1.getAppVersion(env, client, target);
62
62
  require('dotenv').config({ path: process.cwd() + '/' + envPath + '/.env' });
63
63
  const project = target === 'ios' ? process.env.CODE_PUSH_IOS_PROJECT : process.env.CODE_PUSH_ANDROID_PROJECT;
64
64
  shell.exec(`appcenter codepush release-react -a ${project} -d ${env === 'staging' ? 'Staging' : 'Production'} --target-binary-version ${appVersion.version} --token ${process.env.CODE_PUSH_TOKEN}`);
package/lib/utils.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export declare const buildKeyValuePairs: (params: any) => string[];
2
2
  export declare const getDirectories: (path: string) => string[];
3
- export declare const getAppVersion: (client?: string | undefined, target?: string) => {
3
+ export declare const getAppVersion: (env: string, client?: string | undefined, target?: string) => {
4
4
  version: string;
5
5
  build: number;
6
6
  };
package/lib/utils.js CHANGED
@@ -16,8 +16,12 @@ const defaultVersion = {
16
16
  version: '0.0.1',
17
17
  build: 1,
18
18
  };
19
- exports.getAppVersion = (client, target = 'ios') => {
20
- const appVersions = require(process.cwd() + '/app.json');
19
+ exports.getAppVersion = (env, client, target = 'ios') => {
20
+ let fileName = 'app';
21
+ if (env !== 'prod') {
22
+ fileName = `${fileName}.${env}`;
23
+ }
24
+ const appVersions = require(process.cwd() + `/${fileName}.json`);
21
25
  let version = defaultVersion;
22
26
  if (client) {
23
27
  const clientVersion = appVersions[client];
@@ -1 +1 @@
1
- {"version":"0.5.7","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.10","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.7",
4
+ "version": "0.5.10",
5
5
  "author": "Tuan Luong @r0b0t3d",
6
6
  "bin": {
7
7
  "rnbuilder": "./bin/run"