@nx/react-native 24.0.0-pr.37405.acdaf31 → 24.0.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.
Files changed (77) hide show
  1. package/dist/plugins/metro-reporter.d.ts +1 -0
  2. package/dist/plugins/metro-reporter.js +50 -0
  3. package/dist/plugins/plugin.js +20 -5
  4. package/dist/src/generators/application/application.js +2 -3
  5. package/dist/src/generators/application/lib/add-e2e.js +0 -2
  6. package/dist/src/generators/application/lib/add-project.js +1 -83
  7. package/dist/src/generators/application/lib/normalize-options.js +0 -4
  8. package/dist/src/generators/application/schema.d.ts +0 -5
  9. package/dist/src/generators/application/schema.json +0 -6
  10. package/dist/src/generators/convert-to-inferred/lib/create-process-options.d.ts +2 -2
  11. package/dist/src/generators/convert-to-inferred/lib/create-process-options.js +2 -2
  12. package/dist/src/generators/init/init.js +44 -53
  13. package/dist/src/generators/init/schema.d.ts +0 -1
  14. package/dist/src/generators/library/lib/normalize-options.js +0 -5
  15. package/dist/src/generators/library/library.js +2 -3
  16. package/dist/src/generators/library/schema.d.ts +0 -5
  17. package/dist/src/generators/library/schema.json +0 -6
  18. package/dist/src/generators/web-configuration/files/base-vite/vite.config.mts__tmpl__ +6 -5
  19. package/dist/src/generators/web-configuration/files/base-webpack/webpack.config.js__tmpl__ +2 -51
  20. package/dist/src/generators/web-configuration/lib/webpack-targets.d.ts +1 -3
  21. package/dist/src/generators/web-configuration/lib/webpack-targets.js +0 -57
  22. package/dist/src/generators/web-configuration/web-configuration.js +9 -18
  23. package/dist/src/migrations/update-24-0-0/finish-inferred-conversion.md +12 -0
  24. package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.d.ts +6 -0
  25. package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.js +30 -0
  26. package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.md +68 -0
  27. package/dist/src/utils/add-jest.d.ts +1 -1
  28. package/dist/src/utils/add-jest.js +1 -2
  29. package/dist/src/utils/add-linting.d.ts +0 -5
  30. package/dist/src/utils/add-linting.js +1 -2
  31. package/dist/src/utils/chmod-android-gradle-files.d.ts +0 -1
  32. package/dist/src/utils/chmod-android-gradle-files.js +0 -1
  33. package/dist/src/utils/pod-install-task.d.ts +0 -6
  34. package/dist/src/utils/pod-install-task.js +0 -1
  35. package/dist/src/utils/versions.d.ts +1 -0
  36. package/dist/src/utils/versions.js +2 -1
  37. package/executors.json +0 -40
  38. package/migrations.json +7 -0
  39. package/package.json +9 -9
  40. package/dist/src/executors/build-android/build-android.impl.d.ts +0 -6
  41. package/dist/src/executors/build-android/build-android.impl.js +0 -53
  42. package/dist/src/executors/build-android/schema.d.ts +0 -13
  43. package/dist/src/executors/build-android/schema.json +0 -82
  44. package/dist/src/executors/build-ios/build-ios.impl.d.ts +0 -6
  45. package/dist/src/executors/build-ios/build-ios.impl.js +0 -60
  46. package/dist/src/executors/build-ios/schema.d.ts +0 -17
  47. package/dist/src/executors/build-ios/schema.json +0 -92
  48. package/dist/src/executors/bundle/bundle.impl.d.ts +0 -6
  49. package/dist/src/executors/bundle/bundle.impl.js +0 -61
  50. package/dist/src/executors/bundle/schema.d.ts +0 -16
  51. package/dist/src/executors/bundle/schema.json +0 -93
  52. package/dist/src/executors/pod-install/pod-install.impl.d.ts +0 -6
  53. package/dist/src/executors/pod-install/pod-install.impl.js +0 -13
  54. package/dist/src/executors/pod-install/schema.d.ts +0 -6
  55. package/dist/src/executors/pod-install/schema.json +0 -34
  56. package/dist/src/executors/run-android/run-android.impl.d.ts +0 -6
  57. package/dist/src/executors/run-android/run-android.impl.js +0 -71
  58. package/dist/src/executors/run-android/schema.d.ts +0 -12
  59. package/dist/src/executors/run-android/schema.json +0 -102
  60. package/dist/src/executors/run-ios/run-ios.impl.d.ts +0 -6
  61. package/dist/src/executors/run-ios/run-ios.impl.js +0 -70
  62. package/dist/src/executors/run-ios/schema.d.ts +0 -7
  63. package/dist/src/executors/run-ios/schema.json +0 -98
  64. package/dist/src/executors/start/lib/is-packager-running.d.ts +0 -1
  65. package/dist/src/executors/start/lib/is-packager-running.js +0 -13
  66. package/dist/src/executors/start/schema.d.ts +0 -7
  67. package/dist/src/executors/start/schema.json +0 -30
  68. package/dist/src/executors/start/start.impl.d.ts +0 -9
  69. package/dist/src/executors/start/start.impl.js +0 -91
  70. package/dist/src/executors/upgrade/schema.d.ts +0 -1
  71. package/dist/src/executors/upgrade/schema.json +0 -12
  72. package/dist/src/executors/upgrade/upgrade.impl.d.ts +0 -12
  73. package/dist/src/executors/upgrade/upgrade.impl.js +0 -51
  74. package/dist/src/utils/deprecation.d.ts +0 -2
  75. package/dist/src/utils/deprecation.js +0 -19
  76. package/dist/src/utils/get-cli-options.d.ts +0 -8
  77. package/dist/src/utils/get-cli-options.js +0 -32
@@ -1,70 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = runIosExecutor;
4
- const internal_1 = require("@nx/devkit/internal");
5
- const path_1 = require("path");
6
- const child_process_1 = require("child_process");
7
- const os_1 = require("os");
8
- const start_impl_1 = require("../start/start.impl");
9
- const get_cli_options_1 = require("../../utils/get-cli-options");
10
- const deprecation_1 = require("../../utils/deprecation");
11
- async function* runIosExecutor(options, context) {
12
- (0, deprecation_1.warnReactNativeExecutorDeprecation)('run-ios');
13
- if ((0, os_1.platform)() !== 'darwin') {
14
- throw new Error(`The run-ios build requires Mac to run`);
15
- }
16
- const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
17
- const tasks = [runCliRunIOS(context.root, projectRoot, options)];
18
- if (options.mode !== 'Release') {
19
- tasks.push((0, start_impl_1.runCliStart)(context.root, projectRoot, {
20
- port: options.port,
21
- resetCache: options.resetCache,
22
- interactive: true,
23
- }));
24
- }
25
- await Promise.all(tasks);
26
- yield { success: true };
27
- }
28
- function runCliRunIOS(workspaceRoot, projectRoot, options) {
29
- return new Promise((resolve, reject) => {
30
- /**
31
- * Call the react native cli with option `--no-packager`
32
- * Not passing '--packager' due to cli will launch start command from the project root
33
- */
34
- const childProcess = (0, child_process_1.fork)(require.resolve('react-native/cli.js'), ['run-ios', ...createRunIOSOptions(options), '--no-packager'], {
35
- stdio: 'inherit',
36
- cwd: (0, path_1.resolve)(workspaceRoot, projectRoot),
37
- env: { ...process.env, RCT_METRO_PORT: options.port.toString() },
38
- });
39
- /**
40
- * Ensure the child process is killed when the parent exits
41
- */
42
- const processExitListener = (signal) => () => {
43
- childProcess.kill(signal);
44
- process.exit();
45
- };
46
- process.once('exit', (signal) => childProcess.kill(signal));
47
- process.once('SIGTERM', processExitListener);
48
- process.once('SIGINT', processExitListener);
49
- process.once('SIGQUIT', processExitListener);
50
- childProcess.on('error', (err) => {
51
- reject(err);
52
- });
53
- childProcess.on('exit', (code, signal) => {
54
- if (code === null)
55
- code = (0, internal_1.signalToCode)(signal);
56
- if (code === 0) {
57
- resolve(childProcess);
58
- }
59
- else {
60
- reject(code);
61
- }
62
- });
63
- });
64
- }
65
- const startOptions = ['port', 'resetCache'];
66
- function createRunIOSOptions(options) {
67
- return (0, get_cli_options_1.getCliOptions)(options, startOptions, [
68
- 'buildFolder',
69
- ]);
70
- }
@@ -1,7 +0,0 @@
1
- import { ReactNativeBuildIosOptions } from '../build-ios/schema';
2
- import { ReactNativeStartOptions } from '../start/schema';
3
-
4
- // part of options form https://github.com/react-native-community/cli/blob/main/packages/cli-platform-ios/src/commands/runIOS/index.ts
5
- export interface ReactNativeRunIosOptions extends ReactNativeBuildIosOptions {
6
- binaryPath?: string;
7
- }
@@ -1,98 +0,0 @@
1
- {
2
- "version": 2,
3
- "continuous": true,
4
- "outputCapture": "direct-nodejs",
5
- "cli": "nx",
6
- "$id": "NxReactNativeRunIos",
7
- "$schema": "https://json-schema.org/schema",
8
- "title": "Run iOS application",
9
- "description": "Run iOS target options.",
10
- "type": "object",
11
- "x-deprecated": "The `@nx/react-native:run-ios` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/react-native:convert-to-inferred` to migrate to the `@nx/react-native/plugin` inferred plugin. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.",
12
- "presets": [
13
- {
14
- "name": "Run iOS on a simulator",
15
- "keys": ["simulator"]
16
- },
17
- {
18
- "name": "Run iOS on a device",
19
- "keys": ["device"]
20
- },
21
- {
22
- "name": "Run iOS on a device with udid",
23
- "keys": ["udid"]
24
- }
25
- ],
26
- "properties": {
27
- "simulator": {
28
- "type": "string",
29
- "description": "Explicitly set simulator to use. Optionally include iOS version between parenthesis at the end to match an exact version: \"iPhone 6 (10.0)\"",
30
- "examples": [
31
- "iPhone 14",
32
- "iPhone 13",
33
- "iPhone 12",
34
- "iPhone 11",
35
- "iPhone X"
36
- ],
37
- "x-priority": "important"
38
- },
39
- "mode": {
40
- "type": "string",
41
- "description": "Explicitly set the scheme configuration to use",
42
- "default": "Debug",
43
- "examples": ["Debug", "Release"],
44
- "x-priority": "important"
45
- },
46
- "scheme": {
47
- "type": "string",
48
- "description": "Explicitly set Xcode scheme to use"
49
- },
50
- "device": {
51
- "type": "string",
52
- "description": "Explicitly set device to use by name. The value is not required if you have a single device connected."
53
- },
54
- "udid": {
55
- "type": "string",
56
- "description": "Explicitly set device to use by udid"
57
- },
58
- "verbose": {
59
- "type": "boolean",
60
- "description": "Do not use xcbeautify or xcpretty even if installed"
61
- },
62
- "port": {
63
- "type": "number",
64
- "description": "The port where the packager server is listening on.",
65
- "default": 8081
66
- },
67
- "xcconfig": {
68
- "type": "string",
69
- "description": "Explicitly set xcconfig to use"
70
- },
71
- "buildFolder": {
72
- "type": "string",
73
- "description": "Location for iOS build artifacts. Corresponds to Xcode's \"-derivedDataPath\". Relative to ios directory.",
74
- "buildFolder": "./build"
75
- },
76
- "interactive": {
77
- "type": "boolean",
78
- "description": "Explicitly select which scheme and configuration to use before running a build"
79
- },
80
- "extraParams": {
81
- "oneOf": [
82
- { "type": "array", "items": { "type": "string" } },
83
- { "type": "string" }
84
- ],
85
- "description": "Custom params that will be passed to xcodebuild command."
86
- },
87
- "resetCache": {
88
- "type": "boolean",
89
- "description": "Resets metro cache.",
90
- "default": false
91
- },
92
- "binaryPath": {
93
- "type": "string",
94
- "description": "Path relative to project root where pre-built .app binary lives."
95
- }
96
- },
97
- "examplesFile": "../../../docs/run-ios-examples.md"
98
- }
@@ -1 +0,0 @@
1
- export declare function isPackagerRunning(packagerPort: number): Promise<'running' | 'not_running' | 'unrecognized'>;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isPackagerRunning = isPackagerRunning;
4
- async function isPackagerRunning(packagerPort) {
5
- try {
6
- const resp = await fetch(`http://localhost:${packagerPort}/status`);
7
- const data = await resp.text();
8
- return data === 'packager-status:running' ? 'running' : 'unrecognized';
9
- }
10
- catch {
11
- return 'not_running';
12
- }
13
- }
@@ -1,7 +0,0 @@
1
- // options from https://github.com/facebook/react-native/blob/main/packages/community-cli-plugin/src/commands/start/index.js
2
-
3
- export interface ReactNativeStartOptions {
4
- port: number;
5
- resetCache: boolean; // default is false
6
- interactive: boolean; // default is true
7
- }
@@ -1,30 +0,0 @@
1
- {
2
- "version": 2,
3
- "continuous": true,
4
- "outputCapture": "direct-nodejs",
5
- "cli": "nx",
6
- "$id": "NxReactNativeStart",
7
- "$schema": "https://json-schema.org/schema",
8
- "title": "Packager Server for React Native",
9
- "description": "Packager Server target options.",
10
- "type": "object",
11
- "x-deprecated": "The `@nx/react-native:start` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/react-native:convert-to-inferred` to migrate to the `@nx/react-native/plugin` inferred plugin. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.",
12
- "properties": {
13
- "port": {
14
- "type": "number",
15
- "description": "The port to listen on.",
16
- "default": 8081
17
- },
18
- "resetCache": {
19
- "type": "boolean",
20
- "description": "Resets metro cache.",
21
- "default": false
22
- },
23
- "interactive": {
24
- "type": "boolean",
25
- "description": "Run packager server in interactive mode.",
26
- "default": true
27
- }
28
- },
29
- "examplesFile": "../../../docs/start-examples.md"
30
- }
@@ -1,9 +0,0 @@
1
- import { ExecutorContext } from '@nx/devkit';
2
- import { ChildProcess } from 'child_process';
3
- import { ReactNativeStartOptions } from './schema';
4
- export interface ReactNativeStartOutput {
5
- port?: number;
6
- success: boolean;
7
- }
8
- export default function startExecutor(options: ReactNativeStartOptions, context: ExecutorContext): AsyncGenerator<ReactNativeStartOutput>;
9
- export declare function runCliStart(workspaceRoot: string, projectRoot: string, options: ReactNativeStartOptions): Promise<ChildProcess>;
@@ -1,91 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = startExecutor;
4
- exports.runCliStart = runCliStart;
5
- const devkit_1 = require("@nx/devkit");
6
- const internal_1 = require("@nx/devkit/internal");
7
- const child_process_1 = require("child_process");
8
- const path_1 = require("path");
9
- const is_packager_running_1 = require("./lib/is-packager-running");
10
- const deprecation_1 = require("../../utils/deprecation");
11
- async function* startExecutor(options, context) {
12
- (0, deprecation_1.warnReactNativeExecutorDeprecation)('start');
13
- const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
14
- await runCliStart(context.root, projectRoot, options);
15
- yield {
16
- port: options.port,
17
- success: true,
18
- };
19
- }
20
- /*
21
- * Starts the JS bundler and checks for "running" status before notifying
22
- * that packager has started.
23
- */
24
- async function runCliStart(workspaceRoot, projectRoot, options) {
25
- const result = await (0, is_packager_running_1.isPackagerRunning)(options.port);
26
- if (result === 'running') {
27
- devkit_1.logger.info(`JS server already running on port ${options.port}.`);
28
- }
29
- else if (result === 'unrecognized') {
30
- devkit_1.logger.warn('JS server not recognized.');
31
- }
32
- else {
33
- // result === 'not_running'
34
- devkit_1.logger.info('Starting JS server...');
35
- try {
36
- return await startAsync(workspaceRoot, projectRoot, options);
37
- }
38
- catch (error) {
39
- devkit_1.logger.error(`Failed to start the packager server. Error details: ${error.message ?? error}`);
40
- throw error;
41
- }
42
- }
43
- }
44
- function startAsync(workspaceRoot, projectRoot, options) {
45
- return new Promise((resolve, reject) => {
46
- const childProcess = (0, child_process_1.fork)(require.resolve('react-native/cli.js'), ['start', ...createStartOptions(options)], {
47
- cwd: (0, path_1.resolve)(workspaceRoot, projectRoot),
48
- env: process.env,
49
- stdio: 'inherit',
50
- });
51
- childProcess.on('error', (err) => {
52
- reject(err);
53
- });
54
- childProcess.on('exit', (code, signal) => {
55
- if (code === null)
56
- code = (0, internal_1.signalToCode)(signal);
57
- if (code === 0) {
58
- resolve(childProcess);
59
- }
60
- else {
61
- reject(code);
62
- }
63
- });
64
- const processExitListener = (signal) => () => {
65
- childProcess.kill(signal);
66
- process.exit();
67
- };
68
- process.once('exit', (signal) => childProcess.kill(signal));
69
- process.once('SIGTERM', processExitListener);
70
- process.once('SIGINT', processExitListener);
71
- process.once('SIGQUIT', processExitListener);
72
- });
73
- }
74
- function createStartOptions(options) {
75
- return Object.keys(options).reduce((acc, k) => {
76
- if (k === 'resetCache') {
77
- if (options[k] === true) {
78
- acc.push(`--reset-cache`);
79
- }
80
- }
81
- else if (k === 'interactive') {
82
- if (options[k] === false) {
83
- acc.push(`--no-interactive`);
84
- }
85
- }
86
- else {
87
- acc.push(`--${k}`, options[k]);
88
- }
89
- return acc;
90
- }, []);
91
- }
@@ -1 +0,0 @@
1
- export interface UpgradeExecutorSchema {}
@@ -1,12 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/schema",
3
- "version": 2,
4
- "cli": "nx",
5
- "$id": "NxReactNativeUpgrade",
6
- "title": "React Native Upgrade Executor",
7
- "description": "Upgrade React Native code for project.",
8
- "type": "object",
9
- "x-deprecated": "The `@nx/react-native:upgrade` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/react-native:convert-to-inferred` to migrate to the `@nx/react-native/plugin` inferred plugin. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.",
10
- "properties": {},
11
- "required": []
12
- }
@@ -1,12 +0,0 @@
1
- import { ExecutorContext } from '@nx/devkit';
2
- import { ChildProcess } from 'child_process';
3
- import { UpgradeExecutorSchema } from './schema';
4
- export interface ReactNativeUpgradeOutput {
5
- success: boolean;
6
- }
7
- /**
8
- * This executor is equivalent to `npx react-native upgrade`.
9
- * https://github.com/react-native-community/cli/blob/main/packages/cli/src/commands/upgrade/upgrade.ts
10
- */
11
- export default function upgradeExecutor(options: UpgradeExecutorSchema, context: ExecutorContext): AsyncGenerator<ReactNativeUpgradeOutput>;
12
- export declare function runCliUpgrade(workspaceRoot: string, projectRoot: string): Promise<ChildProcess>;
@@ -1,51 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = upgradeExecutor;
4
- exports.runCliUpgrade = runCliUpgrade;
5
- const internal_1 = require("@nx/devkit/internal");
6
- const path_1 = require("path");
7
- const child_process_1 = require("child_process");
8
- const deprecation_1 = require("../../utils/deprecation");
9
- /**
10
- * This executor is equivalent to `npx react-native upgrade`.
11
- * https://github.com/react-native-community/cli/blob/main/packages/cli/src/commands/upgrade/upgrade.ts
12
- */
13
- async function* upgradeExecutor(options, context) {
14
- (0, deprecation_1.warnReactNativeExecutorDeprecation)('upgrade');
15
- const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
16
- await runCliUpgrade(context.root, projectRoot);
17
- yield { success: true };
18
- }
19
- function runCliUpgrade(workspaceRoot, projectRoot) {
20
- return new Promise((resolve, reject) => {
21
- const childProcess = (0, child_process_1.fork)(require.resolve('react-native/cli.js'), ['upgrade'], {
22
- stdio: 'inherit',
23
- cwd: (0, path_1.resolve)(workspaceRoot, projectRoot),
24
- env: process.env,
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, signal) => {
41
- if (code === null)
42
- code = (0, internal_1.signalToCode)(signal);
43
- if (code === 0) {
44
- resolve(childProcess);
45
- }
46
- else {
47
- reject(code);
48
- }
49
- });
50
- });
51
- }
@@ -1,2 +0,0 @@
1
- export declare function warnReactNativeExecutorDeprecation(executorName: string): void;
2
- export declare function warnReactNativeExecutorGenerating(): void;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.warnReactNativeExecutorDeprecation = warnReactNativeExecutorDeprecation;
4
- exports.warnReactNativeExecutorGenerating = warnReactNativeExecutorGenerating;
5
- const devkit_1 = require("@nx/devkit");
6
- // TODO(v24): Remove the @nx/react-native:build-android, :build-ios, :bundle,
7
- // :pod-install, :run-android, :run-ios, :start, and :upgrade executors. The
8
- // inferred plugin (@nx/react-native/plugin) and the convert-to-inferred
9
- // generator stay supported. (`:storybook`, `:sync-deps`, and `:ensure-symlink`
10
- // are Nx-specific glue with no inferred replacement and stay as-is.)
11
- function buildMessage(executorName) {
12
- return `The \`@nx/react-native:${executorName}\` executor is deprecated and will be removed in Nx v24. Run \`nx g @nx/react-native:convert-to-inferred\` to migrate to the \`@nx/react-native/plugin\` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.`;
13
- }
14
- function warnReactNativeExecutorDeprecation(executorName) {
15
- devkit_1.logger.warn(buildMessage(executorName));
16
- }
17
- function warnReactNativeExecutorGenerating() {
18
- devkit_1.logger.warn('Generating targets that use the deprecated `@nx/react-native:build-android`, `@nx/react-native:build-ios`, `@nx/react-native:bundle`, `@nx/react-native:pod-install`, `@nx/react-native:run-android`, `@nx/react-native:run-ios`, `@nx/react-native:start`, and `@nx/react-native:upgrade` executors. These executors will be removed in Nx v24. Run `nx g @nx/react-native:convert-to-inferred` next to migrate these targets to the `@nx/react-native/plugin` inferred plugin and prevent future generators from emitting executor targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.');
19
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * This function normalizes the options passed in to the Nx and returns an array of strings that can be passed to the React Native CLI.
3
- * @param options Nx options
4
- * @param optionKeysToIgnore Keys to ignore
5
- * @param optionKeysInCamelName Keys that are in camel case. Most react native cli options are in kebab case, but some are in camel case.
6
- * @returns options that can be passed to the React Native CLI
7
- */
8
- export declare function getCliOptions<T>(options: T, optionKeysToIgnore?: string[], optionKeysInCamelName?: string[]): string[];
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCliOptions = getCliOptions;
4
- const devkit_1 = require("@nx/devkit");
5
- /**
6
- * This function normalizes the options passed in to the Nx and returns an array of strings that can be passed to the React Native CLI.
7
- * @param options Nx options
8
- * @param optionKeysToIgnore Keys to ignore
9
- * @param optionKeysInCamelName Keys that are in camel case. Most react native cli options are in kebab case, but some are in camel case.
10
- * @returns options that can be passed to the React Native CLI
11
- */
12
- function getCliOptions(options, optionKeysToIgnore = [], optionKeysInCamelName = []) {
13
- return Object.keys(options).reduce((acc, optionKey) => {
14
- const optionValue = options[optionKey];
15
- if (!optionKeysToIgnore.includes(optionKey)) {
16
- const cliKey = optionKeysInCamelName.includes(optionKey)
17
- ? (0, devkit_1.names)(optionKey).propertyName
18
- : (0, devkit_1.names)(optionKey).fileName; // cli uses kebab case as default
19
- if (Array.isArray(optionValue)) {
20
- acc.push(`--${cliKey}`, optionValue.join(','));
21
- }
22
- else if (typeof optionValue === 'boolean' && optionValue) {
23
- // no need to pass in the value when it is true, just the flag name
24
- acc.push(`--${cliKey}`);
25
- }
26
- else {
27
- acc.push(`--${cliKey}`, optionValue);
28
- }
29
- }
30
- return acc;
31
- }, []);
32
- }