@nx/react 21.2.0-beta.2 → 21.2.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 +6 -6
- package/plugins/component-testing/index.js +5 -3
- package/src/generators/component-story/files/jsx/__componentFileName__.stories.jsx__tmpl__ +4 -6
- package/src/generators/component-story/files/tsx/__componentFileName__.stories.tsx__tmpl__ +4 -6
- package/src/generators/stories/stories.d.ts +2 -2
- package/src/generators/stories/stories.js +0 -8
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/react",
|
3
|
-
"version": "21.2.0-beta.
|
3
|
+
"version": "21.2.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": "21.2.0-beta.
|
42
|
-
"@nx/js": "21.2.0-beta.
|
43
|
-
"@nx/eslint": "21.2.0-beta.
|
44
|
-
"@nx/web": "21.2.0-beta.
|
45
|
-
"@nx/module-federation": "21.2.0-beta.
|
41
|
+
"@nx/devkit": "21.2.0-beta.4",
|
42
|
+
"@nx/js": "21.2.0-beta.4",
|
43
|
+
"@nx/eslint": "21.2.0-beta.4",
|
44
|
+
"@nx/web": "21.2.0-beta.4",
|
45
|
+
"@nx/module-federation": "21.2.0-beta.4",
|
46
46
|
"express": "^4.21.2",
|
47
47
|
"http-proxy-middleware": "^3.0.3",
|
48
48
|
"semver": "^7.6.3"
|
@@ -148,9 +148,11 @@ function buildTargetWebpack(ctx, buildTarget, componentTestingProjectName) {
|
|
148
148
|
`);
|
149
149
|
}
|
150
150
|
if (buildableProjectConfig.targets[parsed.target].executor !==
|
151
|
-
'@nx/webpack:webpack'
|
152
|
-
|
153
|
-
|
151
|
+
'@nx/webpack:webpack' &&
|
152
|
+
buildableProjectConfig.targets[parsed.target].executor !==
|
153
|
+
'@nx/rspack:rspack') {
|
154
|
+
throw new InvalidExecutorError(`The '${parsed.target}' target of the '${parsed.project}' project is not using the '@nx/webpack:webpack' or '@nx/rspack:rspack' executor. ` +
|
155
|
+
`Please make sure to use '@nx/webpack:webpack' or '@nx/rspack:rspack' executor in that target to use Cypress Component Testing.`);
|
154
156
|
}
|
155
157
|
const context = (0, ct_helpers_1.createExecutorContext)(graph, buildableProjectConfig.targets, parsed.project, parsed.target, parsed.target);
|
156
158
|
const { normalizeOptions, } = require('@nx/webpack/src/executors/webpack/lib/normalize-options');
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import componentName from './<%= componentImportFileName %>';
|
2
2
|
<%_ if ( interactionTests ) { _%>
|
3
|
-
import {
|
4
|
-
import { expect } from '@storybook/jest';
|
3
|
+
import { expect } from 'storybook/test';
|
5
4
|
<%_ } _%>
|
6
5
|
|
7
6
|
export default {
|
@@ -21,9 +20,8 @@ export const Primary = {
|
|
21
20
|
|
22
21
|
<%_ if ( interactionTests ) { _%>
|
23
22
|
export const Heading: Story = {
|
24
|
-
play: async ({
|
25
|
-
|
26
|
-
expect(canvas.getByText(/Welcome to <%=componentName%>!/gi)).toBeTruthy();
|
23
|
+
play: async ({ canvas }) => {
|
24
|
+
await expect(canvas.getByText(/Welcome to <%=componentName%>!/gi)).toBeTruthy();
|
27
25
|
},
|
28
26
|
};
|
29
|
-
<%_ } _%>
|
27
|
+
<%_ } _%>
|
@@ -1,8 +1,7 @@
|
|
1
|
-
import type { Meta, StoryObj } from '
|
1
|
+
import type { Meta, StoryObj } from 'storybook/internal/types';
|
2
2
|
import { <%= componentName %> } from './<%= componentImportFileName %>';
|
3
3
|
<%_ if ( interactionTests ) { _%>
|
4
|
-
import {
|
5
|
-
import { expect } from '@storybook/jest';
|
4
|
+
import { expect } from 'storybook/test';
|
6
5
|
<%_ } _%>
|
7
6
|
|
8
7
|
const meta: Meta<typeof <%= componentName %>> = {
|
@@ -27,9 +26,8 @@ export const Heading: Story = {
|
|
27
26
|
args: {<% for (let prop of props) { %>
|
28
27
|
<%= prop.name %>: <%- prop.defaultValue %>,<% } %>
|
29
28
|
},
|
30
|
-
play: async ({
|
31
|
-
|
32
|
-
expect(canvas.getByText(/Welcome to <%=componentName%>!/gi)).toBeTruthy();
|
29
|
+
play: async ({ canvas }) => {
|
30
|
+
await expect(canvas.getByText(/Welcome to <%=componentName%>!/gi)).toBeTruthy();
|
33
31
|
},
|
34
32
|
};
|
35
33
|
<% } %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { ProjectConfiguration, Tree } from '@nx/devkit';
|
2
2
|
export interface StorybookStoriesSchema {
|
3
3
|
project: string;
|
4
4
|
interactionTests?: boolean;
|
@@ -9,5 +9,5 @@ export interface StorybookStoriesSchema {
|
|
9
9
|
export declare function projectRootPath(tree: Tree, config: ProjectConfiguration): Promise<string>;
|
10
10
|
export declare function containsComponentDeclaration(tree: Tree, componentPath: string): boolean;
|
11
11
|
export declare function createAllStories(tree: Tree, projectName: string, interactionTests: boolean, js: boolean, projects: Map<string, ProjectConfiguration>, projectConfiguration: ProjectConfiguration, ignorePaths?: string[]): Promise<void>;
|
12
|
-
export declare function storiesGenerator(host: Tree, schema: StorybookStoriesSchema): Promise<
|
12
|
+
export declare function storiesGenerator(host: Tree, schema: StorybookStoriesSchema): Promise<void>;
|
13
13
|
export default storiesGenerator;
|
@@ -10,7 +10,6 @@ const devkit_1 = require("@nx/devkit");
|
|
10
10
|
const path_1 = require("path");
|
11
11
|
const minimatch_1 = require("minimatch");
|
12
12
|
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
13
|
-
const versions_1 = require("../../utils/versions");
|
14
13
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
15
14
|
let tsModule;
|
16
15
|
async function projectRootPath(tree, config) {
|
@@ -91,16 +90,9 @@ async function storiesGenerator(host, schema) {
|
|
91
90
|
const projectConfiguration = projects.get(schema.project);
|
92
91
|
schema.interactionTests = schema.interactionTests ?? true;
|
93
92
|
await createAllStories(host, schema.project, schema.interactionTests, schema.js, projects, projectConfiguration, schema.ignorePaths);
|
94
|
-
const tasks = [];
|
95
|
-
if (schema.interactionTests) {
|
96
|
-
const { interactionTestsDependencies, addInteractionsInAddons } = (0, devkit_1.ensurePackage)('@nx/storybook', versions_1.nxVersion);
|
97
|
-
tasks.push((0, devkit_1.addDependenciesToPackageJson)(host, {}, interactionTestsDependencies()));
|
98
|
-
addInteractionsInAddons(host, projectConfiguration);
|
99
|
-
}
|
100
93
|
if (!schema.skipFormat) {
|
101
94
|
await (0, devkit_1.formatFiles)(host);
|
102
95
|
}
|
103
|
-
return (0, devkit_1.runTasksInSerial)(...tasks);
|
104
96
|
}
|
105
97
|
async function isNextJsProject(tree, config) {
|
106
98
|
const { findStorybookAndBuildTargetsAndCompiler } = await Promise.resolve().then(() => require('@nx/storybook/src/utils/utilities'));
|