@nx/react 20.5.0-beta.2 → 20.5.0-beta.4

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": "20.5.0-beta.2",
3
+ "version": "20.5.0-beta.4",
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": {
@@ -38,11 +38,11 @@
38
38
  "minimatch": "9.0.3",
39
39
  "picocolors": "^1.1.0",
40
40
  "tslib": "^2.3.0",
41
- "@nx/devkit": "20.5.0-beta.2",
42
- "@nx/js": "20.5.0-beta.2",
43
- "@nx/eslint": "20.5.0-beta.2",
44
- "@nx/web": "20.5.0-beta.2",
45
- "@nx/module-federation": "20.5.0-beta.2",
41
+ "@nx/devkit": "20.5.0-beta.4",
42
+ "@nx/js": "20.5.0-beta.4",
43
+ "@nx/eslint": "20.5.0-beta.4",
44
+ "@nx/web": "20.5.0-beta.4",
45
+ "@nx/module-federation": "20.5.0-beta.4",
46
46
  "express": "^4.21.2",
47
47
  "http-proxy-middleware": "^3.0.3",
48
48
  "semver": "^7.6.3"
@@ -89,12 +89,11 @@ async function applicationGeneratorInternal(tree, schema) {
89
89
  });
90
90
  tasks.push(twTask);
91
91
  }
92
+ const lintTask = await (0, add_linting_1.addLinting)(tree, options);
93
+ tasks.push(lintTask);
92
94
  if (options.bundler === 'vite') {
93
95
  await (0, add_vite_1.setupViteConfiguration)(tree, options, tasks);
94
96
  }
95
- else if (options.bundler === 'rspack') {
96
- await (0, add_rspack_1.setupRspackConfiguration)(tree, options, tasks);
97
- }
98
97
  else if (options.bundler === 'rsbuild') {
99
98
  await (0, add_rsbuild_1.setupRsbuildConfiguration)(tree, options, tasks);
100
99
  }
@@ -105,8 +104,6 @@ async function applicationGeneratorInternal(tree, schema) {
105
104
  options.inSourceTests) {
106
105
  tree.delete((0, devkit_1.joinPathFragments)(options.appProjectRoot, `src/app/${options.fileName}.spec.tsx`));
107
106
  }
108
- const lintTask = await (0, add_linting_1.addLinting)(tree, options);
109
- tasks.push(lintTask);
110
107
  const e2eTask = await (0, add_e2e_1.addE2e)(tree, options);
111
108
  tasks.push(e2eTask);
112
109
  if (options.unitTestRunner === 'jest') {
@@ -1,5 +1,4 @@
1
1
  import { type Tree } from '@nx/devkit';
2
2
  import { NormalizedSchema, Schema } from '../../schema';
3
3
  export declare function initRspack(tree: Tree, options: NormalizedSchema<Schema>, tasks: any[]): Promise<void>;
4
- export declare function setupRspackConfiguration(tree: Tree, options: NormalizedSchema<Schema>, tasks: any[]): Promise<void>;
5
4
  export declare function handleStyledJsxForRspack(tasks: any[], tree: Tree, options: NormalizedSchema<Schema>): void;
@@ -1,36 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.initRspack = initRspack;
4
- exports.setupRspackConfiguration = setupRspackConfiguration;
5
4
  exports.handleStyledJsxForRspack = handleStyledJsxForRspack;
6
5
  const devkit_1 = require("@nx/devkit");
7
6
  const pc = require("picocolors");
8
7
  const versions_1 = require("../../../../utils/versions");
9
- const maybe_js_1 = require("../../../../utils/maybe-js");
10
8
  async function initRspack(tree, options, tasks) {
11
9
  const { rspackInitGenerator } = (0, devkit_1.ensurePackage)('@nx/rspack', versions_1.nxVersion);
12
10
  const rspackInitTask = await rspackInitGenerator(tree, {
13
11
  ...options,
14
- addPlugin: false,
15
12
  skipFormat: true,
16
13
  });
17
14
  tasks.push(rspackInitTask);
18
15
  }
19
- async function setupRspackConfiguration(tree, options, tasks) {
20
- const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/rspack', versions_1.nxVersion);
21
- const rspackTask = await configurationGenerator(tree, {
22
- project: options.projectName,
23
- main: (0, devkit_1.joinPathFragments)(options.appProjectRoot, (0, maybe_js_1.maybeJs)({
24
- js: options.js,
25
- useJsx: true,
26
- }, `src/main.tsx`)),
27
- tsConfig: (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json'),
28
- target: 'web',
29
- newProject: true,
30
- framework: 'react',
31
- });
32
- tasks.push(rspackTask);
33
- }
34
16
  function handleStyledJsxForRspack(tasks, tree, options) {
35
17
  devkit_1.logger.warn(`${pc.bold('styled-jsx')} is not supported by ${pc.bold('Rspack')}. We've added ${pc.bold('babel-loader')} to your project, but using babel will slow down your build.`);
36
18
  tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, { 'babel-loader': versions_1.babelLoaderVersion }));
@@ -11,9 +11,9 @@ function getAppTests(options) {
11
11
 
12
12
  it('should have a greeting as the title', () => {
13
13
  ${options.routing
14
- ? 'const { getByText } = render(<BrowserRouter><App /></BrowserRouter>);'
15
- : 'const { getByText } = render(<App />);'}
16
- expect(getByText(new RegExp('Welcome ${options.projectName}', 'gi'))).toBeTruthy();
14
+ ? 'const { getAllByText } = render(<BrowserRouter><App /></BrowserRouter>);'
15
+ : 'const { getAllByText } = render(<App />);'}
16
+ expect(getAllByText(new RegExp('Welcome ${options.projectName}', 'gi')).length > 0).toBeTruthy();
17
17
  });
18
18
  `;
19
19
  }
@@ -23,6 +23,7 @@ const set_defaults_1 = require("./lib/set-defaults");
23
23
  const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
24
24
  const determine_entry_fields_1 = require("./lib/determine-entry-fields");
25
25
  const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
26
+ const add_release_config_1 = require("@nx/js/src/generators/library/utils/add-release-config");
26
27
  async function libraryGenerator(host, schema) {
27
28
  return await libraryGeneratorInternal(host, {
28
29
  addPlugin: false,
@@ -53,7 +54,7 @@ async function libraryGeneratorInternal(host, schema) {
53
54
  tasks.push(initTask);
54
55
  if (options.isUsingTsSolutionConfig) {
55
56
  (0, devkit_1.writeJson)(host, `${options.projectRoot}/package.json`, {
56
- name: options.importPath,
57
+ name: options.importPath ?? options.name,
57
58
  version: '0.0.1',
58
59
  ...(0, determine_entry_fields_1.determineEntryFields)(options),
59
60
  nx: options.parsedTags?.length
@@ -184,10 +185,15 @@ async function libraryGeneratorInternal(host, schema) {
184
185
  tasks.push(componentTask);
185
186
  }
186
187
  if (options.publishable || options.buildable) {
187
- (0, devkit_1.updateJson)(host, `${options.projectRoot}/package.json`, (json) => {
188
- json.name = options.importPath;
189
- return json;
190
- });
188
+ const projectConfiguration = (0, devkit_1.readProjectConfiguration)(host, options.name);
189
+ if (options.isUsingTsSolutionConfig) {
190
+ await (0, add_release_config_1.addReleaseConfigForTsSolution)(host, options.name, projectConfiguration);
191
+ }
192
+ else {
193
+ await (0, add_release_config_1.addReleaseConfigForNonTsSolution)(host, options.name, projectConfiguration);
194
+ }
195
+ (0, devkit_1.updateProjectConfiguration)(host, options.name, projectConfiguration);
196
+ tasks.push(await (0, add_release_config_1.releaseTasks)(host));
191
197
  }
192
198
  if (!options.skipPackageJson) {
193
199
  const installReactTask = await (0, install_common_dependencies_1.installCommonDependencies)(host, options);
@@ -23,7 +23,7 @@ export declare const emotionStyledVersion = "11.11.0";
23
23
  export declare const emotionReactVersion = "11.11.1";
24
24
  export declare const emotionBabelPlugin = "11.11.0";
25
25
  export declare const styledJsxVersion = "5.1.2";
26
- export declare const reactRouterDomVersion = "6.11.2";
26
+ export declare const reactRouterDomVersion = "6.29.0";
27
27
  export declare const testingLibraryReactVersion = "16.1.0";
28
28
  export declare const testingLibraryDomVersion = "10.4.0";
29
29
  export declare const reduxjsToolkitVersion = "1.9.3";
@@ -28,7 +28,7 @@ exports.emotionReactVersion = '11.11.1';
28
28
  exports.emotionBabelPlugin = '11.11.0';
29
29
  // WARNING: This needs to be in sync with Next.js' dependency or else there might be issues.
30
30
  exports.styledJsxVersion = '5.1.2';
31
- exports.reactRouterDomVersion = '6.11.2';
31
+ exports.reactRouterDomVersion = '6.29.0';
32
32
  exports.testingLibraryReactVersion = '16.1.0';
33
33
  exports.testingLibraryDomVersion = '10.4.0';
34
34
  exports.reduxjsToolkitVersion = '1.9.3';