@nx/react 19.1.0-beta.0 → 19.1.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",
3
- "version": "19.1.0-beta.0",
3
+ "version": "19.1.0-beta.2",
4
4
  "private": false,
5
5
  "description": "The React plugin for Nx contains executors and generators for managing React applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Jest, Vitest, Playwright, Cypress, and Storybook.\n\n- Generators for applications, libraries, components, hooks, and more.\n\n- Library build support for publishing packages to npm or other registries.\n\n- Utilities for automatic workspace refactoring.",
6
6
  "repository": {
@@ -14,9 +14,10 @@
14
14
  "Web",
15
15
  "Jest",
16
16
  "Cypress",
17
- "CLI"
17
+ "CLI",
18
+ "Front-end"
18
19
  ],
19
- "main": "./index.js",
20
+ "main": "./index",
20
21
  "typings": "./index.d.ts",
21
22
  "author": "Victor Savkin",
22
23
  "license": "MIT",
@@ -37,11 +38,11 @@
37
38
  "file-loader": "^6.2.0",
38
39
  "minimatch": "9.0.3",
39
40
  "tslib": "^2.3.0",
40
- "@nx/devkit": "19.1.0-beta.0",
41
- "@nx/js": "19.1.0-beta.0",
42
- "@nx/eslint": "19.1.0-beta.0",
43
- "@nx/web": "19.1.0-beta.0",
44
- "@nrwl/react": "19.1.0-beta.0"
41
+ "@nx/devkit": "19.1.0-beta.2",
42
+ "@nx/js": "19.1.0-beta.2",
43
+ "@nx/eslint": "19.1.0-beta.2",
44
+ "@nx/web": "19.1.0-beta.2",
45
+ "@nrwl/react": "19.1.0-beta.2"
45
46
  },
46
47
  "publishConfig": {
47
48
  "access": "public"
@@ -75,6 +75,20 @@ async function applicationGeneratorInternal(host, schema) {
75
75
  skipFormat: true,
76
76
  });
77
77
  tasks.push(initTask);
78
+ if (!options.addPlugin) {
79
+ const nxJson = (0, devkit_1.readNxJson)(host);
80
+ nxJson.targetDefaults ??= {};
81
+ if (!Object.keys(nxJson.targetDefaults).includes('build')) {
82
+ nxJson.targetDefaults.build = {
83
+ cache: true,
84
+ dependsOn: ['^build'],
85
+ };
86
+ }
87
+ else if (!nxJson.targetDefaults.build.dependsOn) {
88
+ nxJson.targetDefaults.build.dependsOn = ['^build'];
89
+ }
90
+ (0, devkit_1.updateNxJson)(host, nxJson);
91
+ }
78
92
  if (options.bundler === 'webpack') {
79
93
  const { webpackInitGenerator } = (0, devkit_1.ensurePackage)('@nx/webpack', versions_1.nxVersion);
80
94
  const webpackInitTask = await webpackInitGenerator(host, {
@@ -69,9 +69,6 @@ async function normalizeOptions(host, options, callingGenerator = '@nx/react:app
69
69
  ? null
70
70
  : options.style;
71
71
  (0, assertion_1.assertValidStyle)(options.style);
72
- if (options.bundler === 'vite' && options.unitTestRunner !== 'none') {
73
- options.unitTestRunner = 'vitest';
74
- }
75
72
  const normalized = {
76
73
  ...options,
77
74
  name: (0, devkit_1.names)(options.name).fileName,
@@ -14,7 +14,6 @@ function updateHostWithRemote(host, hostName, remoteName) {
14
14
  if (!host.exists(moduleFederationConfigPath)) {
15
15
  moduleFederationConfigPath = (0, devkit_1.joinPathFragments)(hostConfig.root, 'module-federation.config.ts');
16
16
  }
17
- const remoteDefsPath = (0, devkit_1.joinPathFragments)(hostConfig.sourceRoot, 'remotes.d.ts');
18
17
  const appComponentPath = findAppComponentPath(host, hostConfig.sourceRoot);
19
18
  if (host.exists(moduleFederationConfigPath)) {
20
19
  // find the host project path
@@ -27,17 +26,9 @@ function updateHostWithRemote(host, hostName, remoteName) {
27
26
  // TODO(jack): Point to the nx.dev guide when ready.
28
27
  devkit_1.logger.warn(`Could not find configuration at ${moduleFederationConfigPath}. Did you generate this project with "@nx/react:host"?`);
29
28
  }
30
- if (host.exists(remoteDefsPath)) {
31
- let sourceCode = host.read(remoteDefsPath).toString();
32
- const source = tsModule.createSourceFile(moduleFederationConfigPath, sourceCode, tsModule.ScriptTarget.Latest, true);
33
- host.write(remoteDefsPath, (0, devkit_1.applyChangesToString)(sourceCode, (0, ast_utils_1.addRemoteDefinition)(source, remoteName)));
34
- }
35
- else {
36
- devkit_1.logger.warn(`Could not find remote definitions at ${remoteDefsPath}. Did you generate this project with "@nx/react:host"?`);
37
- }
38
29
  if (host.exists(appComponentPath)) {
39
30
  let sourceCode = host.read(appComponentPath).toString();
40
- const source = tsModule.createSourceFile(moduleFederationConfigPath, sourceCode, tsModule.ScriptTarget.Latest, true);
31
+ const source = tsModule.createSourceFile(moduleFederationConfigPath, sourceCode, tsModule.ScriptTarget.Latest, true, tsModule.ScriptKind.TSX);
41
32
  host.write(appComponentPath, (0, devkit_1.applyChangesToString)(sourceCode, (0, ast_utils_1.addRemoteRoute)(source, (0, devkit_1.names)(remoteName))));
42
33
  }
43
34
  else {