@nx/react-native 0.0.0-pr-31222-862e973 → 0.0.0-pr-31313-387cdca

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 (97) hide show
  1. package/.eslintrc.json +4 -0
  2. package/LICENSE +1 -1
  3. package/README.md +1 -1
  4. package/generators.json +1 -1
  5. package/migrations.json +69 -335
  6. package/package.json +8 -10
  7. package/plugin.d.ts +1 -1
  8. package/plugin.js +2 -2
  9. package/plugins/metro-resolver.js +11 -11
  10. package/plugins/plugin.d.ts +2 -2
  11. package/plugins/plugin.js +57 -34
  12. package/project.json +2 -8
  13. package/src/executors/run-android/schema.json +1 -0
  14. package/src/executors/run-ios/schema.json +1 -0
  15. package/src/executors/start/lib/is-packager-running.js +1 -2
  16. package/src/executors/start/schema.json +1 -0
  17. package/src/executors/storybook/storybook.impl.js +3 -3
  18. package/src/executors/sync-deps/sync-deps.impl.js +4 -4
  19. package/src/generators/application/application.js +24 -4
  20. package/src/generators/application/files/app/.babelrc.js.template +1 -1
  21. package/src/generators/application/files/app/Gemfile.template +4 -4
  22. package/src/generators/application/files/app/android/app/build.gradle.template +9 -8
  23. package/src/generators/application/files/app/android/app/src/main/AndroidManifest.xml.template +1 -0
  24. package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainApplication.kt.template +7 -6
  25. package/src/generators/application/files/app/android/build.gradle.template +4 -4
  26. package/src/generators/application/files/app/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  27. package/src/generators/application/files/app/android/gradle.properties +1 -3
  28. package/src/generators/application/files/app/android/gradlew.bat +94 -92
  29. package/src/generators/application/files/app/android/gradlew.template +5 -2
  30. package/src/generators/application/files/app/android/settings.gradle.template +3 -1
  31. package/src/generators/application/files/app/tsconfig.app.json.template +11 -1
  32. package/src/generators/application/files/app/tsconfig.json.template +2 -0
  33. package/src/generators/application/lib/add-e2e.js +2 -1
  34. package/src/generators/application/lib/add-project.js +26 -3
  35. package/src/generators/application/lib/normalize-options.d.ts +3 -1
  36. package/src/generators/application/lib/normalize-options.js +9 -5
  37. package/src/generators/application/schema.d.ts +6 -5
  38. package/src/generators/application/schema.json +20 -18
  39. package/src/generators/component/component.d.ts +0 -1
  40. package/src/generators/component/component.js +20 -29
  41. package/src/generators/component/files/js/__fileName__.__ext__ +28 -0
  42. package/src/generators/component/files/{__fileName__.tsx__tmpl__ → ts/__fileName__.__ext__} +6 -6
  43. package/src/generators/component/files/ts/__fileName__.spec.__ext__ +11 -0
  44. package/src/generators/component/lib/normalize-options.d.ts +6 -1
  45. package/src/generators/component/lib/normalize-options.js +13 -26
  46. package/src/generators/component/schema.d.ts +6 -14
  47. package/src/generators/component/schema.json +26 -40
  48. package/src/generators/convert-to-inferred/convert-to-inferred.js +1 -1
  49. package/src/generators/init/init.js +1 -1
  50. package/src/generators/library/files/lib/tsconfig.json.template +2 -0
  51. package/src/generators/library/files/lib/tsconfig.lib.json.template +11 -1
  52. package/src/generators/library/lib/normalize-options.d.ts +2 -0
  53. package/src/generators/library/lib/normalize-options.js +6 -3
  54. package/src/generators/library/library.js +119 -60
  55. package/src/generators/library/schema.d.ts +3 -5
  56. package/src/generators/library/schema.json +17 -21
  57. package/src/generators/storybook-configuration/schema.json +2 -1
  58. package/src/generators/web-configuration/files/base-vite/.babelrc.js.template +1 -1
  59. package/src/generators/web-configuration/files/base-vite/vite.config.ts__tmpl__ +4 -9
  60. package/src/generators/web-configuration/files/base-webpack/.babelrc.js.template +1 -1
  61. package/src/generators/web-configuration/files/base-webpack/webpack.config.js__tmpl__ +4 -0
  62. package/src/generators/web-configuration/schema.json +1 -1
  63. package/src/generators/web-configuration/web-configuration.js +7 -0
  64. package/src/utils/add-jest.d.ts +1 -1
  65. package/src/utils/add-jest.js +2 -1
  66. package/src/utils/add-linting.js +3 -2
  67. package/src/utils/ensure-dependencies.js +2 -0
  68. package/src/utils/pod-install-task.js +6 -6
  69. package/src/utils/testing-generators.js +2 -4
  70. package/src/utils/versions.d.ts +17 -13
  71. package/src/utils/versions.js +18 -14
  72. package/src/generators/library/files/lib/package.json.template +0 -4
  73. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +0 -2
  74. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +0 -9
  75. package/src/migrations/update-16-1-0/upgrade-storybook-6-5.d.ts +0 -6
  76. package/src/migrations/update-16-1-0/upgrade-storybook-6-5.js +0 -21
  77. package/src/migrations/update-16-6-0/add-depends-on.d.ts +0 -6
  78. package/src/migrations/update-16-6-0/add-depends-on.js +0 -63
  79. package/src/migrations/update-16-6-0/update-metro-config.d.ts +0 -6
  80. package/src/migrations/update-16-6-0/update-metro-config.js +0 -63
  81. package/src/migrations/update-16-9-0/remove-types-react-native.d.ts +0 -7
  82. package/src/migrations/update-16-9-0/remove-types-react-native.js +0 -13
  83. package/src/migrations/update-18-0-0/add-upgrade-target.d.ts +0 -6
  84. package/src/migrations/update-18-0-0/add-upgrade-target.js +0 -31
  85. package/src/migrations/update-18-0-0/add-web-configuration.d.ts +0 -8
  86. package/src/migrations/update-18-0-0/add-web-configuration.js +0 -33
  87. package/src/migrations/update-18-0-0/change-storybook-targets.d.ts +0 -5
  88. package/src/migrations/update-18-0-0/change-storybook-targets.js +0 -57
  89. package/src/migrations/update-18-0-0/remove-block-list.d.ts +0 -6
  90. package/src/migrations/update-18-0-0/remove-block-list.js +0 -28
  91. package/src/migrations/update-18-0-0/remove-metro.d.ts +0 -14
  92. package/src/migrations/update-18-0-0/remove-metro.js +0 -29
  93. package/src/migrations/update-18-0-0/remove-symlink-target.d.ts +0 -6
  94. package/src/migrations/update-18-0-0/remove-symlink-target.js +0 -30
  95. package/src/utils/format-file.d.ts +0 -1
  96. package/src/utils/format-file.js +0 -15
  97. /package/src/generators/component/files/{__fileName__.spec.tsx__tmpl__ → js/__fileName__.spec.__ext__} +0 -0
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getResolveRequest = getResolveRequest;
4
4
  const metroResolver = require("metro-resolver");
5
5
  const tsconfig_paths_1 = require("tsconfig-paths");
6
- const chalk = require("chalk");
6
+ const pc = require("picocolors");
7
7
  const enhanced_resolve_1 = require("enhanced-resolve");
8
8
  const path_1 = require("path");
9
9
  const fs = require("fs");
@@ -26,9 +26,9 @@ function getResolveRequest(extensions, exportsConditionNames = [], mainFields =
26
26
  return resolvedPath;
27
27
  }
28
28
  if (debug) {
29
- console.log(chalk.red(`[Nx] Unable to resolve with any resolver: ${realModuleName}`));
29
+ console.log(pc.red(`[Nx] Unable to resolve with any resolver: ${realModuleName}`));
30
30
  }
31
- throw new Error(`Cannot resolve ${chalk.bold(realModuleName)}`);
31
+ throw new Error(`Cannot resolve ${pc.bold(realModuleName)}`);
32
32
  };
33
33
  }
34
34
  function resolveRequestFromContext(resolveRequest, context, realModuleName, platform, debug) {
@@ -37,7 +37,7 @@ function resolveRequestFromContext(resolveRequest, context, realModuleName, plat
37
37
  }
38
38
  catch {
39
39
  if (debug)
40
- console.log(chalk.cyan(`[Nx] Unable to resolve with default resolveRequest: ${realModuleName}`));
40
+ console.log(pc.cyan(`[Nx] Unable to resolve with default resolveRequest: ${realModuleName}`));
41
41
  }
42
42
  }
43
43
  /**
@@ -50,7 +50,7 @@ function defaultMetroResolver(context, realModuleName, platform, debug) {
50
50
  }
51
51
  catch {
52
52
  if (debug)
53
- console.log(chalk.cyan(`[Nx] Unable to resolve with default Metro resolver: ${realModuleName}`));
53
+ console.log(pc.cyan(`[Nx] Unable to resolve with default Metro resolver: ${realModuleName}`));
54
54
  }
55
55
  }
56
56
  /**
@@ -69,7 +69,7 @@ function pnpmResolver(extensions, context, realModuleName, debug, exportsConditi
69
69
  }
70
70
  catch {
71
71
  if (debug)
72
- console.log(chalk.cyan(`[Nx] Unable to resolve with default PNPM resolver: ${realModuleName}`));
72
+ console.log(pc.cyan(`[Nx] Unable to resolve with default PNPM resolver: ${realModuleName}`));
73
73
  }
74
74
  }
75
75
  /**
@@ -84,8 +84,8 @@ function tsconfigPathsResolver(context, extensions, realModuleName, platform, de
84
84
  }
85
85
  catch {
86
86
  if (debug) {
87
- console.log(chalk.cyan(`[Nx] Failed to resolve ${chalk.bold(realModuleName)}`));
88
- console.log(chalk.cyan(`[Nx] The following tsconfig paths was used:\n:${chalk.bold(JSON.stringify(paths, null, 2))}`));
87
+ console.log(pc.cyan(`[Nx] Failed to resolve ${pc.bold(realModuleName)}`));
88
+ console.log(pc.cyan(`[Nx] The following tsconfig paths was used:\n:${pc.bold(JSON.stringify(paths, null, 2))}`));
89
89
  }
90
90
  }
91
91
  }
@@ -99,13 +99,13 @@ function getMatcher(debug) {
99
99
  absoluteBaseUrl = result.absoluteBaseUrl;
100
100
  paths = result.paths;
101
101
  if (debug) {
102
- console.log(chalk.cyan(`[Nx] Located tsconfig at ${chalk.bold(absoluteBaseUrl)}`));
103
- console.log(chalk.cyan(`[Nx] Found the following paths:\n:${chalk.bold(JSON.stringify(paths, null, 2))}`));
102
+ console.log(pc.cyan(`[Nx] Located tsconfig at ${pc.bold(absoluteBaseUrl)}`));
103
+ console.log(pc.cyan(`[Nx] Found the following paths:\n:${pc.bold(JSON.stringify(paths, null, 2))}`));
104
104
  }
105
105
  matcher = (0, tsconfig_paths_1.createMatchPath)(absoluteBaseUrl, paths);
106
106
  }
107
107
  else {
108
- console.log(chalk.cyan(`[Nx] Failed to locate tsconfig}`));
108
+ console.log(pc.cyan(`[Nx] Failed to locate tsconfig}`));
109
109
  throw new Error(`Could not load tsconfig for project`);
110
110
  }
111
111
  }
@@ -1,4 +1,4 @@
1
- import { CreateDependencies, CreateNodes } from '@nx/devkit';
1
+ import { CreateNodes, CreateNodesV2 } from '@nx/devkit';
2
2
  export interface ReactNativePluginOptions {
3
3
  startTargetName?: string;
4
4
  podInstallTargetName?: string;
@@ -10,5 +10,5 @@ export interface ReactNativePluginOptions {
10
10
  syncDepsTargetName?: string;
11
11
  upgradeTargetName?: string;
12
12
  }
13
- export declare const createDependencies: CreateDependencies;
13
+ export declare const createNodesV2: CreateNodesV2<ReactNativePluginOptions>;
14
14
  export declare const createNodes: CreateNodes<ReactNativePluginOptions>;
package/plugins/plugin.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createNodes = exports.createDependencies = void 0;
3
+ exports.createNodes = exports.createNodesV2 = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const path_1 = require("path");
6
6
  const js_1 = require("@nx/js");
@@ -9,54 +9,75 @@ const fs_1 = require("fs");
9
9
  const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculate-hash-for-create-nodes");
10
10
  const cache_directory_1 = require("nx/src/utils/cache-directory");
11
11
  const config_utils_1 = require("@nx/devkit/src/utils/config-utils");
12
- const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, 'react-native.hash');
13
- const targetsCache = readTargetsCache();
14
- function readTargetsCache() {
12
+ const devkit_internals_1 = require("nx/src/devkit-internals");
13
+ function readTargetsCache(cachePath) {
15
14
  return (0, fs_1.existsSync)(cachePath) ? (0, devkit_1.readJsonFile)(cachePath) : {};
16
15
  }
17
- function writeTargetsToCache() {
18
- const oldCache = readTargetsCache();
16
+ function writeTargetsToCache(cachePath, targetsCache) {
17
+ const oldCache = readTargetsCache(cachePath);
19
18
  (0, devkit_1.writeJsonFile)(cachePath, {
20
19
  ...oldCache,
21
- ...targetsCache,
20
+ targetsCache,
22
21
  });
23
22
  }
24
- const createDependencies = () => {
25
- writeTargetsToCache();
26
- return [];
27
- };
28
- exports.createDependencies = createDependencies;
29
- exports.createNodes = [
30
- '**/app.{json,config.js}',
31
- async (configFilePath, options, context) => {
32
- options = normalizeOptions(options);
33
- const projectRoot = (0, path_1.dirname)(configFilePath);
34
- // Do not create a project if package.json or project.json or metro.config.js isn't there.
35
- const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
36
- if (!siblingFiles.includes('package.json') ||
37
- !siblingFiles.includes('metro.config.js')) {
38
- return {};
23
+ exports.createNodesV2 = [
24
+ '**/app.{json,config.js,config.ts}',
25
+ async (configFiles, options, context) => {
26
+ const optionsHash = (0, devkit_internals_1.hashObject)(options);
27
+ const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, `react-native-${optionsHash}.hash`);
28
+ const targetsCache = readTargetsCache(cachePath);
29
+ try {
30
+ return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => createNodesInternal(configFile, options, context, targetsCache), configFiles, options, context);
39
31
  }
40
- const appConfig = await getAppConfig(configFilePath, context);
41
- if (appConfig.expo) {
42
- return {};
32
+ finally {
33
+ writeTargetsToCache(cachePath, targetsCache);
43
34
  }
44
- const hash = await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, options, context, [(0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot))]);
45
- targetsCache[hash] ??= buildReactNativeTargets(projectRoot, options, context);
46
- return {
47
- projects: {
48
- [projectRoot]: {
49
- targets: targetsCache[hash],
50
- },
51
- },
52
- };
53
35
  },
54
36
  ];
37
+ exports.createNodes = [
38
+ '**/app.{json,config.js,config.ts}',
39
+ async (configFilePath, options, context) => {
40
+ const optionsHash = (0, devkit_internals_1.hashObject)(options);
41
+ const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, `react-native-${optionsHash}.hash`);
42
+ const targetsCache = readTargetsCache(cachePath);
43
+ const result = await createNodesInternal(configFilePath, options, context, targetsCache);
44
+ writeTargetsToCache(cachePath, targetsCache);
45
+ return result;
46
+ },
47
+ ];
48
+ async function createNodesInternal(configFile, options, context, targetsCache) {
49
+ options = normalizeOptions(options);
50
+ const projectRoot = (0, path_1.dirname)(configFile);
51
+ // Do not create a project if package.json or project.json or metro.config.js isn't there.
52
+ const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
53
+ if (!siblingFiles.includes('package.json') ||
54
+ !siblingFiles.includes('metro.config.js')) {
55
+ return {};
56
+ }
57
+ // Check if it's an Expo project
58
+ const packageJson = (0, devkit_1.readJsonFile)((0, path_1.join)(context.workspaceRoot, projectRoot, 'package.json'));
59
+ const appConfig = await getAppConfig(configFile, context);
60
+ if (appConfig.expo ||
61
+ packageJson.dependencies?.['expo'] ||
62
+ packageJson.devDependencies?.['expo']) {
63
+ return {};
64
+ }
65
+ const hash = await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, options, context, [(0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot))]);
66
+ targetsCache[hash] ??= buildReactNativeTargets(projectRoot, options, context);
67
+ return {
68
+ projects: {
69
+ [projectRoot]: {
70
+ targets: targetsCache[hash],
71
+ },
72
+ },
73
+ };
74
+ }
55
75
  function buildReactNativeTargets(projectRoot, options, context) {
56
76
  const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
57
77
  const targets = {
58
78
  [options.startTargetName]: {
59
79
  command: `react-native start`,
80
+ continuous: true,
60
81
  options: { cwd: projectRoot },
61
82
  },
62
83
  [options.podInstallTargetName]: {
@@ -66,10 +87,12 @@ function buildReactNativeTargets(projectRoot, options, context) {
66
87
  },
67
88
  [options.runIosTargetName]: {
68
89
  command: `react-native run-ios`,
90
+ continuous: true,
69
91
  options: { cwd: projectRoot },
70
92
  },
71
93
  [options.runAndroidTargetName]: {
72
94
  command: `react-native run-android`,
95
+ continuous: true,
73
96
  options: { cwd: projectRoot },
74
97
  },
75
98
  [options.buildIosTargetName]: {
package/project.json CHANGED
@@ -39,14 +39,8 @@
39
39
  }
40
40
  },
41
41
  "build": {
42
- "executor": "nx:run-commands",
43
- "outputs": ["{workspaceRoot}/build/packages/react-native"],
44
- "options": {
45
- "command": "node ./scripts/copy-readme.js react-native"
46
- }
47
- },
48
- "add-extra-dependencies": {
49
- "command": "node ./scripts/add-dependency-to-build.js react-native @nrwl/react-native"
42
+ "outputs": ["{workspaceRoot}/build/packages/react-native/README.md"],
43
+ "command": "node ./scripts/copy-readme.js react-native"
50
44
  }
51
45
  }
52
46
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "version": 2,
3
+ "continuous": true,
3
4
  "outputCapture": "direct-nodejs",
4
5
  "cli": "nx",
5
6
  "$id": "NxReactNativeRunAndroid",
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "version": 2,
3
+ "continuous": true,
3
4
  "outputCapture": "direct-nodejs",
4
5
  "cli": "nx",
5
6
  "$id": "NxReactNativeRunIos",
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isPackagerRunning = isPackagerRunning;
4
- const node_fetch_1 = require("node-fetch");
5
4
  async function isPackagerRunning(packagerPort) {
6
5
  try {
7
- const resp = await (0, node_fetch_1.default)(`http://localhost:${packagerPort}/status`);
6
+ const resp = await fetch(`http://localhost:${packagerPort}/status`);
8
7
  const data = await resp.text();
9
8
  return data === 'packager-status:running' ? 'running' : 'unrecognized';
10
9
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "version": 2,
3
+ "continuous": true,
3
4
  "outputCapture": "direct-nodejs",
4
5
  "cli": "nx",
5
6
  "$id": "NxReactNativeStart",
@@ -6,7 +6,7 @@ const node_fs_1 = require("node:fs");
6
6
  const path_1 = require("path");
7
7
  const devkit_1 = require("@nx/devkit");
8
8
  const fileutils_1 = require("@nx/workspace/src/utilities/fileutils");
9
- const chalk = require("chalk");
9
+ const pc = require("picocolors");
10
10
  const glob_1 = require("glob");
11
11
  const sync_deps_impl_1 = require("../sync-deps/sync-deps.impl");
12
12
  /**
@@ -16,7 +16,7 @@ const sync_deps_impl_1 = require("../sync-deps/sync-deps.impl");
16
16
  async function* reactNativeStorybookExecutor(options, context) {
17
17
  const { syncDeps: isSyncDepsEnabled = true } = options;
18
18
  const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
19
- devkit_1.logger.info(`${chalk.bold.cyan('info')} To see your Storybook stories on the device, you should start your mobile app for the <platform> of your choice (typically ios or android).`);
19
+ devkit_1.logger.info(`${pc.bold(pc.cyan('info'))} To see your Storybook stories on the device, you should start your mobile app for the <platform> of your choice (typically ios or android).`);
20
20
  // add storybook addons to app's package.json
21
21
  const packageJsonPath = (0, path_1.join)(context.root, projectRoot, 'package.json');
22
22
  const workspacePackageJsonPath = (0, path_1.join)(context.root, 'package.json');
@@ -44,7 +44,7 @@ function runCliStorybook(workspaceRoot, options) {
44
44
  });
45
45
  });
46
46
  if (storiesFiles.length === 0) {
47
- devkit_1.logger.warn(`${chalk.bold.yellow('warn')} No stories found.`);
47
+ devkit_1.logger.warn(`${pc.bold(pc.yellow('warn'))} No stories found.`);
48
48
  }
49
49
  const newContents = `// Auto-generated file created by nx
50
50
  // DO NOT EDIT.
@@ -4,7 +4,7 @@ exports.default = syncDepsExecutor;
4
4
  exports.syncDeps = syncDeps;
5
5
  exports.displayNewlyAddedDepsMessage = displayNewlyAddedDepsMessage;
6
6
  const path_1 = require("path");
7
- const chalk = require("chalk");
7
+ const pc = require("picocolors");
8
8
  const devkit_1 = require("@nx/devkit");
9
9
  const find_all_npm_dependencies_1 = require("../../utils/find-all-npm-dependencies");
10
10
  async function* syncDepsExecutor(options, context) {
@@ -68,10 +68,10 @@ async function syncDeps(projectName, projectPackageJson, projectPackageJsonPath,
68
68
  }
69
69
  function displayNewlyAddedDepsMessage(projectName, deps) {
70
70
  if (deps.length > 0) {
71
- devkit_1.logger.info(`${chalk.bold.cyan('info')} Added entries to 'package.json' for '${projectName}' (for autolink):
72
- ${deps.map((d) => chalk.bold.cyan(`"${d}": "*"`)).join('\n ')}`);
71
+ devkit_1.logger.info(`${pc.bold(pc.cyan('info'))} Added entries to 'package.json' for '${projectName}' (for autolink):
72
+ ${deps.map((d) => pc.bold(pc.cyan(`"${d}": "*"`))).join('\n ')}`);
73
73
  }
74
74
  else {
75
- devkit_1.logger.info(`${chalk.bold.cyan('info')} Dependencies for '${projectName}' are up to date! No changes made.`);
75
+ devkit_1.logger.info(`${pc.bold(pc.cyan('info'))} Dependencies for '${projectName}' are up to date! No changes made.`);
76
76
  }
77
77
  }
@@ -17,21 +17,26 @@ const create_application_files_1 = require("./lib/create-application-files");
17
17
  const add_e2e_1 = require("./lib/add-e2e");
18
18
  const ensure_dependencies_1 = require("../../utils/ensure-dependencies");
19
19
  const sync_deps_impl_1 = require("../../executors/sync-deps/sync-deps.impl");
20
+ const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
21
+ const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
20
22
  async function reactNativeApplicationGenerator(host, schema) {
21
23
  return await reactNativeApplicationGeneratorInternal(host, {
22
24
  addPlugin: false,
23
- projectNameAndRootFormat: 'derived',
25
+ useProjectJson: true,
24
26
  ...schema,
25
27
  });
26
28
  }
27
29
  async function reactNativeApplicationGeneratorInternal(host, schema) {
28
- const options = await (0, normalize_options_1.normalizeOptions)(host, schema);
29
30
  const tasks = [];
30
31
  const jsInitTask = await (0, js_1.initGenerator)(host, {
31
32
  ...schema,
32
33
  skipFormat: true,
34
+ addTsPlugin: schema.useTsSolution,
35
+ formatter: schema.formatter,
36
+ platform: 'web',
33
37
  });
34
38
  tasks.push(jsInitTask);
39
+ const options = await (0, normalize_options_1.normalizeOptions)(host, schema);
35
40
  const initTask = await (0, init_1.default)(host, { ...options, skipFormat: true });
36
41
  tasks.push(initTask);
37
42
  if (!options.skipPackageJson) {
@@ -39,6 +44,11 @@ async function reactNativeApplicationGeneratorInternal(host, schema) {
39
44
  }
40
45
  await (0, create_application_files_1.createApplicationFiles)(host, options);
41
46
  (0, add_project_1.addProject)(host, options);
47
+ // If we are using the new TS solution
48
+ // We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
49
+ if (options.isTsSolutionSetup) {
50
+ await (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.appProjectRoot);
51
+ }
42
52
  const lintTask = await (0, add_linting_1.addLinting)(host, {
43
53
  ...options,
44
54
  projectRoot: options.appProjectRoot,
@@ -47,11 +57,11 @@ async function reactNativeApplicationGeneratorInternal(host, schema) {
47
57
  ],
48
58
  });
49
59
  tasks.push(lintTask);
50
- const jestTask = await (0, add_jest_1.addJest)(host, options.unitTestRunner, options.projectName, options.appProjectRoot, options.js, options.skipPackageJson, options.addPlugin);
60
+ const jestTask = await (0, add_jest_1.addJest)(host, options.unitTestRunner, options.projectName, options.appProjectRoot, options.js, options.skipPackageJson, options.addPlugin, 'tsconfig.app.json');
51
61
  tasks.push(jestTask);
52
62
  const webTask = await (0, web_configuration_1.webConfigurationGenerator)(host, {
53
63
  ...options,
54
- project: options.name,
64
+ project: options.projectName,
55
65
  skipFormat: true,
56
66
  });
57
67
  tasks.push(webTask);
@@ -75,6 +85,16 @@ async function reactNativeApplicationGeneratorInternal(host, schema) {
75
85
  ],
76
86
  });
77
87
  }
88
+ (0, ts_solution_setup_1.updateTsconfigFiles)(host, options.appProjectRoot, 'tsconfig.app.json', {
89
+ jsx: 'react-jsx',
90
+ module: 'esnext',
91
+ moduleResolution: 'bundler',
92
+ noUnusedLocals: false,
93
+ lib: ['dom'],
94
+ }, options.linter === 'eslint'
95
+ ? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
96
+ : undefined);
97
+ (0, sort_fields_1.sortPackageJsonFields)(host, options.appProjectRoot);
78
98
  if (!options.skipFormat) {
79
99
  await (0, devkit_1.formatFiles)(host);
80
100
  }
@@ -3,7 +3,7 @@ module.exports = function (api) {
3
3
 
4
4
  if (
5
5
  process.env.NX_TASK_TARGET_TARGET === 'build' ||
6
- process.env.NX_TASK_TARGET_TARGET.includes('storybook')
6
+ process.env.NX_TASK_TARGET_TARGET?.includes('storybook')
7
7
  ) {
8
8
  return {
9
9
  presets: [
@@ -3,7 +3,7 @@ source 'https://rubygems.org'
3
3
  # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4
4
  ruby ">= 2.6.10"
5
5
 
6
- # Cocoapods 1.15 introduced a bug which break the build. We will remove the upper
7
- # bound in the template on Cocoapods with next React Native release.
8
- gem 'cocoapods', '>= 1.13', '< 1.15'
9
- gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'
6
+ # Exclude problematic versions of cocoapods and activesupport that causes build failures.
7
+ gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
8
+ gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
9
+ gem 'xcodeproj', '< 1.26.0'
@@ -8,13 +8,13 @@ apply plugin: "com.facebook.react"
8
8
  */
9
9
  react {
10
10
  /* Folders */
11
- // The root of your project, i.e. where "package.json" lives. Default is '..'
12
- // root = file("../")
13
- // The folder where the react-native NPM package is. Default is <%= offsetFromRoot %>../../node_modules/react-native
11
+ // The root of your project, i.e. where "package.json" lives. Default is '../..'
12
+ // root = file("../../")
13
+ // The folder where the react-native NPM package is. Default is ../../node_modules/react-native
14
14
  reactNativeDir = file("<%= offsetFromRoot %>../../node_modules/react-native")
15
- // The folder where the react-native Codegen package is. Default is <%= offsetFromRoot %>../../node_modules/@react-native/codegen
15
+ // The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
16
16
  codegenDir = file("<%= offsetFromRoot %>../../node_modules/@react-native/codegen")
17
- // The cli.js file which is the React Native CLI entrypoint. Default is <%= offsetFromRoot %>../../node_modules/react-native/cli.js
17
+ // The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
18
18
  cliFile = file("<%= offsetFromRoot %>../../node_modules/react-native/cli.js")
19
19
 
20
20
  /* Variants */
@@ -45,10 +45,13 @@ react {
45
45
 
46
46
  /* Hermes Commands */
47
47
  // The hermes compiler command to run. By default it is 'hermesc'
48
- hermesCommand = "<%= offsetFromRoot %>node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc"
48
+ hermesCommand = "<%= offsetFromRoot %>../../node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc"
49
49
  //
50
50
  // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
51
51
  // hermesFlags = ["-O", "-output-source-map"]
52
+
53
+ /* Autolinking */
54
+ autolinkLibrariesWithApp()
52
55
  }
53
56
 
54
57
  /**
@@ -114,5 +117,3 @@ dependencies {
114
117
  implementation jscFlavor
115
118
  }
116
119
  }
117
-
118
- apply from: file("<%= offsetFromRoot %>../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
@@ -9,6 +9,7 @@
9
9
  android:roundIcon="@mipmap/ic_launcher_round"
10
10
  android:allowBackup="false"
11
11
  android:theme="@style/AppTheme"
12
+ android:supportsRtl="true"
12
13
  android:networkSecurityConfig="@xml/network_security_config">
13
14
  <activity
14
15
  android:name=".MainActivity"
@@ -9,17 +9,18 @@ import com.facebook.react.ReactPackage
9
9
  import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
10
10
  import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
11
11
  import com.facebook.react.defaults.DefaultReactNativeHost
12
+ import com.facebook.react.soloader.OpenSourceMergedSoMapping
12
13
  import com.facebook.soloader.SoLoader
13
14
 
14
15
  class MainApplication : Application(), ReactApplication {
15
16
 
16
17
  override val reactNativeHost: ReactNativeHost =
17
18
  object : DefaultReactNativeHost(this) {
18
- override fun getPackages(): List<ReactPackage> {
19
- // Packages that cannot be autolinked yet can be added manually here, for example:
20
- // packages.add(new MyReactNativePackage());
21
- return PackageList(this).packages
22
- }
19
+ override fun getPackages(): List<ReactPackage> =
20
+ PackageList(this).packages.apply {
21
+ // Packages that cannot be autolinked yet can be added manually here, for example:
22
+ // add(MyReactNativePackage())
23
+ }
23
24
 
24
25
  override fun getJSMainModuleName(): String = "src/main"
25
26
 
@@ -34,7 +35,7 @@ class MainApplication : Application(), ReactApplication {
34
35
 
35
36
  override fun onCreate() {
36
37
  super.onCreate()
37
- SoLoader.init(this, false)
38
+ SoLoader.init(this, OpenSourceMergedSoMapping)
38
39
  if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
39
40
  // If you opted-in for the New Architecture, we load the native entry point for this app.
40
41
  load()
@@ -1,11 +1,11 @@
1
1
  buildscript {
2
2
  ext {
3
- buildToolsVersion = "34.0.0"
4
- minSdkVersion = 23
5
- compileSdkVersion = 34
3
+ buildToolsVersion = "35.0.0"
4
+ minSdkVersion = 24
5
+ compileSdkVersion = 35
6
6
  targetSdkVersion = 34
7
7
  ndkVersion = "26.1.10909125"
8
- kotlinVersion = "1.9.22"
8
+ kotlinVersion = "1.9.24"
9
9
  }
10
10
  repositories {
11
11
  google()
@@ -1,6 +1,6 @@
1
1
  distributionBase=GRADLE_USER_HOME
2
2
  distributionPath=wrapper/dists
3
- distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
4
4
  networkTimeout=10000
5
5
  validateDistributionUrl=true
6
6
  zipStoreBase=GRADLE_USER_HOME
@@ -21,8 +21,6 @@ org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
21
21
  # Android operating system, and which are packaged with your app's APK
22
22
  # https://developer.android.com/topic/libraries/support-library/androidx-rn
23
23
  android.useAndroidX=true
24
- # Automatically convert third-party libraries to use AndroidX
25
- android.enableJetifier=true
26
24
 
27
25
  # Use this property to specify which architecture you want to build.
28
26
  # You can also override it from the CLI using
@@ -34,7 +32,7 @@ reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
34
32
  # your application. You should enable this flag either if you want
35
33
  # to write custom TurboModules/Fabric components OR use libraries that
36
34
  # are providing them.
37
- newArchEnabled=false
35
+ newArchEnabled=true
38
36
 
39
37
  # Use this property to enable or disable the Hermes JS engine.
40
38
  # If set to false, you will be using JSC instead.