@nx/react-native 0.0.0-pr-22179-271588f
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/.eslintrc.json +48 -0
- package/LICENSE +22 -0
- package/README.md +68 -0
- package/executors.json +59 -0
- package/generators.json +58 -0
- package/index.d.ts +5 -0
- package/index.js +13 -0
- package/migrations.json +632 -0
- package/package.json +57 -0
- package/plugin.d.ts +1 -0
- package/plugin.js +6 -0
- package/plugins/jest/svg-mock.d.ts +0 -0
- package/plugins/jest/svg-mock.js +3 -0
- package/plugins/metro-resolver.d.ts +1 -0
- package/plugins/metro-resolver.js +136 -0
- package/plugins/plugin.d.ts +14 -0
- package/plugins/plugin.js +162 -0
- package/plugins/with-nx-metro.d.ts +8 -0
- package/plugins/with-nx-metro.js +31 -0
- package/project.json +54 -0
- package/src/executors/build-android/build-android.impl.d.ts +6 -0
- package/src/executors/build-android/build-android.impl.js +48 -0
- package/src/executors/build-android/build-android.impl.ts +69 -0
- package/src/executors/build-android/schema.d.ts +14 -0
- package/src/executors/build-android/schema.json +81 -0
- package/src/executors/build-ios/build-ios.impl.d.ts +6 -0
- package/src/executors/build-ios/build-ios.impl.js +55 -0
- package/src/executors/build-ios/build-ios.impl.ts +77 -0
- package/src/executors/build-ios/schema.d.ts +17 -0
- package/src/executors/build-ios/schema.json +91 -0
- package/src/executors/bundle/bundle.impl.d.ts +6 -0
- package/src/executors/bundle/bundle.impl.js +56 -0
- package/src/executors/bundle/bundle.impl.ts +77 -0
- package/src/executors/bundle/schema.d.ts +16 -0
- package/src/executors/bundle/schema.json +92 -0
- package/src/executors/ensure-symlink/ensure-symlink.impl.d.ts +9 -0
- package/src/executors/ensure-symlink/ensure-symlink.impl.js +13 -0
- package/src/executors/ensure-symlink/ensure-symlink.impl.ts +22 -0
- package/src/executors/ensure-symlink/schema.json +11 -0
- package/src/executors/pod-install/pod-install.impl.d.ts +6 -0
- package/src/executors/pod-install/pod-install.impl.js +11 -0
- package/src/executors/pod-install/pod-install.impl.ts +21 -0
- package/src/executors/pod-install/schema.d.ts +6 -0
- package/src/executors/pod-install/schema.json +33 -0
- package/src/executors/run-android/run-android.impl.d.ts +6 -0
- package/src/executors/run-android/run-android.impl.js +66 -0
- package/src/executors/run-android/run-android.impl.ts +94 -0
- package/src/executors/run-android/schema.d.ts +13 -0
- package/src/executors/run-android/schema.json +100 -0
- package/src/executors/run-ios/run-ios.impl.d.ts +6 -0
- package/src/executors/run-ios/run-ios.impl.js +65 -0
- package/src/executors/run-ios/run-ios.impl.ts +92 -0
- package/src/executors/run-ios/schema.d.ts +7 -0
- package/src/executors/run-ios/schema.json +96 -0
- package/src/executors/start/lib/is-packager-running.d.ts +1 -0
- package/src/executors/start/lib/is-packager-running.js +15 -0
- package/src/executors/start/schema.d.ts +7 -0
- package/src/executors/start/schema.json +28 -0
- package/src/executors/start/start.impl.d.ts +10 -0
- package/src/executors/start/start.impl.js +87 -0
- package/src/executors/start/start.impl.ts +111 -0
- package/src/executors/storybook/schema.d.ts +5 -0
- package/src/executors/storybook/schema.json +29 -0
- package/src/executors/storybook/storybook.impl.d.ts +10 -0
- package/src/executors/storybook/storybook.impl.js +51 -0
- package/src/executors/storybook/storybook.impl.ts +85 -0
- package/src/executors/sync-deps/schema.d.ts +5 -0
- package/src/executors/sync-deps/schema.json +33 -0
- package/src/executors/sync-deps/sync-deps.impl.d.ts +9 -0
- package/src/executors/sync-deps/sync-deps.impl.js +78 -0
- package/src/executors/sync-deps/sync-deps.impl.ts +140 -0
- package/src/executors/upgrade/schema.d.ts +1 -0
- package/src/executors/upgrade/schema.json +11 -0
- package/src/executors/upgrade/upgrade.impl.d.ts +13 -0
- package/src/executors/upgrade/upgrade.impl.js +47 -0
- package/src/executors/upgrade/upgrade.impl.ts +64 -0
- package/src/generators/application/application.d.ts +5 -0
- package/src/generators/application/application.js +87 -0
- package/src/generators/application/application.spec.ts +258 -0
- package/src/generators/application/files/app/.babelrc.js.template +23 -0
- package/src/generators/application/files/app/Gemfile.template +7 -0
- package/src/generators/application/files/app/android/app/build.gradle.template +119 -0
- package/src/generators/application/files/app/android/app/debug.keystore +0 -0
- package/src/generators/application/files/app/android/app/proguard-rules.pro +10 -0
- package/src/generators/application/files/app/android/app/src/androidTest/java/com/__lowerCaseName__/DetoxTest.java.template +30 -0
- package/src/generators/application/files/app/android/app/src/debug/AndroidManifest.xml.template +10 -0
- package/src/generators/application/files/app/android/app/src/main/AndroidManifest.xml.template +26 -0
- package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainActivity.kt.template +22 -0
- package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainApplication.kt.template +45 -0
- package/src/generators/application/files/app/android/app/src/main/res/drawable/rn_edit_text_material.xml +36 -0
- package/src/generators/application/files/app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/src/generators/application/files/app/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/src/generators/application/files/app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/src/generators/application/files/app/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/src/generators/application/files/app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/src/generators/application/files/app/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/src/generators/application/files/app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/src/generators/application/files/app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/src/generators/application/files/app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/src/generators/application/files/app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/src/generators/application/files/app/android/app/src/main/res/values/strings.xml.template +3 -0
- package/src/generators/application/files/app/android/app/src/main/res/values/styles.xml +9 -0
- package/src/generators/application/files/app/android/app/src/main/res/xml/network_security_config.xml +7 -0
- package/src/generators/application/files/app/android/build.gradle.template +21 -0
- package/src/generators/application/files/app/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/src/generators/application/files/app/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/src/generators/application/files/app/android/gradle.properties +41 -0
- package/src/generators/application/files/app/android/gradlew.bat +92 -0
- package/src/generators/application/files/app/android/gradlew.template +249 -0
- package/src/generators/application/files/app/android/settings.gradle.template +4 -0
- package/src/generators/application/files/app/app.json.template +4 -0
- package/src/generators/application/files/app/ios/.xcode.env.template +12 -0
- package/src/generators/application/files/app/ios/Podfile.template +55 -0
- package/src/generators/application/files/app/ios/__className__/AppDelegate.h +6 -0
- package/src/generators/application/files/app/ios/__className__/AppDelegate.mm.template +31 -0
- package/src/generators/application/files/app/ios/__className__/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
- package/src/generators/application/files/app/ios/__className__/Images.xcassets/Contents.json +6 -0
- package/src/generators/application/files/app/ios/__className__/Info.plist.template +52 -0
- package/src/generators/application/files/app/ios/__className__/LaunchScreen.storyboard.template +47 -0
- package/src/generators/application/files/app/ios/__className__/main.m +10 -0
- package/src/generators/application/files/app/ios/__className__.xcodeproj/project.pbxproj.template +684 -0
- package/src/generators/application/files/app/ios/__className__.xcodeproj/xcshareddata/xcschemes/__className__.xcscheme.template +88 -0
- package/src/generators/application/files/app/ios/__className__.xcworkspace/contents.xcworkspacedata +10 -0
- package/src/generators/application/files/app/ios/__className__Tests/Info.plist +24 -0
- package/src/generators/application/files/app/ios/__className__Tests/__className__Tests.m +66 -0
- package/src/generators/application/files/app/metro.config.js.template +31 -0
- package/src/generators/application/files/app/package.json.template +14 -0
- package/src/generators/application/files/app/src/app/App.spec.tsx.template +9 -0
- package/src/generators/application/files/app/src/app/App.tsx.template +731 -0
- package/src/generators/application/files/app/src/main.tsx.template +4 -0
- package/src/generators/application/files/app/test-setup.ts.template +1 -0
- package/src/generators/application/files/app/tsconfig.app.json.template +10 -0
- package/src/generators/application/files/app/tsconfig.json.template +19 -0
- package/src/generators/application/lib/add-e2e.d.ts +3 -0
- package/src/generators/application/lib/add-e2e.js +46 -0
- package/src/generators/application/lib/add-project.d.ts +3 -0
- package/src/generators/application/lib/add-project.js +91 -0
- package/src/generators/application/lib/create-application-files.d.ts +3 -0
- package/src/generators/application/lib/create-application-files.js +24 -0
- package/src/generators/application/lib/normalize-options.d.ts +17 -0
- package/src/generators/application/lib/normalize-options.js +47 -0
- package/src/generators/application/lib/normalize-options.spec.ts +196 -0
- package/src/generators/application/schema.d.ts +23 -0
- package/src/generators/application/schema.json +103 -0
- package/src/generators/component/component.d.ts +5 -0
- package/src/generators/component/component.js +64 -0
- package/src/generators/component/component.spec.ts +127 -0
- package/src/generators/component/files/__fileName__.spec.tsx__tmpl__ +11 -0
- package/src/generators/component/files/__fileName__.tsx__tmpl__ +32 -0
- package/src/generators/component/lib/add-import.d.ts +3 -0
- package/src/generators/component/lib/add-import.js +33 -0
- package/src/generators/component/lib/normalize-options.d.ts +10 -0
- package/src/generators/component/lib/normalize-options.js +50 -0
- package/src/generators/component/schema.d.ts +24 -0
- package/src/generators/component/schema.json +85 -0
- package/src/generators/component-story/component-story.d.ts +8 -0
- package/src/generators/component-story/component-story.js +15 -0
- package/src/generators/component-story/schema.d.ts +6 -0
- package/src/generators/component-story/schema.json +42 -0
- package/src/generators/init/init.d.ts +6 -0
- package/src/generators/init/init.js +78 -0
- package/src/generators/init/init.spec.ts +38 -0
- package/src/generators/init/lib/add-git-ignore-entry.d.ts +2 -0
- package/src/generators/init/lib/add-git-ignore-entry.js +24 -0
- package/src/generators/init/lib/gitignore-entries.d.ts +1 -0
- package/src/generators/init/lib/gitignore-entries.js +74 -0
- package/src/generators/init/schema.d.ts +7 -0
- package/src/generators/init/schema.json +35 -0
- package/src/generators/library/files/lib/.babelrc.js.template +21 -0
- package/src/generators/library/files/lib/README.md +7 -0
- package/src/generators/library/files/lib/package.json.template +4 -0
- package/src/generators/library/files/lib/src/index.ts.template +0 -0
- package/src/generators/library/files/lib/test-setup.ts.template +1 -0
- package/src/generators/library/files/lib/tsconfig.json.template +16 -0
- package/src/generators/library/files/lib/tsconfig.lib.json.template +9 -0
- package/src/generators/library/lib/normalize-options.d.ts +12 -0
- package/src/generators/library/lib/normalize-options.js +33 -0
- package/src/generators/library/library.d.ts +5 -0
- package/src/generators/library/library.js +154 -0
- package/src/generators/library/library.spec.ts +420 -0
- package/src/generators/library/schema.d.ts +25 -0
- package/src/generators/library/schema.json +107 -0
- package/src/generators/stories/schema.d.ts +7 -0
- package/src/generators/stories/schema.json +58 -0
- package/src/generators/stories/stories.d.ts +8 -0
- package/src/generators/stories/stories.js +13 -0
- package/src/generators/storybook-configuration/configuration.d.ts +9 -0
- package/src/generators/storybook-configuration/configuration.js +26 -0
- package/src/generators/storybook-configuration/schema.d.ts +13 -0
- package/src/generators/storybook-configuration/schema.json +79 -0
- package/src/generators/upgrade-native/lib/create-native-files.d.ts +3 -0
- package/src/generators/upgrade-native/lib/create-native-files.js +14 -0
- package/src/generators/upgrade-native/lib/normalize-options.d.ts +12 -0
- package/src/generators/upgrade-native/lib/normalize-options.js +27 -0
- package/src/generators/upgrade-native/schema.d.ts +9 -0
- package/src/generators/upgrade-native/schema.json +41 -0
- package/src/generators/upgrade-native/upgrade-native.d.ts +10 -0
- package/src/generators/upgrade-native/upgrade-native.js +31 -0
- package/src/generators/web-configuration/files/base-vite/.babelrc.js.template +23 -0
- package/src/generators/web-configuration/files/base-vite/index.html__tmpl__ +15 -0
- package/src/generators/web-configuration/files/base-vite/public/favicon.ico +0 -0
- package/src/generators/web-configuration/files/base-vite/src/assets/.gitkeep +0 -0
- package/src/generators/web-configuration/files/base-vite/src/main-web.tsx__tmpl__ +9 -0
- package/src/generators/web-configuration/files/base-vite/vite.config.ts__tmpl__ +82 -0
- package/src/generators/web-configuration/files/base-webpack/.babelrc.js.template +23 -0
- package/src/generators/web-configuration/files/base-webpack/src/assets/.gitkeep +0 -0
- package/src/generators/web-configuration/files/base-webpack/src/favicon.ico +0 -0
- package/src/generators/web-configuration/files/base-webpack/src/index.html__tmpl__ +14 -0
- package/src/generators/web-configuration/files/base-webpack/src/main-web.tsx__tmpl__ +9 -0
- package/src/generators/web-configuration/files/base-webpack/webpack.config.js__tmpl__ +77 -0
- package/src/generators/web-configuration/lib/normalize-schema.d.ts +17 -0
- package/src/generators/web-configuration/lib/normalize-schema.js +16 -0
- package/src/generators/web-configuration/lib/webpack-targets.d.ts +7 -0
- package/src/generators/web-configuration/lib/webpack-targets.js +75 -0
- package/src/generators/web-configuration/schema.d.ts +6 -0
- package/src/generators/web-configuration/schema.json +42 -0
- package/src/generators/web-configuration/web-configuration.d.ts +12 -0
- package/src/generators/web-configuration/web-configuration.js +87 -0
- package/src/migrations/update-15-0-0/add-babel-inputs.d.ts +2 -0
- package/src/migrations/update-15-0-0/add-babel-inputs.js +9 -0
- package/src/migrations/update-15-0-0/add-babel-inputs.spec.ts +73 -0
- 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 +29 -0
- package/src/migrations/update-15-9-1/add-build-ios-target.spec.ts +36 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +9 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.spec.ts +37 -0
- package/src/migrations/update-16-1-0/upgrade-storybook-6-5.d.ts +6 -0
- package/src/migrations/update-16-1-0/upgrade-storybook-6-5.js +21 -0
- package/src/migrations/update-16-6-0/add-depends-on.d.ts +6 -0
- package/src/migrations/update-16-6-0/add-depends-on.js +63 -0
- package/src/migrations/update-16-6-0/update-metro-config.d.ts +6 -0
- package/src/migrations/update-16-6-0/update-metro-config.js +63 -0
- package/src/migrations/update-16-9-0/remove-types-react-native.d.ts +7 -0
- package/src/migrations/update-16-9-0/remove-types-react-native.js +13 -0
- package/src/migrations/update-18-0-0/add-upgrade-target.d.ts +6 -0
- package/src/migrations/update-18-0-0/add-upgrade-target.js +33 -0
- package/src/migrations/update-18-0-0/add-web-configuration.d.ts +8 -0
- package/src/migrations/update-18-0-0/add-web-configuration.js +33 -0
- package/src/migrations/update-18-0-0/add-web-configuration.spec.ts +39 -0
- package/src/migrations/update-18-0-0/change-storybook-targets.d.ts +5 -0
- package/src/migrations/update-18-0-0/change-storybook-targets.js +57 -0
- package/src/migrations/update-18-0-0/remove-block-list.d.ts +6 -0
- package/src/migrations/update-18-0-0/remove-block-list.js +28 -0
- package/src/migrations/update-18-0-0/remove-block-list.spec.ts +68 -0
- package/src/migrations/update-18-0-0/remove-metro.d.ts +14 -0
- package/src/migrations/update-18-0-0/remove-metro.js +29 -0
- package/src/migrations/update-18-0-0/remove-symlink-target.d.ts +6 -0
- package/src/migrations/update-18-0-0/remove-symlink-target.js +30 -0
- package/src/migrations/update-18-0-0/remove-symlink-target.spec.ts +40 -0
- package/src/utils/add-jest.d.ts +2 -0
- package/src/utils/add-jest.js +48 -0
- package/src/utils/add-linting.d.ts +13 -0
- package/src/utils/add-linting.js +36 -0
- package/src/utils/add-linting.spec.ts +40 -0
- package/src/utils/chmod-android-gradle-files.d.ts +3 -0
- package/src/utils/chmod-android-gradle-files.js +27 -0
- package/src/utils/ensure-dependencies.d.ts +2 -0
- package/src/utils/ensure-dependencies.js +30 -0
- package/src/utils/ensure-node-modules-symlink.d.ts +9 -0
- package/src/utils/ensure-node-modules-symlink.js +28 -0
- package/src/utils/ensure-node-modules-symlink.spec.ts +108 -0
- package/src/utils/find-all-npm-dependencies.d.ts +2 -0
- package/src/utils/find-all-npm-dependencies.js +27 -0
- package/src/utils/find-all-npm-dependencies.spec.ts +103 -0
- package/src/utils/format-file.d.ts +1 -0
- package/src/utils/format-file.js +16 -0
- package/src/utils/get-cli-options.d.ts +8 -0
- package/src/utils/get-cli-options.js +33 -0
- package/src/utils/pod-install-task.d.ts +18 -0
- package/src/utils/pod-install-task.js +73 -0
- package/src/utils/testing-generators.d.ts +3 -0
- package/src/utils/testing-generators.js +32 -0
- package/src/utils/versions.d.ts +17 -0
- package/src/utils/versions.js +20 -0
- package/typings/svg.d.ts +7 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const path_1 = require("path");
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const os_1 = require("os");
|
|
6
|
+
const get_cli_options_1 = require("../../utils/get-cli-options");
|
|
7
|
+
async function* buildIosExecutor(options, context) {
|
|
8
|
+
if ((0, os_1.platform)() !== 'darwin') {
|
|
9
|
+
throw new Error(`The run-ios build requires Mac to run`);
|
|
10
|
+
}
|
|
11
|
+
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
12
|
+
await runCliBuildIOS(context.root, projectRoot, options);
|
|
13
|
+
return { success: true };
|
|
14
|
+
}
|
|
15
|
+
exports.default = buildIosExecutor;
|
|
16
|
+
function runCliBuildIOS(workspaceRoot, projectRoot, options) {
|
|
17
|
+
return new Promise((resolve, reject) => {
|
|
18
|
+
const childProcess = (0, child_process_1.fork)(require.resolve('react-native/cli.js'), [
|
|
19
|
+
'build-ios',
|
|
20
|
+
...createBuildIOSOptions(options),
|
|
21
|
+
...(process.env.NX_VERBOSE_LOGGING === 'true' ? ['--verbose'] : []),
|
|
22
|
+
], {
|
|
23
|
+
cwd: (0, path_1.resolve)(workspaceRoot, projectRoot),
|
|
24
|
+
env: { ...process.env, RCT_METRO_PORT: options.port.toString() },
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* Ensure the child process is killed when the parent exits
|
|
28
|
+
*/
|
|
29
|
+
const processExitListener = (signal) => () => {
|
|
30
|
+
childProcess.kill(signal);
|
|
31
|
+
process.exit();
|
|
32
|
+
};
|
|
33
|
+
process.once('exit', (signal) => childProcess.kill(signal));
|
|
34
|
+
process.once('SIGTERM', processExitListener);
|
|
35
|
+
process.once('SIGINT', processExitListener);
|
|
36
|
+
process.once('SIGQUIT', processExitListener);
|
|
37
|
+
childProcess.on('error', (err) => {
|
|
38
|
+
reject(err);
|
|
39
|
+
});
|
|
40
|
+
childProcess.on('exit', (code) => {
|
|
41
|
+
if (code === 0) {
|
|
42
|
+
resolve(childProcess);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
reject(code);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
const startOptions = ['port', 'resetCache'];
|
|
51
|
+
function createBuildIOSOptions(options) {
|
|
52
|
+
return (0, get_cli_options_1.getCliOptions)(options, startOptions, [
|
|
53
|
+
'buildFolder',
|
|
54
|
+
]);
|
|
55
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { ExecutorContext } from '@nx/devkit';
|
|
2
|
+
import { resolve as pathResolve } from 'path';
|
|
3
|
+
import { ChildProcess, fork } from 'child_process';
|
|
4
|
+
import { platform } from 'os';
|
|
5
|
+
|
|
6
|
+
import { ReactNativeBuildIosOptions } from './schema';
|
|
7
|
+
import { getCliOptions } from '../../utils/get-cli-options';
|
|
8
|
+
|
|
9
|
+
export interface ReactNativeBuildIosOutput {
|
|
10
|
+
success: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default async function* buildIosExecutor(
|
|
14
|
+
options: ReactNativeBuildIosOptions,
|
|
15
|
+
context: ExecutorContext
|
|
16
|
+
): AsyncGenerator<ReactNativeBuildIosOutput> {
|
|
17
|
+
if (platform() !== 'darwin') {
|
|
18
|
+
throw new Error(`The run-ios build requires Mac to run`);
|
|
19
|
+
}
|
|
20
|
+
const projectRoot =
|
|
21
|
+
context.projectsConfigurations.projects[context.projectName].root;
|
|
22
|
+
|
|
23
|
+
await runCliBuildIOS(context.root, projectRoot, options);
|
|
24
|
+
return { success: true };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function runCliBuildIOS(
|
|
28
|
+
workspaceRoot: string,
|
|
29
|
+
projectRoot: string,
|
|
30
|
+
options: ReactNativeBuildIosOptions
|
|
31
|
+
): Promise<ChildProcess> {
|
|
32
|
+
return new Promise<ChildProcess>((resolve, reject) => {
|
|
33
|
+
const childProcess = fork(
|
|
34
|
+
require.resolve('react-native/cli.js'),
|
|
35
|
+
[
|
|
36
|
+
'build-ios',
|
|
37
|
+
...createBuildIOSOptions(options),
|
|
38
|
+
...(process.env.NX_VERBOSE_LOGGING === 'true' ? ['--verbose'] : []),
|
|
39
|
+
],
|
|
40
|
+
{
|
|
41
|
+
cwd: pathResolve(workspaceRoot, projectRoot),
|
|
42
|
+
env: { ...process.env, RCT_METRO_PORT: options.port.toString() },
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Ensure the child process is killed when the parent exits
|
|
48
|
+
*/
|
|
49
|
+
const processExitListener = (signal?: number | NodeJS.Signals) => () => {
|
|
50
|
+
childProcess.kill(signal);
|
|
51
|
+
process.exit();
|
|
52
|
+
};
|
|
53
|
+
process.once('exit', (signal) => childProcess.kill(signal));
|
|
54
|
+
process.once('SIGTERM', processExitListener);
|
|
55
|
+
process.once('SIGINT', processExitListener);
|
|
56
|
+
process.once('SIGQUIT', processExitListener);
|
|
57
|
+
|
|
58
|
+
childProcess.on('error', (err) => {
|
|
59
|
+
reject(err);
|
|
60
|
+
});
|
|
61
|
+
childProcess.on('exit', (code) => {
|
|
62
|
+
if (code === 0) {
|
|
63
|
+
resolve(childProcess);
|
|
64
|
+
} else {
|
|
65
|
+
reject(code);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const startOptions = ['port', 'resetCache'];
|
|
72
|
+
|
|
73
|
+
function createBuildIOSOptions(options: ReactNativeBuildIosOptions) {
|
|
74
|
+
return getCliOptions<ReactNativeBuildIosOptions>(options, startOptions, [
|
|
75
|
+
'buildFolder',
|
|
76
|
+
]);
|
|
77
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// options from https://github.com/react-native-community/cli/blob/main/packages/cli-platform-ios/src/commands/buildIOS/index.ts
|
|
2
|
+
|
|
3
|
+
import { ReactNativeStartOptions } from '../start/schema';
|
|
4
|
+
|
|
5
|
+
export interface ReactNativeBuildIosOptions extends ReactNativeStartOptions {
|
|
6
|
+
// react native options
|
|
7
|
+
simulator?: string;
|
|
8
|
+
mode: string; // default if 'Debug'
|
|
9
|
+
scheme?: string;
|
|
10
|
+
device?: string;
|
|
11
|
+
udid?: string;
|
|
12
|
+
verbose?: boolean;
|
|
13
|
+
port: number; // default is 8081
|
|
14
|
+
xcconfig?: string;
|
|
15
|
+
buildFolder?: string;
|
|
16
|
+
extraParams?: string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"version": 2,
|
|
4
|
+
"cli": "nx",
|
|
5
|
+
"title": "React Native Build iOS executor",
|
|
6
|
+
"description": "Build iOS app.",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"presets": [
|
|
9
|
+
{
|
|
10
|
+
"name": "Build iOS for a simulator",
|
|
11
|
+
"keys": ["simulator"]
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"name": "Build iOS for a device",
|
|
15
|
+
"keys": ["device"]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "Build iOS for a device with udid",
|
|
19
|
+
"keys": ["udid"]
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"properties": {
|
|
23
|
+
"simulator": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"description": "Explicitly set simulator to use. Optionally include iOS version between parenthesis at the end to match an exact version: \"iPhone 6 (10.0)\"",
|
|
26
|
+
"examples": [
|
|
27
|
+
"iPhone 14",
|
|
28
|
+
"iPhone 13",
|
|
29
|
+
"iPhone 12",
|
|
30
|
+
"iPhone 11",
|
|
31
|
+
"iPhone X"
|
|
32
|
+
],
|
|
33
|
+
"x-priority": "important"
|
|
34
|
+
},
|
|
35
|
+
"mode": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"description": "Explicitly set the scheme configuration to use",
|
|
38
|
+
"default": "Debug",
|
|
39
|
+
"examples": ["Debug", "Release"],
|
|
40
|
+
"x-priority": "important"
|
|
41
|
+
},
|
|
42
|
+
"scheme": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"description": "Explicitly set Xcode scheme to use"
|
|
45
|
+
},
|
|
46
|
+
"device": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"description": "Explicitly set device to use by name. The value is not required if you have a single device connected."
|
|
49
|
+
},
|
|
50
|
+
"udid": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"description": "Explicitly set device to use by udid"
|
|
53
|
+
},
|
|
54
|
+
"verbose": {
|
|
55
|
+
"type": "boolean",
|
|
56
|
+
"description": "Do not use xcbeautify or xcpretty even if installed"
|
|
57
|
+
},
|
|
58
|
+
"port": {
|
|
59
|
+
"type": "number",
|
|
60
|
+
"description": "The port where the packager server is listening on.",
|
|
61
|
+
"default": 8081
|
|
62
|
+
},
|
|
63
|
+
"xcconfig": {
|
|
64
|
+
"type": "string",
|
|
65
|
+
"description": "Explicitly set xcconfig to use"
|
|
66
|
+
},
|
|
67
|
+
"buildFolder": {
|
|
68
|
+
"type": "string",
|
|
69
|
+
"description": "Location for iOS build artifacts. Corresponds to Xcode's \"-derivedDataPath\". Relative to ios directory",
|
|
70
|
+
"default": "./build"
|
|
71
|
+
},
|
|
72
|
+
"interactive": {
|
|
73
|
+
"type": "boolean",
|
|
74
|
+
"description": "Explicitly select which scheme and configuration to use before running a build"
|
|
75
|
+
},
|
|
76
|
+
"extraParams": {
|
|
77
|
+
"oneOf": [
|
|
78
|
+
{ "type": "array", "items": { "type": "string" } },
|
|
79
|
+
{ "type": "string" }
|
|
80
|
+
],
|
|
81
|
+
"description": "Custom params that will be passed to xcodebuild command."
|
|
82
|
+
},
|
|
83
|
+
"resetCache": {
|
|
84
|
+
"type": "boolean",
|
|
85
|
+
"description": "Resets metro cache.",
|
|
86
|
+
"default": false
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"required": [],
|
|
90
|
+
"examplesFile": "../../../docs/build-ios-examples.md"
|
|
91
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ExecutorContext } from '@nx/devkit';
|
|
2
|
+
import { ReactNativeBundleOptions } from './schema';
|
|
3
|
+
export interface ReactNativeBundleOutput {
|
|
4
|
+
success: boolean;
|
|
5
|
+
}
|
|
6
|
+
export default function bundleExecutor(options: ReactNativeBundleOptions, context: ExecutorContext): AsyncGenerator<ReactNativeBundleOutput>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const fileutils_1 = require("@nx/workspace/src/utilities/fileutils");
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const child_process_1 = require("child_process");
|
|
7
|
+
async function* bundleExecutor(options, context) {
|
|
8
|
+
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
9
|
+
options.bundleOutput = (0, path_1.join)(context.root, options.bundleOutput);
|
|
10
|
+
(0, fileutils_1.createDirectory)((0, path_1.dirname)(options.bundleOutput));
|
|
11
|
+
await runCliBuild(context.root, projectRoot, options);
|
|
12
|
+
yield { success: true };
|
|
13
|
+
}
|
|
14
|
+
exports.default = bundleExecutor;
|
|
15
|
+
function runCliBuild(workspaceRoot, projectRoot, options) {
|
|
16
|
+
return new Promise((resolve, reject) => {
|
|
17
|
+
const cliOptions = createBundleOptions(options);
|
|
18
|
+
const childProcess = (0, child_process_1.fork)(require.resolve('react-native/cli.js'), ['bundle', ...cliOptions], {
|
|
19
|
+
stdio: 'inherit',
|
|
20
|
+
cwd: (0, path_1.resolve)(workspaceRoot, projectRoot),
|
|
21
|
+
env: process.env,
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* Ensure the child process is killed when the parent exits
|
|
25
|
+
*/
|
|
26
|
+
const processExitListener = (signal) => () => {
|
|
27
|
+
childProcess.kill(signal);
|
|
28
|
+
process.exit();
|
|
29
|
+
};
|
|
30
|
+
process.once('exit', (signal) => childProcess.kill(signal));
|
|
31
|
+
process.once('SIGTERM', processExitListener);
|
|
32
|
+
process.once('SIGINT', processExitListener);
|
|
33
|
+
process.once('SIGQUIT', processExitListener);
|
|
34
|
+
childProcess.on('error', (err) => {
|
|
35
|
+
reject(err);
|
|
36
|
+
});
|
|
37
|
+
childProcess.on('exit', (code) => {
|
|
38
|
+
if (code === 0) {
|
|
39
|
+
resolve(childProcess);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
reject(code);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function createBundleOptions(options) {
|
|
48
|
+
return Object.keys(options).reduce((acc, _k) => {
|
|
49
|
+
const v = options[_k];
|
|
50
|
+
const k = (0, devkit_1.names)(_k).fileName;
|
|
51
|
+
if (v === undefined)
|
|
52
|
+
return acc;
|
|
53
|
+
acc.push(`--${k}`, v);
|
|
54
|
+
return acc;
|
|
55
|
+
}, []);
|
|
56
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { createDirectory } from '@nx/workspace/src/utilities/fileutils';
|
|
2
|
+
import { names, ExecutorContext } from '@nx/devkit';
|
|
3
|
+
import { dirname, join, resolve as pathResolve } from 'path';
|
|
4
|
+
import { ChildProcess, fork } from 'child_process';
|
|
5
|
+
|
|
6
|
+
import { ReactNativeBundleOptions } from './schema';
|
|
7
|
+
|
|
8
|
+
export interface ReactNativeBundleOutput {
|
|
9
|
+
success: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default async function* bundleExecutor(
|
|
13
|
+
options: ReactNativeBundleOptions,
|
|
14
|
+
context: ExecutorContext
|
|
15
|
+
): AsyncGenerator<ReactNativeBundleOutput> {
|
|
16
|
+
const projectRoot =
|
|
17
|
+
context.projectsConfigurations.projects[context.projectName].root;
|
|
18
|
+
|
|
19
|
+
options.bundleOutput = join(context.root, options.bundleOutput);
|
|
20
|
+
|
|
21
|
+
createDirectory(dirname(options.bundleOutput));
|
|
22
|
+
|
|
23
|
+
await runCliBuild(context.root, projectRoot, options);
|
|
24
|
+
yield { success: true };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function runCliBuild(
|
|
28
|
+
workspaceRoot: string,
|
|
29
|
+
projectRoot: string,
|
|
30
|
+
options: ReactNativeBundleOptions
|
|
31
|
+
): Promise<ChildProcess> {
|
|
32
|
+
return new Promise<ChildProcess>((resolve, reject) => {
|
|
33
|
+
const cliOptions = createBundleOptions(options);
|
|
34
|
+
const childProcess = fork(
|
|
35
|
+
require.resolve('react-native/cli.js'),
|
|
36
|
+
['bundle', ...cliOptions],
|
|
37
|
+
{
|
|
38
|
+
stdio: 'inherit',
|
|
39
|
+
cwd: pathResolve(workspaceRoot, projectRoot),
|
|
40
|
+
env: process.env,
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Ensure the child process is killed when the parent exits
|
|
46
|
+
*/
|
|
47
|
+
const processExitListener = (signal?: number | NodeJS.Signals) => () => {
|
|
48
|
+
childProcess.kill(signal);
|
|
49
|
+
process.exit();
|
|
50
|
+
};
|
|
51
|
+
process.once('exit', (signal) => childProcess.kill(signal));
|
|
52
|
+
process.once('SIGTERM', processExitListener);
|
|
53
|
+
process.once('SIGINT', processExitListener);
|
|
54
|
+
process.once('SIGQUIT', processExitListener);
|
|
55
|
+
|
|
56
|
+
childProcess.on('error', (err) => {
|
|
57
|
+
reject(err);
|
|
58
|
+
});
|
|
59
|
+
childProcess.on('exit', (code) => {
|
|
60
|
+
if (code === 0) {
|
|
61
|
+
resolve(childProcess);
|
|
62
|
+
} else {
|
|
63
|
+
reject(code);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function createBundleOptions(options: ReactNativeBundleOptions) {
|
|
70
|
+
return Object.keys(options).reduce((acc, _k) => {
|
|
71
|
+
const v = options[_k];
|
|
72
|
+
const k = names(_k).fileName;
|
|
73
|
+
if (v === undefined) return acc;
|
|
74
|
+
acc.push(`--${k}`, v);
|
|
75
|
+
return acc;
|
|
76
|
+
}, []);
|
|
77
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// options form https://github.com/facebook/react-native/tree/main/packages/community-cli-plugin#bundle
|
|
2
|
+
export interface ReactNativeBundleOptions {
|
|
3
|
+
entryFile: string;
|
|
4
|
+
platform: string;
|
|
5
|
+
transfrom?: string;
|
|
6
|
+
dev: boolean; // default is true
|
|
7
|
+
minify?: boolean; // default is false, if dev is false, then minify will become true
|
|
8
|
+
bundleOutput: string;
|
|
9
|
+
maxWorkers: number;
|
|
10
|
+
sourcemapOutput?: string;
|
|
11
|
+
sourcemapSourcesRoot?: string;
|
|
12
|
+
sourcemapUseAbsolutePath: boolean; // default is false
|
|
13
|
+
assetDest?: string;
|
|
14
|
+
resetCache: boolean; // default is false
|
|
15
|
+
readGlobalCache?: boolean; // default is false
|
|
16
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 2,
|
|
3
|
+
"outputCapture": "direct-nodejs",
|
|
4
|
+
"cli": "nx",
|
|
5
|
+
"$id": "NxReactNativeBundle",
|
|
6
|
+
"$schema": "https://json-schema.org/schema",
|
|
7
|
+
"title": "Offline JS Bundle for React Native",
|
|
8
|
+
"description": "JS Bundle target options.",
|
|
9
|
+
"type": "object",
|
|
10
|
+
"presets": [
|
|
11
|
+
{
|
|
12
|
+
"name": "Bundle for a specific platform",
|
|
13
|
+
"keys": ["platform"]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"name": "Bundle a development build",
|
|
17
|
+
"keys": ["dev"]
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"name": "Bundle to a specific output path",
|
|
21
|
+
"keys": ["bundleOutput"]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "Bundle without global cache",
|
|
25
|
+
"keys": ["resetCache"]
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"properties": {
|
|
29
|
+
"entryFile": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"description": "The entry file relative to project root.",
|
|
32
|
+
"x-completion-type": "file",
|
|
33
|
+
"x-completion-glob": "main@(.js|.ts)"
|
|
34
|
+
},
|
|
35
|
+
"platform": {
|
|
36
|
+
"enum": ["ios", "android"],
|
|
37
|
+
"alias": "p",
|
|
38
|
+
"description": "Platform to build for."
|
|
39
|
+
},
|
|
40
|
+
"transformer": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"description": "Specify a custom transformer to be used."
|
|
43
|
+
},
|
|
44
|
+
"dev": {
|
|
45
|
+
"type": "boolean",
|
|
46
|
+
"description": "Generate a development build.",
|
|
47
|
+
"default": true
|
|
48
|
+
},
|
|
49
|
+
"minify": {
|
|
50
|
+
"type": "boolean",
|
|
51
|
+
"description": "Allows overriding whether bundle is minified."
|
|
52
|
+
},
|
|
53
|
+
"bundleOutput": {
|
|
54
|
+
"type": "string",
|
|
55
|
+
"description": "The output path of the generated files.",
|
|
56
|
+
"x-completion-type": "directory"
|
|
57
|
+
},
|
|
58
|
+
"maxWorkers": {
|
|
59
|
+
"type": "number",
|
|
60
|
+
"description": "The number of workers we should parallelize the transformer on."
|
|
61
|
+
},
|
|
62
|
+
"sourcemapOutput": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"description": "File name where to store the sourcemap file for resulting bundle, ex. /tmp/groups.map."
|
|
65
|
+
},
|
|
66
|
+
"sourcemapSourcesRoot": {
|
|
67
|
+
"type": "string",
|
|
68
|
+
"description": "Path to make sourcemaps sources entries relative to, ex. /root/dir."
|
|
69
|
+
},
|
|
70
|
+
"sourcemapUseAbsolutePath": {
|
|
71
|
+
"type": "boolean",
|
|
72
|
+
"description": "Report SourceMapURL using its full path.",
|
|
73
|
+
"default": false
|
|
74
|
+
},
|
|
75
|
+
"assetsDest": {
|
|
76
|
+
"type": "string",
|
|
77
|
+
"description": "Directory name where to store assets referenced in the bundle."
|
|
78
|
+
},
|
|
79
|
+
"resetCache": {
|
|
80
|
+
"type": "boolean",
|
|
81
|
+
"description": "Removes cached files.",
|
|
82
|
+
"default": false
|
|
83
|
+
},
|
|
84
|
+
"readGlobalCache": {
|
|
85
|
+
"type": "boolean",
|
|
86
|
+
"description": "Try to fetch transformed JS code from the global cache, if configured.",
|
|
87
|
+
"default": false
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"required": ["platform", "entryFile", "bundleOutput"],
|
|
91
|
+
"examplesFile": "../../../docs/bundle-examples.md"
|
|
92
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ExecutorContext } from '@nx/devkit';
|
|
2
|
+
export interface ReactNativeEnsureSymlinkOutput {
|
|
3
|
+
success: boolean;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* TODO (@xiongemi): remove this function in v19.
|
|
7
|
+
* @deprecated It is no longer needed for react native 73.
|
|
8
|
+
*/
|
|
9
|
+
export default function ensureSymlinkExecutor(_: any, context: ExecutorContext): AsyncGenerator<ReactNativeEnsureSymlinkOutput>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const ensure_node_modules_symlink_1 = require("../../utils/ensure-node-modules-symlink");
|
|
4
|
+
/**
|
|
5
|
+
* TODO (@xiongemi): remove this function in v19.
|
|
6
|
+
* @deprecated It is no longer needed for react native 73.
|
|
7
|
+
*/
|
|
8
|
+
async function* ensureSymlinkExecutor(_, context) {
|
|
9
|
+
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
10
|
+
(0, ensure_node_modules_symlink_1.ensureNodeModulesSymlink)(context.root, projectRoot);
|
|
11
|
+
yield { success: true };
|
|
12
|
+
}
|
|
13
|
+
exports.default = ensureSymlinkExecutor;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ExecutorContext } from '@nx/devkit';
|
|
2
|
+
import { ensureNodeModulesSymlink } from '../../utils/ensure-node-modules-symlink';
|
|
3
|
+
|
|
4
|
+
export interface ReactNativeEnsureSymlinkOutput {
|
|
5
|
+
success: boolean;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* TODO (@xiongemi): remove this function in v19.
|
|
10
|
+
* @deprecated It is no longer needed for react native 73.
|
|
11
|
+
*/
|
|
12
|
+
export default async function* ensureSymlinkExecutor(
|
|
13
|
+
_,
|
|
14
|
+
context: ExecutorContext
|
|
15
|
+
): AsyncGenerator<ReactNativeEnsureSymlinkOutput> {
|
|
16
|
+
const projectRoot =
|
|
17
|
+
context.projectsConfigurations.projects[context.projectName].root;
|
|
18
|
+
|
|
19
|
+
ensureNodeModulesSymlink(context.root, projectRoot);
|
|
20
|
+
|
|
21
|
+
yield { success: true };
|
|
22
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 2,
|
|
3
|
+
"outputCapture": "direct-nodejs",
|
|
4
|
+
"cli": "nx",
|
|
5
|
+
"$id": "NxReactNativeEnsureSymlink",
|
|
6
|
+
"$schema": "https://json-schema.org/schema",
|
|
7
|
+
"title": "Ensure Symlink for React Native",
|
|
8
|
+
"description": "Ensure workspace node_modules is symlink under app's node_modules folder.",
|
|
9
|
+
"type": "object",
|
|
10
|
+
"properties": {}
|
|
11
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ExecutorContext } from '@nx/devkit';
|
|
2
|
+
import { ReactNativePodInstallOptions } from './schema';
|
|
3
|
+
export interface ReactNativePodInstallOutput {
|
|
4
|
+
success: boolean;
|
|
5
|
+
}
|
|
6
|
+
export default function podInstall(options: ReactNativePodInstallOptions, context: ExecutorContext): AsyncGenerator<ReactNativePodInstallOutput>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const path_1 = require("path");
|
|
4
|
+
const pod_install_task_1 = require("../../utils/pod-install-task");
|
|
5
|
+
async function* podInstall(options, context) {
|
|
6
|
+
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
7
|
+
const iosDirectory = (0, path_1.join)(context.root, projectRoot, 'ios');
|
|
8
|
+
await (0, pod_install_task_1.runPodInstall)(iosDirectory, true, options)();
|
|
9
|
+
yield { success: true };
|
|
10
|
+
}
|
|
11
|
+
exports.default = podInstall;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { join } from 'path';
|
|
2
|
+
import { ExecutorContext } from '@nx/devkit';
|
|
3
|
+
|
|
4
|
+
import { runPodInstall } from '../../utils/pod-install-task';
|
|
5
|
+
import { ReactNativePodInstallOptions } from './schema';
|
|
6
|
+
|
|
7
|
+
export interface ReactNativePodInstallOutput {
|
|
8
|
+
success: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default async function* podInstall(
|
|
12
|
+
options: ReactNativePodInstallOptions,
|
|
13
|
+
context: ExecutorContext
|
|
14
|
+
): AsyncGenerator<ReactNativePodInstallOutput> {
|
|
15
|
+
const projectRoot =
|
|
16
|
+
context.projectsConfigurations.projects[context.projectName].root;
|
|
17
|
+
const iosDirectory = join(context.root, projectRoot, 'ios');
|
|
18
|
+
await runPodInstall(iosDirectory, true, options)();
|
|
19
|
+
|
|
20
|
+
yield { success: true };
|
|
21
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 2,
|
|
3
|
+
"outputCapture": "direct-nodejs",
|
|
4
|
+
"cli": "nx",
|
|
5
|
+
"$id": "NxReactNativePodInstall",
|
|
6
|
+
"$schema": "https://json-schema.org/schema",
|
|
7
|
+
"title": "Run Pod Install for React Native iOS Project",
|
|
8
|
+
"description": "Run `pod install` for React Native iOS Project.",
|
|
9
|
+
"type": "object",
|
|
10
|
+
"properties": {
|
|
11
|
+
"buildFolder": {
|
|
12
|
+
"description": "Location for iOS build artifacts. Corresponds to Xcode's \"-derivedDataPath\". Relative to ios directory.",
|
|
13
|
+
"type": "string",
|
|
14
|
+
"default": "./build"
|
|
15
|
+
},
|
|
16
|
+
"repoUpdate": {
|
|
17
|
+
"description": "Force running `pod repo update` before install.",
|
|
18
|
+
"type": "boolean",
|
|
19
|
+
"default": false
|
|
20
|
+
},
|
|
21
|
+
"deployment": {
|
|
22
|
+
"description": "Disallow any changes to the Podfile or the Podfile.lock during installation.",
|
|
23
|
+
"type": "boolean",
|
|
24
|
+
"default": false
|
|
25
|
+
},
|
|
26
|
+
"useBundler": {
|
|
27
|
+
"description": "Run cocoapods within a Bundler environment, i.e. with the `bundle exec pod install` command",
|
|
28
|
+
"type": "boolean",
|
|
29
|
+
"default": false
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"required": ["buildFolder"]
|
|
33
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ExecutorContext } from '@nx/devkit';
|
|
2
|
+
import { ReactNativeRunAndroidOptions } from './schema';
|
|
3
|
+
export interface ReactNativeRunAndroidOutput {
|
|
4
|
+
success: boolean;
|
|
5
|
+
}
|
|
6
|
+
export default function runAndroidExecutor(options: ReactNativeRunAndroidOptions, context: ExecutorContext): AsyncGenerator<ReactNativeRunAndroidOutput>;
|