rnbuilder 0.4.4 → 0.4.8

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.4 darwin-x64 node-v12.22.4
23
+ rnbuilder/0.4.8 darwin-x64 node-v12.22.4
24
24
  $ rnbuilder --help [COMMAND]
25
25
  USAGE
26
26
  $ rnbuilder COMMAND
@@ -30,6 +30,7 @@ USAGE
30
30
  # Commands
31
31
  <!-- commands -->
32
32
  * [`rnbuilder build [BUILD]`](#rnbuilder-build-build)
33
+ * [`rnbuilder codepush [BUILD]`](#rnbuilder-codepush-build)
33
34
  * [`rnbuilder help [COMMAND]`](#rnbuilder-help-command)
34
35
  * [`rnbuilder initialize`](#rnbuilder-initialize)
35
36
  * [`rnbuilder sync-udids [BUILD]`](#rnbuilder-sync-udids-build)
@@ -56,7 +57,26 @@ EXAMPLE
56
57
  hello world from ./src/build.ts!
57
58
  ```
58
59
 
59
- _See code: [src/commands/build.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.4.4/src/commands/build.ts)_
60
+ _See code: [src/commands/build.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.4.8/src/commands/build.ts)_
61
+
62
+ ## `rnbuilder codepush [BUILD]`
63
+
64
+ Push changes to existing apps
65
+
66
+ ```
67
+ USAGE
68
+ $ rnbuilder codepush [BUILD]
69
+
70
+ OPTIONS
71
+ -c, --client=client Select client that you want to push update
72
+ -h, --help show CLI help
73
+
74
+ EXAMPLE
75
+ $ rnbuilder codepush
76
+ Push changes to existing apps ./src/firebase-sync-udids.ts!
77
+ ```
78
+
79
+ _See code: [src/commands/codepush.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.4.8/src/commands/codepush.ts)_
60
80
 
61
81
  ## `rnbuilder help [COMMAND]`
62
82
 
@@ -88,7 +108,7 @@ EXAMPLE
88
108
  initialize environment for first run from ./src/initialize.ts!
89
109
  ```
90
110
 
91
- _See code: [src/commands/initialize.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.4.4/src/commands/initialize.ts)_
111
+ _See code: [src/commands/initialize.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.4.8/src/commands/initialize.ts)_
92
112
 
93
113
  ## `rnbuilder sync-udids [BUILD]`
94
114
 
@@ -107,5 +127,5 @@ EXAMPLE
107
127
  Sync device UDIDs from firebase from ./src/firebase-sync-udids.ts!
108
128
  ```
109
129
 
110
- _See code: [src/commands/sync-udids.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.4.4/src/commands/sync-udids.ts)_
130
+ _See code: [src/commands/sync-udids.ts](https://github.com/r0b0t3d/rnbuilder/blob/v0.4.8/src/commands/sync-udids.ts)_
111
131
  <!-- commandsstop -->
@@ -17,7 +17,7 @@ class Build extends command_1.Command {
17
17
  const clients = utils_1.getDirectories('./fastlane/clients');
18
18
  if (clients.length > 0) {
19
19
  questions.push({
20
- type: 'list',
20
+ type: 'rawlist',
21
21
  name: 'client',
22
22
  message: 'What is the client?',
23
23
  choices: clients,
@@ -63,7 +63,7 @@ class Build extends command_1.Command {
63
63
  result = Object.assign(Object.assign({}, flags), answers);
64
64
  }
65
65
  if (result.branch) {
66
- shell.exec(`git checkout ${result.branch} && git pull`);
66
+ shell.exec(`git checkout ${result.branch} && git pull --rebase`);
67
67
  }
68
68
  const postQuestions = [];
69
69
  if (result.env !== 'prod') {
@@ -153,7 +153,7 @@ class Build extends command_1.Command {
153
153
  }
154
154
  const json = JSON.stringify(appVersions, null, 2);
155
155
  fs.writeFileSync(process.cwd() + '/app.json', json);
156
- shell.exec('git add . && git commit -m "bump version"');
156
+ shell.exec('git add . && git commit -m "bump version" && git push');
157
157
  }
158
158
  return result;
159
159
  };
@@ -0,0 +1,14 @@
1
+ import { Command, flags } from '@oclif/command';
2
+ export default class CodePush 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,78 @@
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 CodePush 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
+ if (!flags.env) {
25
+ questions.push({
26
+ type: 'list',
27
+ name: 'env',
28
+ message: 'What is the environment?',
29
+ default: 'staging',
30
+ choices: ['staging', 'prod'],
31
+ filter(val) {
32
+ return val.toLowerCase();
33
+ },
34
+ });
35
+ }
36
+ if (!flags.target) {
37
+ questions.push({
38
+ type: 'list',
39
+ name: 'target',
40
+ message: 'What is the platform?',
41
+ // default: 'both',
42
+ choices: ['android', 'ios'],
43
+ });
44
+ }
45
+ let result = flags;
46
+ if (questions.length > 0) {
47
+ const answers = await inquirer.prompt(questions);
48
+ result = Object.assign(Object.assign({}, flags), answers);
49
+ }
50
+ return result;
51
+ };
52
+ }
53
+ async run() {
54
+ const { flags } = this.parse(CodePush);
55
+ const params = await this.askForMissingFields(flags);
56
+ const { client, target, env } = params;
57
+ let envPath = 'fastlane';
58
+ if (client) {
59
+ envPath += `/clients/${client}/fastlane`;
60
+ }
61
+ const appVersion = utils_1.getAppVersion(client, target);
62
+ require('dotenv').config({ path: process.cwd() + '/' + envPath + '/.env' });
63
+ const project = target === 'ios' ? process.env.CODE_PUSH_IOS_PROJECT : process.env.CODE_PUSH_ANDROID_PROJECT;
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}`);
65
+ }
66
+ }
67
+ exports.default = CodePush;
68
+ CodePush.description = 'Push changes to existing apps';
69
+ CodePush.examples = [
70
+ `$ rnbuilder codepush
71
+ Push changes to existing apps ./src/firebase-sync-udids.ts!
72
+ `,
73
+ ];
74
+ CodePush.flags = {
75
+ help: command_1.flags.help({ char: 'h' }),
76
+ client: command_1.flags.string({ char: 'c', description: 'Select client that you want to push update' }),
77
+ };
78
+ CodePush.args = [{ name: 'build' }];
@@ -1 +1 @@
1
- {"version":"0.4.4","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"}]}}}
1
+ {"version":"0.4.8","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":[]},"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.4",
4
+ "version": "0.4.8",
5
5
  "author": "Tuan Luong @r0b0t3d",
6
6
  "bin": {
7
7
  "rnbuilder": "./bin/run"