@nx/react 17.0.0-rc.0 → 17.0.0-rc.1

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/babel.d.ts CHANGED
@@ -7,6 +7,9 @@ interface NxReactBabelOptions {
7
7
  decoratorsBeforeExport?: boolean;
8
8
  legacy?: boolean;
9
9
  };
10
+ loose?: boolean;
11
+ /** @deprecated Use `loose` option instead of `classProperties.loose`
12
+ */
10
13
  classProperties?: {
11
14
  loose?: boolean;
12
15
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/react",
3
- "version": "17.0.0-rc.0",
3
+ "version": "17.0.0-rc.1",
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, 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": {
@@ -37,11 +37,11 @@
37
37
  "file-loader": "^6.2.0",
38
38
  "minimatch": "3.0.5",
39
39
  "tslib": "^2.3.0",
40
- "@nx/devkit": "17.0.0-rc.0",
41
- "@nx/js": "17.0.0-rc.0",
42
- "@nx/eslint": "17.0.0-rc.0",
43
- "@nx/web": "17.0.0-rc.0",
44
- "@nrwl/react": "17.0.0-rc.0"
40
+ "@nx/devkit": "17.0.0-rc.1",
41
+ "@nx/js": "17.0.0-rc.1",
42
+ "@nx/eslint": "17.0.0-rc.1",
43
+ "@nx/web": "17.0.0-rc.1",
44
+ "@nrwl/react": "17.0.0-rc.1"
45
45
  },
46
46
  "publishConfig": {
47
47
  "access": "public"
@@ -38,7 +38,7 @@ async function normalizeOptions(host, options, callingGenerator = '@nx/react:app
38
38
  ? null
39
39
  : options.style;
40
40
  (0, assertion_1.assertValidStyle)(options.style);
41
- if (options.bundler === 'vite') {
41
+ if (options.bundler === 'vite' && options.unitTestRunner !== 'none') {
42
42
  options.unitTestRunner = 'vitest';
43
43
  }
44
44
  const normalized = {
@@ -58,9 +58,7 @@ async function normalizeOptions(host, options, callingGenerator = '@nx/react:app
58
58
  normalized.classComponent = normalized.classComponent ?? false;
59
59
  normalized.compiler = normalized.compiler ?? 'babel';
60
60
  normalized.bundler = normalized.bundler ?? 'webpack';
61
- normalized.unitTestRunner =
62
- normalized.unitTestRunner ??
63
- (normalized.bundler === 'vite' ? 'vitest' : 'jest');
61
+ normalized.unitTestRunner = normalized.unitTestRunner ?? 'jest';
64
62
  normalized.e2eTestRunner = normalized.e2eTestRunner ?? 'cypress';
65
63
  normalized.inSourceTests = normalized.minimal || normalized.inSourceTests;
66
64
  normalized.devServerPort ??= (0, find_free_port_1.findFreePort)(host);
@@ -73,7 +73,7 @@ function addExportsToBarrel(host, options) {
73
73
  tsModule = (0, ensure_typescript_1.ensureTypescript)();
74
74
  }
75
75
  const workspace = (0, devkit_1.getProjects)(host);
76
- const isApp = workspace.get(options.project).projectType === 'application';
76
+ const isApp = workspace.get(options.projectName).projectType === 'application';
77
77
  if (options.export && !isApp) {
78
78
  const indexFilePath = (0, devkit_1.joinPathFragments)(options.projectSourceRoot, options.js ? 'index.js' : 'index.ts');
79
79
  const indexSource = host.read(indexFilePath, 'utf-8');
@@ -35,7 +35,7 @@ async function normalizeOptions(tree, options) {
35
35
  options.inSourceTests = options.inSourceTests ?? false;
36
36
  return {
37
37
  ...options,
38
- project: projectName,
38
+ projectName,
39
39
  directory,
40
40
  styledModule,
41
41
  hasStyles: options.style !== 'none',
@@ -5,7 +5,7 @@ export interface Schema {
5
5
  /**
6
6
  * @deprecated Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v18.
7
7
  */
8
- project: string;
8
+ project?: string;
9
9
  style: SupportedStyles;
10
10
  skipTests?: boolean;
11
11
  directory?: string;
@@ -37,6 +37,7 @@ export interface Schema {
37
37
 
38
38
  export interface NormalizedSchema extends Schema {
39
39
  projectSourceRoot: string;
40
+ projectName: string;
40
41
  fileName: string;
41
42
  filePath: string;
42
43
  className: string;
@@ -7,6 +7,12 @@ const utils_1 = require("./lib/utils");
7
7
  const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
8
8
  const js_1 = require("@nx/js");
9
9
  async function federateModuleGenerator(tree, schema) {
10
+ // Check if the file exists
11
+ if (!tree.exists(schema.path)) {
12
+ throw new Error((0, devkit_1.stripIndents) `The "path" provided does not exist. Please verify the path is correct and pointing to a file that exists in the workspace.
13
+
14
+ Path: ${schema.path}`);
15
+ }
10
16
  const tasks = [];
11
17
  // Check remote exists
12
18
  const remote = (0, utils_1.checkRemoteExists)(tree, schema.remote);
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "path": {
27
27
  "type": "string",
28
- "description": "The path to locate the federated module.",
28
+ "description": "The path to locate the federated module. This path should be relative to the workspace root and the file should exist.",
29
29
  "x-prompt": "What is the path to the module to be federated?"
30
30
  },
31
31
  "remote": {
@@ -45,7 +45,7 @@ function addExportsToBarrel(host, options) {
45
45
  tsModule = (0, ensure_typescript_1.ensureTypescript)();
46
46
  }
47
47
  const workspace = (0, devkit_1.getProjects)(host);
48
- const isApp = workspace.get(options.project).projectType === 'application';
48
+ const isApp = workspace.get(options.projectName).projectType === 'application';
49
49
  if (options.export && !isApp) {
50
50
  const indexFilePath = (0, devkit_1.joinPathFragments)(options.projectSourceRoot, options.js ? 'index.js' : 'index.ts');
51
51
  const indexSource = host.read(indexFilePath, 'utf-8');
@@ -88,7 +88,7 @@ async function normalizeOptions(host, options) {
88
88
  : 'use-'.concat(fileName);
89
89
  const hookName = 'use'.concat(className);
90
90
  const hookTypeName = 'Use'.concat(className);
91
- const project = (0, devkit_1.getProjects)(host).get(options.project);
91
+ const project = (0, devkit_1.getProjects)(host).get(projectName);
92
92
  const { sourceRoot: projectSourceRoot, projectType } = project;
93
93
  if (options.export && projectType === 'application') {
94
94
  devkit_1.logger.warn(`The "--export" option should not be used with applications and will do nothing.`);
@@ -112,6 +112,7 @@ async function normalizeOptions(host, options) {
112
112
  hookTypeName,
113
113
  fileName: hookFilename,
114
114
  projectSourceRoot,
115
+ projectName,
115
116
  };
116
117
  }
117
118
  function assertValidOptions(options) {
@@ -115,7 +115,7 @@ async function normalizeOptions(host, options) {
115
115
  // for it without needing to specify --appProject.
116
116
  options.appProject =
117
117
  options.appProject ||
118
- (projectType === 'application' ? options.project : undefined);
118
+ (projectType === 'application' ? projectName : undefined);
119
119
  if (options.appProject) {
120
120
  const appConfig = projects.get(options.appProject);
121
121
  if (appConfig.projectType !== 'application') {
@@ -1,6 +1,9 @@
1
1
  export interface Schema {
2
2
  name: string;
3
- project: string;
3
+ /**
4
+ * @deprecated Provide the `directory` option instead and use the `as-provided` format. The project will be determined from the directory provided. It will be removed in Nx v18.
5
+ */
6
+ project?: string;
4
7
  directory?: string;
5
8
  appProject?: string;
6
9
  js?: string;
@@ -44,6 +44,9 @@
44
44
  "type": "string",
45
45
  "description": "Path to ignore."
46
46
  },
47
+ "default": [
48
+ "*.stories.ts,*.stories.tsx,*.stories.js,*.stories.jsx,*.stories.mdx"
49
+ ],
47
50
  "examples": [
48
51
  "apps/my-app/src/not-stories/**",
49
52
  "**/**/src/**/not-stories/**",
@@ -78,6 +78,9 @@
78
78
  "type": "string",
79
79
  "description": "Path to ignore."
80
80
  },
81
+ "default": [
82
+ "*.stories.ts,*.stories.tsx,*.stories.js,*.stories.jsx,*.stories.mdx"
83
+ ],
81
84
  "examples": [
82
85
  "apps/my-app/src/not-stories/**",
83
86
  "**/**/src/**/not-stories/**",