rnbuilder 0.4.1 → 0.4.5

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.4.1 darwin-x64 node-v12.22.4
23
+ rnbuilder/0.4.5 darwin-x64 node-v12.22.4
24
24
  $ rnbuilder --help [COMMAND]
25
25
  USAGE
26
26
  $ rnbuilder COMMAND
@@ -32,6 +32,7 @@ USAGE
32
32
  * [`rnbuilder build [BUILD]`](#rnbuilder-build-build)
33
33
  * [`rnbuilder help [COMMAND]`](#rnbuilder-help-command)
34
34
  * [`rnbuilder initialize`](#rnbuilder-initialize)
35
+ * [`rnbuilder sync-udids [BUILD]`](#rnbuilder-sync-udids-build)
35
36
 
36
37
  ## `rnbuilder build [BUILD]`
37
38
 
@@ -55,7 +56,7 @@ EXAMPLE
55
56
  hello world from ./src/build.ts!
56
57
  ```
57
58
 
58
- _See code: [src/commands/build.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.4.1/src/commands/build.ts)_
59
+ _See code: [src/commands/build.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.4.5/src/commands/build.ts)_
59
60
 
60
61
  ## `rnbuilder help [COMMAND]`
61
62
 
@@ -87,5 +88,24 @@ EXAMPLE
87
88
  initialize environment for first run from ./src/initialize.ts!
88
89
  ```
89
90
 
90
- _See code: [src/commands/initialize.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.4.1/src/commands/initialize.ts)_
91
+ _See code: [src/commands/initialize.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.4.5/src/commands/initialize.ts)_
92
+
93
+ ## `rnbuilder sync-udids [BUILD]`
94
+
95
+ Sync device UDIDs from firebase
96
+
97
+ ```
98
+ USAGE
99
+ $ rnbuilder sync-udids [BUILD]
100
+
101
+ OPTIONS
102
+ -c, --client=client Select client that you want to sync udids
103
+ -h, --help show CLI help
104
+
105
+ EXAMPLE
106
+ $ rnbuilder sync-udids
107
+ Sync device UDIDs from firebase from ./src/firebase-sync-udids.ts!
108
+ ```
109
+
110
+ _See code: [src/commands/sync-udids.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.4.5/src/commands/sync-udids.ts)_
91
111
  <!-- commandsstop -->
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
+ /* eslint-disable complexity */
4
5
  /* eslint-disable no-negated-condition */
5
6
  const command_1 = require("@oclif/command");
6
7
  const inquirer = require("inquirer");
@@ -61,6 +62,9 @@ class Build extends command_1.Command {
61
62
  const answers = await inquirer.prompt(questions);
62
63
  result = Object.assign(Object.assign({}, flags), answers);
63
64
  }
65
+ if (result.branch) {
66
+ shell.exec(`git checkout ${result.branch} && git pull --rebase`);
67
+ }
64
68
  const postQuestions = [];
65
69
  if (result.env !== 'prod') {
66
70
  let envPath = 'fastlane';
@@ -104,13 +108,36 @@ class Build extends command_1.Command {
104
108
  const answers = await inquirer.prompt(postQuestions);
105
109
  result = Object.assign(Object.assign({}, result), answers);
106
110
  if (result.installr || result.firebase) {
107
- const testersAnswers = await inquirer.prompt([{
108
- type: 'input',
111
+ const testersAnswer = await inquirer.prompt([{
112
+ type: 'expand',
109
113
  name: 'testers',
110
- message: 'Add tester(s)to download the app',
111
- suffix: ' (emails separated by commas)',
114
+ message: 'Add testers to download the app?',
115
+ choices: [{
116
+ key: 'g',
117
+ name: 'Test groups',
118
+ value: 'groups',
119
+ }, {
120
+ key: 't',
121
+ name: 'Tester emails',
122
+ value: 'testers',
123
+ }, {
124
+ key: 'n',
125
+ name: 'No',
126
+ value: 'no-tester',
127
+ }],
128
+ default: 'no-tester',
112
129
  }]);
113
- result = Object.assign(Object.assign({}, result), { testers: testersAnswers.testers.replace(/\s+/g, '') });
130
+ if (testersAnswer.testers) {
131
+ if (testersAnswer.testers !== 'no-tester') {
132
+ const answers = await inquirer.prompt([{
133
+ type: 'input',
134
+ name: 'testers',
135
+ message: 'Please enter tester ' + (testersAnswer.testers === 'groups' ? 'group(s)' : 'email(s)'),
136
+ suffix: ' (separated by commas)',
137
+ }]);
138
+ result = Object.assign(Object.assign({}, result), { [testersAnswer.testers]: answers.testers });
139
+ }
140
+ }
114
141
  }
115
142
  const appVersion = utils_1.getAppVersion(result.client, result.target);
116
143
  const newVersion = Object.assign(Object.assign({}, appVersion), { build: appVersion.build + 1, buildDate: new Date().toDateString() });
@@ -126,6 +153,7 @@ class Build extends command_1.Command {
126
153
  }
127
154
  const json = JSON.stringify(appVersions, null, 2);
128
155
  fs.writeFileSync(process.cwd() + '/app.json', json);
156
+ shell.exec('git add . && git commit -m "bump version"');
129
157
  }
130
158
  return result;
131
159
  };
@@ -133,9 +161,8 @@ class Build extends command_1.Command {
133
161
  async run() {
134
162
  const { flags } = this.parse(Build);
135
163
  const params = await this.askForMissingFields(flags);
136
- const { client, target, branch } = params, otherParams = tslib_1.__rest(params, ["client", "target", "branch"]);
164
+ const { client, target } = params, otherParams = tslib_1.__rest(params, ["client", "target"]);
137
165
  const parameters = utils_1.buildKeyValuePairs(otherParams);
138
- shell.exec(`git checkout ${branch} && git pull`);
139
166
  shell.cd('fastlane');
140
167
  shell.exec('bundle update --bundler');
141
168
  shell.exec('bundle install');
@@ -0,0 +1,14 @@
1
+ import { Command, flags } from '@oclif/command';
2
+ export default class FirebaseSyncUDIDs 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
+ };
9
+ static args: {
10
+ name: string;
11
+ }[];
12
+ askForMissingFields: (flags: any) => Promise<any>;
13
+ run(): Promise<void>;
14
+ }
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /* eslint-disable no-negated-condition */
4
+ const command_1 = require("@oclif/command");
5
+ const shell = require("shelljs");
6
+ const inquirer = require("inquirer");
7
+ const utils_1 = require("../utils");
8
+ class FirebaseSyncUDIDs extends command_1.Command {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.askForMissingFields = async (flags) => {
12
+ const questions = [];
13
+ if (!flags.client) {
14
+ const clients = utils_1.getDirectories('./fastlane/clients');
15
+ if (clients.length > 0) {
16
+ questions.push({
17
+ type: 'list',
18
+ name: 'client',
19
+ message: 'What is the client?',
20
+ choices: clients,
21
+ });
22
+ }
23
+ }
24
+ let result = flags;
25
+ if (questions.length > 0) {
26
+ const answers = await inquirer.prompt(questions);
27
+ result = Object.assign(Object.assign({}, flags), answers);
28
+ }
29
+ return result;
30
+ };
31
+ }
32
+ async run() {
33
+ const { flags } = this.parse(FirebaseSyncUDIDs);
34
+ const params = await this.askForMissingFields(flags);
35
+ const { client } = params;
36
+ shell.cd('fastlane');
37
+ shell.exec('bundle install');
38
+ if (client) {
39
+ shell.cd(`clients/${client}`);
40
+ }
41
+ shell.exec('bundle exec fastlane sync_udids');
42
+ }
43
+ }
44
+ exports.default = FirebaseSyncUDIDs;
45
+ FirebaseSyncUDIDs.description = 'Sync device UDIDs from firebase';
46
+ FirebaseSyncUDIDs.examples = [
47
+ `$ rnbuilder sync-udids
48
+ Sync device UDIDs from firebase from ./src/firebase-sync-udids.ts!
49
+ `,
50
+ ];
51
+ FirebaseSyncUDIDs.flags = {
52
+ help: command_1.flags.help({ char: 'h' }),
53
+ client: command_1.flags.string({ char: 'c', description: 'Select client that you want to sync udids' }),
54
+ };
55
+ FirebaseSyncUDIDs.args = [{ name: 'build' }];
@@ -1 +1 @@
1
- {"version":"0.4.1","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"}]},"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":[]}}}
1
+ {"version":"0.4.5","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"}]},"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":[]},"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.4.1",
4
+ "version": "0.4.5",
5
5
  "author": "Tuan Luong @r0b0t3d",
6
6
  "bin": {
7
7
  "rnbuilder": "./bin/run"