@nx/react-native 18.3.0-beta.0 → 18.3.0-beta.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/react-native",
3
- "version": "18.3.0-beta.0",
3
+ "version": "18.3.0-beta.2",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for React Native contains generators for managing React Native applications and libraries within an Nx workspace. It provides: \n\n-Integration with libraries such as Jest, Detox, and Storybook.\n-Scaffolding for creating buildable libraries that can be published to npm.\n-Utilities for automatic workspace refactoring.",
6
6
  "keywords": [
@@ -36,13 +36,13 @@
36
36
  "node-fetch": "^2.6.7",
37
37
  "tsconfig-paths": "^4.1.2",
38
38
  "tslib": "^2.3.0",
39
- "@nx/devkit": "18.3.0-beta.0",
40
- "@nx/jest": "18.3.0-beta.0",
41
- "@nx/js": "18.3.0-beta.0",
42
- "@nx/eslint": "18.3.0-beta.0",
43
- "@nx/react": "18.3.0-beta.0",
44
- "@nx/workspace": "18.3.0-beta.0",
45
- "@nrwl/react-native": "18.3.0-beta.0"
39
+ "@nx/devkit": "18.3.0-beta.2",
40
+ "@nx/jest": "18.3.0-beta.2",
41
+ "@nx/js": "18.3.0-beta.2",
42
+ "@nx/eslint": "18.3.0-beta.2",
43
+ "@nx/react": "18.3.0-beta.2",
44
+ "@nx/workspace": "18.3.0-beta.2",
45
+ "@nrwl/react-native": "18.3.0-beta.2"
46
46
  },
47
47
  "executors": "./executors.json",
48
48
  "ng-update": {
@@ -4,6 +4,7 @@ exports.withNxMetro = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const metro_config_1 = require("metro-config");
6
6
  const fs_extra_1 = require("fs-extra");
7
+ const path_1 = require("path");
7
8
  const metro_resolver_1 = require("./metro-resolver");
8
9
  async function withNxMetro(userConfig, opts = {}) {
9
10
  const extensions = ['', 'ts', 'tsx', 'js', 'jsx', 'json'];
@@ -13,7 +14,7 @@ async function withNxMetro(userConfig, opts = {}) {
13
14
  extensions.push(...opts.extensions);
14
15
  let watchFolders = (0, fs_extra_1.readdirSync)(devkit_1.workspaceRoot)
15
16
  .filter((fileName) => !['dist', 'e2e'].includes(fileName) && !fileName.startsWith('.'))
16
- .map((fileName) => (0, devkit_1.joinPathFragments)(devkit_1.workspaceRoot, fileName))
17
+ .map((fileName) => (0, path_1.join)(devkit_1.workspaceRoot, fileName))
17
18
  .filter((filePath) => (0, fs_extra_1.statSync)(filePath).isDirectory());
18
19
  if (opts.watchFolders?.length) {
19
20
  watchFolders = watchFolders.concat(opts.watchFolders);
@@ -22,7 +23,7 @@ async function withNxMetro(userConfig, opts = {}) {
22
23
  const nxConfig = {
23
24
  resolver: {
24
25
  resolveRequest: (0, metro_resolver_1.getResolveRequest)(extensions),
25
- nodeModulesPaths: [(0, devkit_1.joinPathFragments)(devkit_1.workspaceRoot, 'node_modules')],
26
+ nodeModulesPaths: [(0, path_1.join)(devkit_1.workspaceRoot, 'node_modules')],
26
27
  },
27
28
  watchFolders,
28
29
  };
@@ -1,3 +1,5 @@
1
+ import 'nx/src/internal-testing-utils/mock-project-graph';
2
+
1
3
  import {
2
4
  Tree,
3
5
  getProjects,
@@ -1,3 +1,5 @@
1
+ import 'nx/src/internal-testing-utils/mock-project-graph';
2
+
1
3
  import { logger, Tree } from '@nx/devkit';
2
4
  import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
3
5
  import { createApp, createLib } from '../../utils/testing-generators';
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateDependencies = exports.reactNativeInitGeneratorInternal = exports.reactNativeInitGenerator = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const update_package_scripts_1 = require("@nx/devkit/src/utils/update-package-scripts");
5
+ const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
6
6
  const plugin_1 = require("../../../plugins/plugin");
7
7
  const versions_1 = require("../../utils/versions");
8
8
  const add_git_ignore_entry_1 = require("./lib/add-git-ignore-entry");
@@ -20,16 +20,55 @@ async function reactNativeInitGeneratorInternal(host, schema) {
20
20
  nxJson.useInferencePlugins !== false;
21
21
  schema.addPlugin ??= addPluginDefault;
22
22
  if (schema.addPlugin) {
23
- addPlugin(host);
23
+ await (0, add_plugin_1.addPlugin)(host, await (0, devkit_1.createProjectGraphAsync)(), '@nx/react-native/plugin', plugin_1.createNodes, {
24
+ startTargetName: ['start', 'react-native:start', 'react-native-start'],
25
+ upgradeTargetname: [
26
+ 'update',
27
+ 'react-native:update',
28
+ 'react-native-update',
29
+ ],
30
+ bundleTargetName: [
31
+ 'bundle',
32
+ 'react-native:bundle',
33
+ 'react-native-bundle',
34
+ ],
35
+ podInstallTargetName: [
36
+ 'pod-install',
37
+ 'react-native:pod-install',
38
+ 'react-native-pod-install',
39
+ ],
40
+ runIosTargetName: [
41
+ 'run-ios',
42
+ 'react-native:run-ios',
43
+ 'react-native-run-ios',
44
+ ],
45
+ runAndroidTargetName: [
46
+ 'run-android',
47
+ 'react-native:run-android',
48
+ 'react-native-run-android',
49
+ ],
50
+ buildIosTargetName: [
51
+ 'build-ios',
52
+ 'react-native:build-ios',
53
+ 'react-native-build-ios',
54
+ ],
55
+ buildAndroidTargetName: [
56
+ 'build-android',
57
+ 'react-native:build-android',
58
+ 'react-native-build-android',
59
+ ],
60
+ syncDepsTargetName: [
61
+ 'sync-deps',
62
+ 'react-native:sync-deps',
63
+ 'react-native-sync-deps',
64
+ ],
65
+ }, schema.updatePackageScripts);
24
66
  }
25
67
  const tasks = [];
26
68
  if (!schema.skipPackageJson) {
27
69
  tasks.push(moveDependency(host));
28
70
  tasks.push(updateDependencies(host, schema));
29
71
  }
30
- if (schema.updatePackageScripts) {
31
- await (0, update_package_scripts_1.updatePackageScripts)(host, plugin_1.createNodes);
32
- }
33
72
  if (!schema.skipFormat) {
34
73
  await (0, devkit_1.formatFiles)(host);
35
74
  }
@@ -49,30 +88,4 @@ exports.updateDependencies = updateDependencies;
49
88
  function moveDependency(host) {
50
89
  return (0, devkit_1.removeDependenciesFromPackageJson)(host, ['@nx/react-native'], []);
51
90
  }
52
- function addPlugin(host) {
53
- const nxJson = (0, devkit_1.readNxJson)(host);
54
- nxJson.plugins ??= [];
55
- for (const plugin of nxJson.plugins) {
56
- if (typeof plugin === 'string'
57
- ? plugin === '@nx/react-native/plugin'
58
- : plugin.plugin === '@nx/react-native/plugin') {
59
- return;
60
- }
61
- }
62
- nxJson.plugins.push({
63
- plugin: '@nx/react-native/plugin',
64
- options: {
65
- startTargetName: 'start',
66
- podInstallTargetName: 'pod-install',
67
- bundleTargetName: 'bundle',
68
- runIosTargetName: 'run-ios',
69
- runAndroidTargetName: 'run-android',
70
- buildIosTargetName: 'build-ios',
71
- buildAndroidTargetName: 'build-android',
72
- syncDepsTargetName: 'sync-deps',
73
- upgradeTargetname: 'upgrade',
74
- },
75
- });
76
- (0, devkit_1.updateNxJson)(host, nxJson);
77
- }
78
91
  exports.default = reactNativeInitGenerator;
@@ -1,3 +1,5 @@
1
+ import 'nx/src/internal-testing-utils/mock-project-graph';
2
+
1
3
  import { Tree, readJson } from '@nx/devkit';
2
4
  import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
3
5
  import { reactNativeInitGenerator } from './init';
@@ -1,3 +1,5 @@
1
+ import 'nx/src/internal-testing-utils/mock-project-graph';
2
+
1
3
  import {
2
4
  readJson,
3
5
  readProjectConfiguration,
@@ -1,3 +1,5 @@
1
+ import 'nx/src/internal-testing-utils/mock-project-graph';
2
+
1
3
  import { readProjectConfiguration, Tree } from '@nx/devkit';
2
4
  import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
3
5
  import { Linter } from '@nx/eslint';