@nrwl/react-native 15.9.0-beta.9 → 15.9.0-rc.0
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/executors.json +20 -0
- package/migrations.json +19 -0
- package/package.json +9 -9
- package/src/executors/build-android/build-android.impl.d.ts +2 -2
- package/src/executors/build-android/build-android.impl.js +31 -21
- package/src/executors/build-android/build-android.impl.js.map +1 -1
- package/src/executors/build-android/build-android.impl.ts +55 -28
- package/src/executors/build-android/schema.d.ts +27 -1
- package/src/executors/build-android/schema.json +79 -3
- package/src/executors/build-ios/build-ios.impl.d.ts +6 -0
- package/src/executors/build-ios/build-ios.impl.js +77 -0
- package/src/executors/build-ios/build-ios.impl.js.map +1 -0
- package/src/executors/build-ios/build-ios.impl.ts +118 -0
- package/src/executors/build-ios/compat.d.ts +2 -0
- package/src/executors/build-ios/compat.js +6 -0
- package/src/executors/build-ios/compat.js.map +1 -0
- package/src/executors/build-ios/schema.d.ts +22 -0
- package/src/executors/build-ios/schema.json +106 -0
- package/src/executors/bundle/schema.json +19 -1
- package/src/executors/pod-install/compat.d.ts +2 -0
- package/src/executors/pod-install/compat.js +6 -0
- package/src/executors/pod-install/compat.js.map +1 -0
- package/src/executors/pod-install/pod-install.impl.d.ts +6 -0
- package/src/executors/pod-install/pod-install.impl.js +15 -0
- package/src/executors/pod-install/pod-install.impl.js.map +1 -0
- package/src/executors/pod-install/pod-install.impl.ts +21 -0
- package/src/executors/pod-install/schema.d.ts +3 -0
- package/src/executors/pod-install/schema.json +18 -0
- package/src/executors/run-android/run-android.impl.js +5 -28
- package/src/executors/run-android/run-android.impl.js.map +1 -1
- package/src/executors/run-android/run-android.impl.ts +10 -27
- package/src/executors/run-android/schema.d.ts +18 -11
- package/src/executors/run-android/schema.json +59 -24
- package/src/executors/run-ios/run-ios.impl.js +7 -20
- package/src/executors/run-ios/run-ios.impl.js.map +1 -1
- package/src/executors/run-ios/run-ios.impl.ts +18 -21
- package/src/executors/run-ios/schema.d.ts +11 -13
- package/src/executors/run-ios/schema.json +61 -32
- package/src/executors/start/schema.d.ts +2 -0
- package/src/generators/application/application.spec.ts +15 -2
- package/src/generators/application/lib/add-detox.js +1 -1
- package/src/generators/application/lib/add-detox.js.map +1 -1
- package/src/generators/application/lib/add-project.js +11 -0
- package/src/generators/application/lib/add-project.js.map +1 -1
- package/src/generators/init/init.js +1 -1
- package/src/generators/init/init.js.map +1 -1
- package/src/generators/library/library.spec.ts +2 -2
- package/src/migrations/update-12-10-0/add-react-native-svg-12-10-0.spec.ts +1 -1
- package/src/migrations/update-13-5-0/add-babel-config-root-13-5-0.js +1 -0
- package/src/migrations/update-13-5-0/add-babel-config-root-13-5-0.js.map +1 -1
- package/src/migrations/update-14-0-0/add-project-root-metro-config-14-0-0.spec.ts +75 -71
- package/src/migrations/update-14-0-2/change-main-to-class-name-14-0-2.spec.ts +1 -1
- package/src/migrations/update-14-2-1/rename-blockList-metro-config.spec.ts +37 -37
- package/src/migrations/update-15-0-0/add-babel-inputs.js +2 -0
- package/src/migrations/update-15-0-0/add-babel-inputs.js.map +1 -1
- package/src/migrations/update-15-9-1/add-build-ios-target.d.ts +5 -0
- package/src/migrations/update-15-9-1/add-build-ios-target.js +34 -0
- package/src/migrations/update-15-9-1/add-build-ios-target.js.map +1 -0
- package/src/migrations/update-15-9-1/add-build-ios-target.spec.ts +36 -0
- package/src/utils/add-jest.js +1 -0
- package/src/utils/add-jest.js.map +1 -1
- package/src/utils/get-cli-options.d.ts +8 -0
- package/src/utils/get-cli-options.js +31 -0
- package/src/utils/get-cli-options.js.map +1 -0
- package/src/utils/pod-install-task.d.ts +2 -2
- package/src/utils/pod-install-task.js +12 -3
- package/src/utils/pod-install-task.js.map +1 -1
- package/src/utils/symlink-task.d.ts +1 -1
- package/src/utils/symlink-task.js +2 -2
- package/src/utils/versions.d.ts +2 -2
- package/src/utils/versions.js +2 -2
package/executors.json
CHANGED
|
@@ -20,6 +20,11 @@
|
|
|
20
20
|
"schema": "./src/executors/build-android/schema.json",
|
|
21
21
|
"description": "Release Build for Android."
|
|
22
22
|
},
|
|
23
|
+
"build-ios": {
|
|
24
|
+
"implementation": "./src/executors/build-ios/build-ios.impl",
|
|
25
|
+
"schema": "./src/executors/build-ios/schema.json",
|
|
26
|
+
"description": "Build iOS app"
|
|
27
|
+
},
|
|
23
28
|
"start": {
|
|
24
29
|
"implementation": "./src/executors/start/start.impl",
|
|
25
30
|
"schema": "./src/executors/start/schema.json",
|
|
@@ -39,6 +44,11 @@
|
|
|
39
44
|
"implementation": "./src/executors/storybook/storybook.impl",
|
|
40
45
|
"schema": "./src/executors/storybook/schema.json",
|
|
41
46
|
"description": "Serve React Native Storybook."
|
|
47
|
+
},
|
|
48
|
+
"pod-install": {
|
|
49
|
+
"implementation": "./src/executors/pod-install/pod-install.impl",
|
|
50
|
+
"schema": "./src/executors/pod-install/schema.json",
|
|
51
|
+
"description": "Run `pod install` in the `ios` directory."
|
|
42
52
|
}
|
|
43
53
|
},
|
|
44
54
|
"builders": {
|
|
@@ -62,6 +72,11 @@
|
|
|
62
72
|
"schema": "./src/executors/build-android/schema.json",
|
|
63
73
|
"description": "Release Build for Android."
|
|
64
74
|
},
|
|
75
|
+
"build-ios": {
|
|
76
|
+
"implementation": "./src/executors/build-ios/compat",
|
|
77
|
+
"schema": "./src/executors/build-ios/schema.json",
|
|
78
|
+
"description": "Build iOS app"
|
|
79
|
+
},
|
|
65
80
|
"start": {
|
|
66
81
|
"implementation": "./src/executors/start/compat",
|
|
67
82
|
"schema": "./src/executors/start/schema.json",
|
|
@@ -81,6 +96,11 @@
|
|
|
81
96
|
"implementation": "./src/executors/storybook/compat",
|
|
82
97
|
"schema": "./src/executors/storybook/schema.json",
|
|
83
98
|
"description": "Serve React Native Storybook."
|
|
99
|
+
},
|
|
100
|
+
"pod-install": {
|
|
101
|
+
"implementation": "./src/executors/pod-install/compat",
|
|
102
|
+
"schema": "./src/executors/pod-install/schema.json",
|
|
103
|
+
"description": "Run `pod install` in the `ios` directory."
|
|
84
104
|
}
|
|
85
105
|
}
|
|
86
106
|
}
|
package/migrations.json
CHANGED
|
@@ -71,6 +71,12 @@
|
|
|
71
71
|
"version": "15.0.0-beta.0",
|
|
72
72
|
"description": "Adds babel.config.json to the hash of all tasks",
|
|
73
73
|
"factory": "./src/migrations/update-15-0-0/add-babel-inputs"
|
|
74
|
+
},
|
|
75
|
+
"add-build-ios-target": {
|
|
76
|
+
"cli": "nx",
|
|
77
|
+
"version": "15.9.1-beta.0",
|
|
78
|
+
"description": "Add target build-ios and pod-install for react native apps",
|
|
79
|
+
"factory": "./src/migrations/update-15-9-1/add-build-ios-target"
|
|
74
80
|
}
|
|
75
81
|
},
|
|
76
82
|
"packageJsonUpdates": {
|
|
@@ -1261,6 +1267,19 @@
|
|
|
1261
1267
|
"alwaysAddToPackageJson": false
|
|
1262
1268
|
}
|
|
1263
1269
|
}
|
|
1270
|
+
},
|
|
1271
|
+
"15.9.1": {
|
|
1272
|
+
"version": "15.9.1-beta.0",
|
|
1273
|
+
"packages": {
|
|
1274
|
+
"@react-native-community/cli": {
|
|
1275
|
+
"version": "10.2.1",
|
|
1276
|
+
"alwaysAddToPackageJson": false
|
|
1277
|
+
},
|
|
1278
|
+
"@react-native-community/cli-platform-ios": {
|
|
1279
|
+
"version": "10.2.1",
|
|
1280
|
+
"alwaysAddToPackageJson": false
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1264
1283
|
}
|
|
1265
1284
|
}
|
|
1266
1285
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nrwl/react-native",
|
|
3
|
-
"version": "15.9.0-
|
|
3
|
+
"version": "15.9.0-rc.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Plugin for React Native contains generators for managing React Native applications and libraries within an Nx workspace. It provides: \n\n-Integration with libraries such as Jest, Detox, and Storybook.\n-Scaffolding for creating buildable libraries that can be published to npm.\n-Utilities for automatic workspace refactoring.",
|
|
6
6
|
"keywords": [
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
"main": "./index",
|
|
26
26
|
"types": "index.d.ts",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@nrwl/detox": "15.9.0-
|
|
29
|
-
"@nrwl/devkit": "15.9.0-
|
|
30
|
-
"@nrwl/jest": "15.9.0-
|
|
31
|
-
"@nrwl/js": "15.9.0-
|
|
32
|
-
"@nrwl/linter": "15.9.0-
|
|
33
|
-
"@nrwl/react": "15.9.0-
|
|
34
|
-
"@nrwl/workspace": "15.9.0-
|
|
28
|
+
"@nrwl/detox": "15.9.0-rc.0",
|
|
29
|
+
"@nrwl/devkit": "15.9.0-rc.0",
|
|
30
|
+
"@nrwl/jest": "15.9.0-rc.0",
|
|
31
|
+
"@nrwl/js": "15.9.0-rc.0",
|
|
32
|
+
"@nrwl/linter": "15.9.0-rc.0",
|
|
33
|
+
"@nrwl/react": "15.9.0-rc.0",
|
|
34
|
+
"@nrwl/workspace": "15.9.0-rc.0",
|
|
35
35
|
"chalk": "^4.1.0",
|
|
36
36
|
"enhanced-resolve": "^5.8.3",
|
|
37
37
|
"fs-extra": "^11.1.0",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"publishConfig": {
|
|
54
54
|
"access": "public"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "31ab8cc9ec171a5025b51c46dc2b6ae020d60573"
|
|
57
57
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExecutorContext } from '@nrwl/devkit';
|
|
2
|
-
import {
|
|
2
|
+
import { ReactNativeBuildAndroidOptions } from './schema';
|
|
3
3
|
export interface ReactNativeBuildOutput {
|
|
4
4
|
success: boolean;
|
|
5
5
|
}
|
|
6
|
-
export default function buildAndroidExecutor(options:
|
|
6
|
+
export default function buildAndroidExecutor(options: ReactNativeBuildAndroidOptions, context: ExecutorContext): AsyncGenerator<ReactNativeBuildOutput>;
|
|
@@ -5,14 +5,28 @@ const path_1 = require("path");
|
|
|
5
5
|
const ensure_node_modules_symlink_1 = require("../../utils/ensure-node-modules-symlink");
|
|
6
6
|
const child_process_1 = require("child_process");
|
|
7
7
|
const chmod_android_gradle_files_1 = require("../../utils/chmod-android-gradle-files");
|
|
8
|
+
const start_impl_1 = require("../start/start.impl");
|
|
9
|
+
const sync_deps_impl_1 = require("../sync-deps/sync-deps.impl");
|
|
10
|
+
const get_cli_options_1 = require("../../utils/get-cli-options");
|
|
8
11
|
let childProcess;
|
|
9
12
|
function buildAndroidExecutor(options, context) {
|
|
10
13
|
return tslib_1.__asyncGenerator(this, arguments, function* buildAndroidExecutor_1() {
|
|
11
14
|
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
12
15
|
(0, ensure_node_modules_symlink_1.ensureNodeModulesSymlink)(context.root, projectRoot);
|
|
16
|
+
if (options.sync) {
|
|
17
|
+
(0, sync_deps_impl_1.displayNewlyAddedDepsMessage)(context.projectName, yield tslib_1.__await((0, sync_deps_impl_1.syncDeps)(context.projectName, projectRoot, context.root, context.projectGraph)));
|
|
18
|
+
}
|
|
13
19
|
(0, chmod_android_gradle_files_1.chmodAndroidGradlewFiles)((0, path_1.join)(projectRoot, 'android'));
|
|
14
20
|
try {
|
|
15
|
-
|
|
21
|
+
const tasks = [runCliBuild(context.root, projectRoot, options)];
|
|
22
|
+
if (options.packager && options.mode !== 'release') {
|
|
23
|
+
tasks.push((0, start_impl_1.runCliStart)(context.root, projectRoot, {
|
|
24
|
+
port: options.port,
|
|
25
|
+
resetCache: options.resetCache,
|
|
26
|
+
interactive: options.interactive,
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
yield tslib_1.__await(Promise.all(tasks));
|
|
16
30
|
yield yield tslib_1.__await({ success: true });
|
|
17
31
|
}
|
|
18
32
|
finally {
|
|
@@ -25,10 +39,13 @@ function buildAndroidExecutor(options, context) {
|
|
|
25
39
|
exports.default = buildAndroidExecutor;
|
|
26
40
|
function runCliBuild(workspaceRoot, projectRoot, options) {
|
|
27
41
|
return new Promise((resolve, reject) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Call the react native cli with option `--no-packager`
|
|
44
|
+
* Not passing '--packager' due to cli will launch start command from the project root
|
|
45
|
+
*/
|
|
46
|
+
childProcess = (0, child_process_1.fork)((0, path_1.join)(workspaceRoot, './node_modules/react-native/cli.js'), ['run-android', ...createBuildAndroidOptions(options), '--no-packager'], {
|
|
47
|
+
cwd: (0, path_1.join)(workspaceRoot, projectRoot),
|
|
48
|
+
env: Object.assign(Object.assign({}, process.env), { RCT_METRO_PORT: options.port.toString() }),
|
|
32
49
|
});
|
|
33
50
|
// Ensure the child process is killed when the parent exits
|
|
34
51
|
process.on('exit', () => childProcess.kill());
|
|
@@ -46,21 +63,14 @@ function runCliBuild(workspaceRoot, projectRoot, options) {
|
|
|
46
63
|
});
|
|
47
64
|
});
|
|
48
65
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
if (options.debug) {
|
|
61
|
-
return 'bundleDebug';
|
|
62
|
-
}
|
|
63
|
-
return 'bundleRelease';
|
|
64
|
-
}
|
|
66
|
+
const nxOptions = ['sync', 'packager'];
|
|
67
|
+
const startOptions = ['port', 'resetCache'];
|
|
68
|
+
const deprecatedOptions = ['apk', 'debug', 'gradleTask'];
|
|
69
|
+
function createBuildAndroidOptions(options) {
|
|
70
|
+
return (0, get_cli_options_1.getCliOptions)(options, [
|
|
71
|
+
...nxOptions,
|
|
72
|
+
...startOptions,
|
|
73
|
+
...deprecatedOptions,
|
|
74
|
+
]);
|
|
65
75
|
}
|
|
66
76
|
//# sourceMappingURL=build-android.impl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-android.impl.js","sourceRoot":"","sources":["../../../../../../packages/react-native/src/executors/build-android/build-android.impl.ts"],"names":[],"mappings":";;;AACA,+BAA4B;AAC5B,yFAAmF;AACnF,
|
|
1
|
+
{"version":3,"file":"build-android.impl.js","sourceRoot":"","sources":["../../../../../../packages/react-native/src/executors/build-android/build-android.impl.ts"],"names":[],"mappings":";;;AACA,+BAA4B;AAC5B,yFAAmF;AACnF,iDAAmD;AAEnD,uFAAkF;AAClF,oDAAkD;AAClD,gEAGqC;AACrC,iEAA4D;AAM5D,IAAI,YAA0B,CAAC;AAE/B,SAA+B,oBAAoB,CACjD,OAAuC,EACvC,OAAwB;;QAExB,MAAM,WAAW,GACf,OAAO,CAAC,sBAAsB,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC;QACpE,IAAA,sDAAwB,EAAC,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QACpD,IAAI,OAAO,CAAC,IAAI,EAAE;YAChB,IAAA,6CAA4B,EAC1B,OAAO,CAAC,WAAW,EACnB,sBAAM,IAAA,yBAAQ,EACZ,OAAO,CAAC,WAAW,EACnB,WAAW,EACX,OAAO,CAAC,IAAI,EACZ,OAAO,CAAC,YAAY,CACrB,CAAA,CACF,CAAC;SACH;QAED,IAAA,qDAAwB,EAAC,IAAA,WAAI,EAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;QAEvD,IAAI;YACF,MAAM,KAAK,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;YAChE,IAAI,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE;gBAClD,KAAK,CAAC,IAAI,CACR,IAAA,wBAAW,EAAC,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE;oBACrC,IAAI,EAAE,OAAO,CAAC,IAAI;oBAClB,UAAU,EAAE,OAAO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OAAO,CAAC,IAAI,CAAC,CAAC;aACf;iBAAM;gBACL,MAAM,CAAC,IAAI,CAAC,CAAC;aACd;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AACvC,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AAC5C,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;AAEzD,SAAS,yBAAyB,CAAC,OAAuC;IACxE,OAAO,IAAA,+BAAa,EAAiC,OAAO,EAAE;QAC5D,GAAG,SAAS;QACZ,GAAG,YAAY;QACf,GAAG,iBAAiB;KACrB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import { ExecutorContext } from '@nrwl/devkit';
|
|
1
|
+
import { ExecutorContext, names } from '@nrwl/devkit';
|
|
2
2
|
import { join } from 'path';
|
|
3
3
|
import { ensureNodeModulesSymlink } from '../../utils/ensure-node-modules-symlink';
|
|
4
|
-
import { ChildProcess,
|
|
5
|
-
import {
|
|
4
|
+
import { ChildProcess, fork } from 'child_process';
|
|
5
|
+
import { ReactNativeBuildAndroidOptions } from './schema';
|
|
6
6
|
import { chmodAndroidGradlewFiles } from '../../utils/chmod-android-gradle-files';
|
|
7
|
+
import { runCliStart } from '../start/start.impl';
|
|
8
|
+
import {
|
|
9
|
+
displayNewlyAddedDepsMessage,
|
|
10
|
+
syncDeps,
|
|
11
|
+
} from '../sync-deps/sync-deps.impl';
|
|
12
|
+
import { getCliOptions } from '../../utils/get-cli-options';
|
|
13
|
+
|
|
7
14
|
export interface ReactNativeBuildOutput {
|
|
8
15
|
success: boolean;
|
|
9
16
|
}
|
|
@@ -11,16 +18,39 @@ export interface ReactNativeBuildOutput {
|
|
|
11
18
|
let childProcess: ChildProcess;
|
|
12
19
|
|
|
13
20
|
export default async function* buildAndroidExecutor(
|
|
14
|
-
options:
|
|
21
|
+
options: ReactNativeBuildAndroidOptions,
|
|
15
22
|
context: ExecutorContext
|
|
16
23
|
): AsyncGenerator<ReactNativeBuildOutput> {
|
|
17
24
|
const projectRoot =
|
|
18
25
|
context.projectsConfigurations.projects[context.projectName].root;
|
|
19
26
|
ensureNodeModulesSymlink(context.root, projectRoot);
|
|
27
|
+
if (options.sync) {
|
|
28
|
+
displayNewlyAddedDepsMessage(
|
|
29
|
+
context.projectName,
|
|
30
|
+
await syncDeps(
|
|
31
|
+
context.projectName,
|
|
32
|
+
projectRoot,
|
|
33
|
+
context.root,
|
|
34
|
+
context.projectGraph
|
|
35
|
+
)
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
20
39
|
chmodAndroidGradlewFiles(join(projectRoot, 'android'));
|
|
21
40
|
|
|
22
41
|
try {
|
|
23
|
-
|
|
42
|
+
const tasks = [runCliBuild(context.root, projectRoot, options)];
|
|
43
|
+
if (options.packager && options.mode !== 'release') {
|
|
44
|
+
tasks.push(
|
|
45
|
+
runCliStart(context.root, projectRoot, {
|
|
46
|
+
port: options.port,
|
|
47
|
+
resetCache: options.resetCache,
|
|
48
|
+
interactive: options.interactive,
|
|
49
|
+
})
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
await Promise.all(tasks);
|
|
24
54
|
yield { success: true };
|
|
25
55
|
} finally {
|
|
26
56
|
if (childProcess) {
|
|
@@ -32,17 +62,19 @@ export default async function* buildAndroidExecutor(
|
|
|
32
62
|
function runCliBuild(
|
|
33
63
|
workspaceRoot: string,
|
|
34
64
|
projectRoot: string,
|
|
35
|
-
options:
|
|
65
|
+
options: ReactNativeBuildAndroidOptions
|
|
36
66
|
) {
|
|
37
67
|
return new Promise((resolve, reject) => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Call the react native cli with option `--no-packager`
|
|
70
|
+
* Not passing '--packager' due to cli will launch start command from the project root
|
|
71
|
+
*/
|
|
72
|
+
childProcess = fork(
|
|
73
|
+
join(workspaceRoot, './node_modules/react-native/cli.js'),
|
|
74
|
+
['run-android', ...createBuildAndroidOptions(options), '--no-packager'],
|
|
43
75
|
{
|
|
44
|
-
cwd: join(workspaceRoot, projectRoot
|
|
45
|
-
|
|
76
|
+
cwd: join(workspaceRoot, projectRoot),
|
|
77
|
+
env: { ...process.env, RCT_METRO_PORT: options.port.toString() },
|
|
46
78
|
}
|
|
47
79
|
);
|
|
48
80
|
|
|
@@ -63,19 +95,14 @@ function runCliBuild(
|
|
|
63
95
|
});
|
|
64
96
|
}
|
|
65
97
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (options.debug) {
|
|
77
|
-
return 'bundleDebug';
|
|
78
|
-
}
|
|
79
|
-
return 'bundleRelease';
|
|
80
|
-
}
|
|
98
|
+
const nxOptions = ['sync', 'packager'];
|
|
99
|
+
const startOptions = ['port', 'resetCache'];
|
|
100
|
+
const deprecatedOptions = ['apk', 'debug', 'gradleTask'];
|
|
101
|
+
|
|
102
|
+
function createBuildAndroidOptions(options: ReactNativeBuildAndroidOptions) {
|
|
103
|
+
return getCliOptions<ReactNativeBuildAndroidOptions>(options, [
|
|
104
|
+
...nxOptions,
|
|
105
|
+
...startOptions,
|
|
106
|
+
...deprecatedOptions,
|
|
107
|
+
]);
|
|
81
108
|
}
|
|
@@ -1,5 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
// options taken from https://github.com/react-native-community/cli/blob/main/packages/cli-platform-android/src/commands/buildAndroid/index.ts
|
|
2
|
+
|
|
3
|
+
import { ReactNativeStartOptions } from '../start/schema';
|
|
4
|
+
|
|
5
|
+
export interface ReactNativeBuildAndroidOptions
|
|
6
|
+
extends ReactNativeStartOptions {
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated, use tasks instead. e.g. tasks=['bundleRelease'] for aab, and tasks=['assembleRelease'] for apk. Will be removed in nx 17.
|
|
9
|
+
*/
|
|
2
10
|
apk?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated, use mode='debug' instead. Will be removed in nx 17.
|
|
13
|
+
*/
|
|
3
14
|
debug?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated, use tasks instead instead. Will be removed in nx 17.
|
|
17
|
+
*/
|
|
4
18
|
gradleTask?: string;
|
|
19
|
+
|
|
20
|
+
// react native options
|
|
21
|
+
mode: string; // default is debug
|
|
22
|
+
activeArchOnly: boolean; // default is false
|
|
23
|
+
port: number; // default is 8081
|
|
24
|
+
tasks?: Array<string>;
|
|
25
|
+
extraParams?: Array<string>;
|
|
26
|
+
interactive?: boolean;
|
|
27
|
+
|
|
28
|
+
// nx options
|
|
29
|
+
packager: boolean; // default is true
|
|
30
|
+
sync: boolean;
|
|
5
31
|
}
|
|
@@ -7,18 +7,94 @@
|
|
|
7
7
|
"title": "Release Build for Android",
|
|
8
8
|
"description": "Build target options for Android.",
|
|
9
9
|
"type": "object",
|
|
10
|
+
"presets": [
|
|
11
|
+
{
|
|
12
|
+
"name": "Build Android for current device architecture",
|
|
13
|
+
"keys": ["activeArchOnly"]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"name": "Build Android without metro cache",
|
|
17
|
+
"keys": ["resetCache"]
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"name": "Build Android with specific tasks",
|
|
21
|
+
"keys": ["tasks"]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "Build Android with a specific mode",
|
|
25
|
+
"keys": ["mode"]
|
|
26
|
+
}
|
|
27
|
+
],
|
|
10
28
|
"properties": {
|
|
11
29
|
"apk": {
|
|
12
30
|
"type": "boolean",
|
|
13
|
-
"description": "Generate apk file(s) rather than a bundle (`.aab`)."
|
|
31
|
+
"description": "Generate apk file(s) rather than a bundle (`.aab`).",
|
|
32
|
+
"x-deprecated": "Use `tasks` option instead, e.g. `tasks=['bundleRelease']` to generate aab, `tasks=['assembleDebug']` to generate apk. Will be removed in Nx 17."
|
|
14
33
|
},
|
|
15
34
|
"debug": {
|
|
16
35
|
"type": "boolean",
|
|
17
|
-
"description": "Generate a debug build instead of a release build."
|
|
36
|
+
"description": "Generate a debug build instead of a release build.",
|
|
37
|
+
"x-deprecated": "Use `mode` option instead, e.g. `mode='debug'`. Deprecated from @react-native-community/cli. Will be removed in Nx 17."
|
|
18
38
|
},
|
|
19
39
|
"gradleTask": {
|
|
20
40
|
"type": "string",
|
|
21
|
-
"description": "Override default gradle task incase of multi build variants"
|
|
41
|
+
"description": "Override default gradle task incase of multi build variants",
|
|
42
|
+
"x-deprecated": "Use `tasks` option instead, e.g. `tasks=['assembleDebug']`. Will be removed in Nx 17."
|
|
43
|
+
},
|
|
44
|
+
"mode": {
|
|
45
|
+
"type": "string",
|
|
46
|
+
"description": "Specify your app's build variant",
|
|
47
|
+
"default": "debug",
|
|
48
|
+
"examples": ["debug", "release"],
|
|
49
|
+
"x-priority": "important"
|
|
50
|
+
},
|
|
51
|
+
"packager": {
|
|
52
|
+
"type": "boolean",
|
|
53
|
+
"description": "Launch packager while building",
|
|
54
|
+
"default": true
|
|
55
|
+
},
|
|
56
|
+
"port": {
|
|
57
|
+
"type": "number",
|
|
58
|
+
"description": "The port where the packager server is listening on.",
|
|
59
|
+
"default": 8081
|
|
60
|
+
},
|
|
61
|
+
"tasks": {
|
|
62
|
+
"type": "array",
|
|
63
|
+
"items": {
|
|
64
|
+
"type": "string"
|
|
65
|
+
},
|
|
66
|
+
"description": "Run custom Gradle tasks. By default it's \"assembleDebug\". Will override passed mode and variant arguments.",
|
|
67
|
+
"examples": [
|
|
68
|
+
"assembleDebug",
|
|
69
|
+
"assembleRelease",
|
|
70
|
+
"bundleDebug",
|
|
71
|
+
"bundleRelease",
|
|
72
|
+
"installDebug",
|
|
73
|
+
"installRelease"
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
"activeArchOnly": {
|
|
77
|
+
"type": "boolean",
|
|
78
|
+
"description": "Build native libraries only for the current device architecture for debug builds.",
|
|
79
|
+
"default": false
|
|
80
|
+
},
|
|
81
|
+
"extraParams": {
|
|
82
|
+
"type": "string",
|
|
83
|
+
"description": "Custom params passed to gradle build command"
|
|
84
|
+
},
|
|
85
|
+
"interactive": {
|
|
86
|
+
"type": "boolean",
|
|
87
|
+
"description": "Explicitly select build type and flavour to use before running a build"
|
|
88
|
+
},
|
|
89
|
+
"sync": {
|
|
90
|
+
"type": "boolean",
|
|
91
|
+
"description": "Syncs npm dependencies to `package.json` (for React Native autolink).",
|
|
92
|
+
"default": true
|
|
93
|
+
},
|
|
94
|
+
"resetCache": {
|
|
95
|
+
"type": "boolean",
|
|
96
|
+
"description": "Resets metro cache.",
|
|
97
|
+
"default": false
|
|
22
98
|
}
|
|
23
99
|
},
|
|
24
100
|
"required": [],
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ExecutorContext } from '@nrwl/devkit';
|
|
2
|
+
import { ReactNativeBuildIosOptions } from './schema';
|
|
3
|
+
export interface ReactNativeBuildIosOutput {
|
|
4
|
+
success: boolean;
|
|
5
|
+
}
|
|
6
|
+
export default function runIosExecutor(options: ReactNativeBuildIosOptions, context: ExecutorContext): AsyncGenerator<ReactNativeBuildIosOutput>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const child_process_1 = require("child_process");
|
|
6
|
+
const os_1 = require("os");
|
|
7
|
+
const ensure_node_modules_symlink_1 = require("../../utils/ensure-node-modules-symlink");
|
|
8
|
+
const sync_deps_impl_1 = require("../sync-deps/sync-deps.impl");
|
|
9
|
+
const pod_install_task_1 = require("../../utils/pod-install-task");
|
|
10
|
+
const start_impl_1 = require("../start/start.impl");
|
|
11
|
+
const get_cli_options_1 = require("../../utils/get-cli-options");
|
|
12
|
+
let childProcess;
|
|
13
|
+
function runIosExecutor(options, context) {
|
|
14
|
+
return tslib_1.__asyncGenerator(this, arguments, function* runIosExecutor_1() {
|
|
15
|
+
if ((0, os_1.platform)() !== 'darwin') {
|
|
16
|
+
throw new Error(`The run-ios build requires Mac to run`);
|
|
17
|
+
}
|
|
18
|
+
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
19
|
+
(0, ensure_node_modules_symlink_1.ensureNodeModulesSymlink)(context.root, projectRoot);
|
|
20
|
+
if (options.sync) {
|
|
21
|
+
(0, sync_deps_impl_1.displayNewlyAddedDepsMessage)(context.projectName, yield tslib_1.__await((0, sync_deps_impl_1.syncDeps)(context.projectName, projectRoot, context.root, context.projectGraph)));
|
|
22
|
+
}
|
|
23
|
+
if (options.install) {
|
|
24
|
+
yield tslib_1.__await((0, pod_install_task_1.podInstall)((0, path_1.join)(context.root, projectRoot, 'ios'), options.buildFolder));
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
const tasks = [runCliBuildIOS(context.root, projectRoot, options)];
|
|
28
|
+
if (options.packager && options.mode !== 'Release') {
|
|
29
|
+
tasks.push((0, start_impl_1.runCliStart)(context.root, projectRoot, {
|
|
30
|
+
port: options.port,
|
|
31
|
+
resetCache: options.resetCache,
|
|
32
|
+
interactive: options.interactive,
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
yield tslib_1.__await(Promise.all(tasks));
|
|
36
|
+
yield yield tslib_1.__await({ success: true });
|
|
37
|
+
}
|
|
38
|
+
finally {
|
|
39
|
+
if (childProcess) {
|
|
40
|
+
childProcess.kill();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
exports.default = runIosExecutor;
|
|
46
|
+
function runCliBuildIOS(workspaceRoot, projectRoot, options) {
|
|
47
|
+
return new Promise((resolve, reject) => {
|
|
48
|
+
/**
|
|
49
|
+
* Call the react native cli with option `--no-packager`
|
|
50
|
+
* Not passing '--packager' due to cli will launch start command from the project root
|
|
51
|
+
*/
|
|
52
|
+
childProcess = (0, child_process_1.fork)((0, path_1.join)(workspaceRoot, './node_modules/react-native/cli.js'), ['run-ios', ...createBuildIOSOptions(options), '--no-packager'], {
|
|
53
|
+
cwd: (0, path_1.join)(workspaceRoot, projectRoot),
|
|
54
|
+
env: Object.assign(Object.assign({}, process.env), { RCT_METRO_PORT: options.port.toString() }),
|
|
55
|
+
});
|
|
56
|
+
// Ensure the child process is killed when the parent exits
|
|
57
|
+
process.on('exit', () => childProcess.kill());
|
|
58
|
+
process.on('SIGTERM', () => childProcess.kill());
|
|
59
|
+
childProcess.on('error', (err) => {
|
|
60
|
+
reject(err);
|
|
61
|
+
});
|
|
62
|
+
childProcess.on('exit', (code) => {
|
|
63
|
+
if (code === 0) {
|
|
64
|
+
resolve(code);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
reject(code);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
const nxOptions = ['sync', 'install', 'packager'];
|
|
73
|
+
const startOptions = ['port', 'resetCache'];
|
|
74
|
+
function createBuildIOSOptions(options) {
|
|
75
|
+
return (0, get_cli_options_1.getCliOptions)(options, [...nxOptions, ...startOptions], ['buildFolder']);
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=build-ios.impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-ios.impl.js","sourceRoot":"","sources":["../../../../../../packages/react-native/src/executors/build-ios/build-ios.impl.ts"],"names":[],"mappings":";;;AACA,+BAA4B;AAC5B,iDAAmD;AACnD,2BAA8B;AAE9B,yFAAmF;AACnF,gEAGqC;AACrC,mEAA0D;AAE1D,oDAAkD;AAClD,iEAA4D;AAM5D,IAAI,YAA0B,CA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