@nx/react-native 20.5.0-rc.4 → 20.6.0-beta.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/react-native",
3
- "version": "20.5.0-rc.4",
3
+ "version": "20.6.0-beta.0",
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": [
@@ -35,12 +35,12 @@
35
35
  "picocolors": "^1.1.0",
36
36
  "tsconfig-paths": "^4.1.2",
37
37
  "tslib": "^2.3.0",
38
- "@nx/devkit": "20.5.0-rc.4",
39
- "@nx/jest": "20.5.0-rc.4",
40
- "@nx/js": "20.5.0-rc.4",
41
- "@nx/eslint": "20.5.0-rc.4",
42
- "@nx/react": "20.5.0-rc.4",
43
- "@nx/workspace": "20.5.0-rc.4"
38
+ "@nx/devkit": "20.6.0-beta.0",
39
+ "@nx/jest": "20.6.0-beta.0",
40
+ "@nx/js": "20.6.0-beta.0",
41
+ "@nx/eslint": "20.6.0-beta.0",
42
+ "@nx/react": "20.6.0-beta.0",
43
+ "@nx/workspace": "20.6.0-beta.0"
44
44
  },
45
45
  "executors": "./executors.json",
46
46
  "ng-update": {
@@ -22,6 +22,7 @@ const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
22
22
  async function reactNativeApplicationGenerator(host, schema) {
23
23
  return await reactNativeApplicationGeneratorInternal(host, {
24
24
  addPlugin: false,
25
+ useProjectJson: true,
25
26
  ...schema,
26
27
  });
27
28
  }
@@ -46,7 +47,7 @@ async function reactNativeApplicationGeneratorInternal(host, schema) {
46
47
  // If we are using the new TS solution
47
48
  // We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
48
49
  if (options.isTsSolutionSetup) {
49
- (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.appProjectRoot);
50
+ await (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.appProjectRoot);
50
51
  }
51
52
  const lintTask = await (0, add_linting_1.addLinting)(host, {
52
53
  ...options,
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addProject = addProject;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
6
5
  function addProject(host, options) {
7
6
  const nxJson = (0, devkit_1.readNxJson)(host);
8
7
  const hasPlugin = nxJson.plugins?.some((p) => typeof p === 'string'
@@ -15,12 +14,12 @@ function addProject(host, options) {
15
14
  targets: hasPlugin ? {} : getTargets(options),
16
15
  tags: options.parsedTags,
17
16
  };
18
- if ((0, ts_solution_setup_1.isUsingTsSolutionSetup)(host)) {
19
- const packageJson = {
20
- name: options.importPath,
21
- version: '0.0.1',
22
- private: true,
23
- };
17
+ const packageJson = {
18
+ name: options.importPath,
19
+ version: '0.0.1',
20
+ private: true,
21
+ };
22
+ if (!options.useProjectJson) {
24
23
  if (options.projectName !== options.importPath) {
25
24
  packageJson.nx = { name: options.projectName };
26
25
  }
@@ -32,13 +31,15 @@ function addProject(host, options) {
32
31
  packageJson.nx ??= {};
33
32
  packageJson.nx.tags = options.parsedTags;
34
33
  }
35
- (0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'), packageJson);
36
34
  }
37
35
  else {
38
36
  (0, devkit_1.addProjectConfiguration)(host, options.projectName, {
39
37
  ...project,
40
38
  });
41
39
  }
40
+ if (!options.useProjectJson || options.isTsSolutionSetup) {
41
+ (0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'), packageJson);
42
+ }
42
43
  }
43
44
  function getTargets(options) {
44
45
  const architect = {};
@@ -45,5 +45,6 @@ async function normalizeOptions(host, options) {
45
45
  e2eProjectName,
46
46
  e2eProjectRoot,
47
47
  isTsSolutionSetup,
48
+ useProjectJson: options.useProjectJson ?? !isTsSolutionSetup,
48
49
  };
49
50
  }
@@ -21,4 +21,5 @@ export interface Schema {
21
21
  nxCloudToken?: string;
22
22
  useTsSolution?: boolean;
23
23
  formatter?: 'prettier' | 'none';
24
+ useProjectJson?: boolean;
24
25
  }
@@ -95,6 +95,10 @@
95
95
  "x-prompt": "Which bundler do you want to use to build the application?",
96
96
  "default": "vite",
97
97
  "x-priority": "important"
98
+ },
99
+ "useProjectJson": {
100
+ "type": "boolean",
101
+ "description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
98
102
  }
99
103
  },
100
104
  "required": ["directory"]
@@ -29,6 +29,7 @@ async function normalizeOptions(host, options) {
29
29
  parsedTags,
30
30
  importPath,
31
31
  isUsingTsSolutionConfig,
32
+ useProjectJson: options.useProjectJson ?? !isUsingTsSolutionConfig,
32
33
  };
33
34
  return normalized;
34
35
  }
@@ -20,6 +20,7 @@ const versions_1 = require("../../utils/versions");
20
20
  async function reactNativeLibraryGenerator(host, schema) {
21
21
  return await reactNativeLibraryGeneratorInternal(host, {
22
22
  addPlugin: false,
23
+ useProjectJson: true,
23
24
  ...schema,
24
25
  });
25
26
  }
@@ -45,7 +46,7 @@ async function reactNativeLibraryGeneratorInternal(host, schema) {
45
46
  tasks.push(addProjectTask);
46
47
  }
47
48
  if (options.isUsingTsSolutionConfig) {
48
- (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.projectRoot);
49
+ await (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.projectRoot);
49
50
  }
50
51
  const lintTask = await (0, add_linting_1.addLinting)(host, {
51
52
  ...options,
@@ -100,10 +101,13 @@ async function addProject(host, options) {
100
101
  tags: options.parsedTags,
101
102
  targets: {},
102
103
  };
103
- if (options.isUsingTsSolutionConfig) {
104
- const packageJson = {
105
- name: options.importPath,
106
- version: '0.0.1',
104
+ let packageJson = {
105
+ name: options.importPath,
106
+ version: '0.0.1',
107
+ };
108
+ if (!options.useProjectJson) {
109
+ packageJson = {
110
+ ...packageJson,
107
111
  ...determineEntryFields(options),
108
112
  files: options.publishable ? ['dist', '!**/*.tsbuildinfo'] : undefined,
109
113
  peerDependencies: {
@@ -118,11 +122,16 @@ async function addProject(host, options) {
118
122
  packageJson.nx ??= {};
119
123
  packageJson.nx.tags = options.parsedTags;
120
124
  }
121
- (0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'), packageJson);
122
125
  }
123
126
  else {
124
127
  (0, devkit_1.addProjectConfiguration)(host, options.name, project);
125
128
  }
129
+ if (!options.useProjectJson ||
130
+ options.isUsingTsSolutionConfig ||
131
+ options.publishable ||
132
+ options.buildable) {
133
+ (0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'), packageJson);
134
+ }
126
135
  if (options.publishable || options.buildable) {
127
136
  const external = new Set([
128
137
  'react/jsx-runtime',
@@ -19,4 +19,5 @@ export interface Schema {
19
19
  setParserOptionsProject?: boolean;
20
20
  skipPackageJson?: boolean; //default is false
21
21
  addPlugin?: boolean;
22
+ useProjectJson?: boolean;
22
23
  }
@@ -93,6 +93,10 @@
93
93
  "type": "boolean",
94
94
  "default": false,
95
95
  "x-priority": "internal"
96
+ },
97
+ "useProjectJson": {
98
+ "type": "boolean",
99
+ "description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
96
100
  }
97
101
  },
98
102
  "required": ["directory"]