@nx/react-native 24.0.0-beta.2 → 24.0.0-beta.3

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 (71) hide show
  1. package/dist/src/generators/application/application.js +2 -3
  2. package/dist/src/generators/application/lib/add-project.js +1 -83
  3. package/dist/src/generators/application/lib/normalize-options.js +0 -4
  4. package/dist/src/generators/application/schema.d.ts +0 -1
  5. package/dist/src/generators/convert-to-inferred/lib/create-process-options.d.ts +2 -2
  6. package/dist/src/generators/convert-to-inferred/lib/create-process-options.js +2 -2
  7. package/dist/src/generators/init/init.js +44 -53
  8. package/dist/src/generators/init/schema.d.ts +0 -1
  9. package/dist/src/generators/library/lib/normalize-options.js +0 -5
  10. package/dist/src/generators/library/library.js +2 -3
  11. package/dist/src/generators/library/schema.d.ts +0 -1
  12. package/dist/src/generators/web-configuration/files/base-vite/vite.config.mts__tmpl__ +6 -5
  13. package/dist/src/generators/web-configuration/files/base-webpack/webpack.config.js__tmpl__ +2 -51
  14. package/dist/src/generators/web-configuration/lib/webpack-targets.d.ts +1 -3
  15. package/dist/src/generators/web-configuration/lib/webpack-targets.js +0 -57
  16. package/dist/src/generators/web-configuration/web-configuration.js +9 -18
  17. package/dist/src/migrations/update-24-0-0/finish-inferred-conversion.md +12 -0
  18. package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.d.ts +6 -0
  19. package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.js +30 -0
  20. package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.md +68 -0
  21. package/dist/src/utils/add-jest.d.ts +1 -1
  22. package/dist/src/utils/add-jest.js +1 -2
  23. package/dist/src/utils/add-linting.d.ts +0 -1
  24. package/dist/src/utils/add-linting.js +0 -1
  25. package/dist/src/utils/chmod-android-gradle-files.d.ts +0 -1
  26. package/dist/src/utils/chmod-android-gradle-files.js +0 -1
  27. package/dist/src/utils/pod-install-task.d.ts +0 -6
  28. package/dist/src/utils/pod-install-task.js +0 -1
  29. package/dist/src/utils/versions.d.ts +1 -0
  30. package/dist/src/utils/versions.js +2 -1
  31. package/executors.json +0 -40
  32. package/migrations.json +7 -0
  33. package/package.json +9 -9
  34. package/dist/src/executors/build-android/build-android.impl.d.ts +0 -6
  35. package/dist/src/executors/build-android/build-android.impl.js +0 -53
  36. package/dist/src/executors/build-android/schema.d.ts +0 -13
  37. package/dist/src/executors/build-android/schema.json +0 -82
  38. package/dist/src/executors/build-ios/build-ios.impl.d.ts +0 -6
  39. package/dist/src/executors/build-ios/build-ios.impl.js +0 -60
  40. package/dist/src/executors/build-ios/schema.d.ts +0 -17
  41. package/dist/src/executors/build-ios/schema.json +0 -92
  42. package/dist/src/executors/bundle/bundle.impl.d.ts +0 -6
  43. package/dist/src/executors/bundle/bundle.impl.js +0 -61
  44. package/dist/src/executors/bundle/schema.d.ts +0 -16
  45. package/dist/src/executors/bundle/schema.json +0 -93
  46. package/dist/src/executors/pod-install/pod-install.impl.d.ts +0 -6
  47. package/dist/src/executors/pod-install/pod-install.impl.js +0 -13
  48. package/dist/src/executors/pod-install/schema.d.ts +0 -6
  49. package/dist/src/executors/pod-install/schema.json +0 -34
  50. package/dist/src/executors/run-android/run-android.impl.d.ts +0 -6
  51. package/dist/src/executors/run-android/run-android.impl.js +0 -71
  52. package/dist/src/executors/run-android/schema.d.ts +0 -12
  53. package/dist/src/executors/run-android/schema.json +0 -102
  54. package/dist/src/executors/run-ios/run-ios.impl.d.ts +0 -6
  55. package/dist/src/executors/run-ios/run-ios.impl.js +0 -70
  56. package/dist/src/executors/run-ios/schema.d.ts +0 -7
  57. package/dist/src/executors/run-ios/schema.json +0 -98
  58. package/dist/src/executors/start/lib/is-packager-running.d.ts +0 -1
  59. package/dist/src/executors/start/lib/is-packager-running.js +0 -13
  60. package/dist/src/executors/start/schema.d.ts +0 -7
  61. package/dist/src/executors/start/schema.json +0 -30
  62. package/dist/src/executors/start/start.impl.d.ts +0 -9
  63. package/dist/src/executors/start/start.impl.js +0 -91
  64. package/dist/src/executors/upgrade/schema.d.ts +0 -1
  65. package/dist/src/executors/upgrade/schema.json +0 -12
  66. package/dist/src/executors/upgrade/upgrade.impl.d.ts +0 -12
  67. package/dist/src/executors/upgrade/upgrade.impl.js +0 -51
  68. package/dist/src/utils/deprecation.d.ts +0 -2
  69. package/dist/src/utils/deprecation.js +0 -19
  70. package/dist/src/utils/get-cli-options.d.ts +0 -8
  71. package/dist/src/utils/get-cli-options.js +0 -32
@@ -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
- }