@nx/storybook 17.1.1 → 17.1.3
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/storybook",
|
|
3
|
-
"version": "17.1.
|
|
3
|
+
"version": "17.1.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Plugin for Storybook contains executors and generators for allowing your workspace to use the powerful Storybook integration testing & documenting capabilities.",
|
|
6
6
|
"repository": {
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
34
34
|
"semver": "7.5.3",
|
|
35
35
|
"tslib": "^2.3.0",
|
|
36
|
-
"@nx/cypress": "17.1.
|
|
37
|
-
"@nx/devkit": "17.1.
|
|
38
|
-
"@nx/js": "17.1.
|
|
39
|
-
"@nx/eslint": "17.1.
|
|
40
|
-
"@nrwl/storybook": "17.1.
|
|
36
|
+
"@nx/cypress": "17.1.3",
|
|
37
|
+
"@nx/devkit": "17.1.3",
|
|
38
|
+
"@nx/js": "17.1.3",
|
|
39
|
+
"@nx/eslint": "17.1.3",
|
|
40
|
+
"@nrwl/storybook": "17.1.3"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
@@ -15,7 +15,7 @@ async function configurationGenerator(tree, rawSchema) {
|
|
|
15
15
|
}
|
|
16
16
|
const schema = normalizeSchema(rawSchema);
|
|
17
17
|
const tasks = [];
|
|
18
|
-
const { projectType, targets, root } = (0, devkit_1.readProjectConfiguration)(tree, schema.
|
|
18
|
+
const { projectType, targets, root } = (0, devkit_1.readProjectConfiguration)(tree, schema.project);
|
|
19
19
|
const { nextBuildTarget, compiler, viteBuildTarget } = (0, utilities_1.findStorybookAndBuildTargetsAndCompiler)(targets);
|
|
20
20
|
let viteConfigFilePath;
|
|
21
21
|
if (viteBuildTarget) {
|
|
@@ -23,12 +23,12 @@ async function configurationGenerator(tree, rawSchema) {
|
|
|
23
23
|
}
|
|
24
24
|
if (viteBuildTarget) {
|
|
25
25
|
if (schema.uiFramework === '@storybook/react-webpack5') {
|
|
26
|
-
devkit_1.logger.info(`Your project ${schema.
|
|
26
|
+
devkit_1.logger.info(`Your project ${schema.project} uses Vite as a bundler.
|
|
27
27
|
Nx will configure Storybook for this project to use Vite as well.`);
|
|
28
28
|
schema.uiFramework = '@storybook/react-vite';
|
|
29
29
|
}
|
|
30
30
|
if (schema.uiFramework === '@storybook/web-components-webpack5') {
|
|
31
|
-
devkit_1.logger.info(`Your project ${schema.
|
|
31
|
+
devkit_1.logger.info(`Your project ${schema.project} uses Vite as a bundler.
|
|
32
32
|
Nx will configure Storybook for this project to use Vite as well.`);
|
|
33
33
|
schema.uiFramework = '@storybook/web-components-vite';
|
|
34
34
|
}
|
|
@@ -43,7 +43,7 @@ async function configurationGenerator(tree, rawSchema) {
|
|
|
43
43
|
tasks.push(initTask);
|
|
44
44
|
const mainDir = !!nextBuildTarget && projectType === 'application' ? 'components' : 'src';
|
|
45
45
|
const usesVite = !!viteBuildTarget || schema.uiFramework.endsWith('-vite');
|
|
46
|
-
(0, util_functions_1.createProjectStorybookDir)(tree, schema.
|
|
46
|
+
(0, util_functions_1.createProjectStorybookDir)(tree, schema.project, schema.uiFramework, schema.js, schema.tsConfiguration, root, projectType, (0, util_functions_1.projectIsRootProjectInStandaloneWorkspace)(root), schema.interactionTests, mainDir, !!nextBuildTarget, compiler === 'swc', usesVite, viteConfigFilePath);
|
|
47
47
|
if (schema.uiFramework !== '@storybook/angular') {
|
|
48
48
|
(0, util_functions_1.createStorybookTsconfigFile)(tree, root, schema.uiFramework, (0, util_functions_1.projectIsRootProjectInStandaloneWorkspace)(root), mainDir);
|
|
49
49
|
}
|
|
@@ -54,20 +54,20 @@ async function configurationGenerator(tree, rawSchema) {
|
|
|
54
54
|
(0, util_functions_1.addBuildStorybookToCacheableOperations)(tree);
|
|
55
55
|
(0, util_functions_1.addStorybookToNamedInputs)(tree);
|
|
56
56
|
if (schema.uiFramework === '@storybook/angular') {
|
|
57
|
-
(0, util_functions_1.addAngularStorybookTask)(tree, schema.
|
|
57
|
+
(0, util_functions_1.addAngularStorybookTask)(tree, schema.project, schema.interactionTests);
|
|
58
58
|
}
|
|
59
59
|
else {
|
|
60
|
-
(0, util_functions_1.addStorybookTask)(tree, schema.
|
|
60
|
+
(0, util_functions_1.addStorybookTask)(tree, schema.project, schema.uiFramework, schema.interactionTests);
|
|
61
61
|
}
|
|
62
62
|
if (schema.configureStaticServe) {
|
|
63
63
|
(0, util_functions_1.addStaticTarget)(tree, schema);
|
|
64
64
|
}
|
|
65
65
|
// TODO(katerina): Nx 18 -> remove Cypress
|
|
66
66
|
if (schema.configureCypress) {
|
|
67
|
-
const e2eProject = await (0, util_functions_1.getE2EProjectName)(tree, schema.
|
|
67
|
+
const e2eProject = await (0, util_functions_1.getE2EProjectName)(tree, schema.project);
|
|
68
68
|
if (!e2eProject) {
|
|
69
69
|
const cypressTask = await (0, cypress_project_1.cypressProjectGenerator)(tree, {
|
|
70
|
-
name: schema.
|
|
70
|
+
name: schema.project,
|
|
71
71
|
js: schema.js,
|
|
72
72
|
linter: schema.linter,
|
|
73
73
|
directory: schema.cypressDirectory,
|
|
@@ -80,7 +80,7 @@ async function configurationGenerator(tree, rawSchema) {
|
|
|
80
80
|
tasks.push(cypressTask);
|
|
81
81
|
}
|
|
82
82
|
else {
|
|
83
|
-
devkit_1.logger.warn(`There is already an e2e project setup for ${schema.
|
|
83
|
+
devkit_1.logger.warn(`There is already an e2e project setup for ${schema.project}, called ${e2eProject}.`);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
let devDeps = {};
|
|
@@ -97,17 +97,17 @@ exports.addAngularStorybookTask = addAngularStorybookTask;
|
|
|
97
97
|
function addStaticTarget(tree, opts) {
|
|
98
98
|
const nrwlWeb = (0, devkit_1.ensurePackage)('@nx/web', versions_1.nxVersion);
|
|
99
99
|
nrwlWeb.webStaticServeGenerator(tree, {
|
|
100
|
-
buildTarget: `${opts.
|
|
101
|
-
outputPath: (0, devkit_1.joinPathFragments)('dist/storybook', opts.
|
|
100
|
+
buildTarget: `${opts.project}:build-storybook`,
|
|
101
|
+
outputPath: (0, devkit_1.joinPathFragments)('dist/storybook', opts.project),
|
|
102
102
|
targetName: 'static-storybook',
|
|
103
103
|
});
|
|
104
|
-
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, opts.
|
|
104
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, opts.project);
|
|
105
105
|
projectConfig.targets['static-storybook'].configurations = {
|
|
106
106
|
ci: {
|
|
107
|
-
buildTarget: `${opts.
|
|
107
|
+
buildTarget: `${opts.project}:build-storybook:ci`,
|
|
108
108
|
},
|
|
109
109
|
};
|
|
110
|
-
(0, devkit_1.updateProjectConfiguration)(tree, opts.
|
|
110
|
+
(0, devkit_1.updateProjectConfiguration)(tree, opts.project, projectConfig);
|
|
111
111
|
}
|
|
112
112
|
exports.addStaticTarget = addStaticTarget;
|
|
113
113
|
function createStorybookTsconfigFile(tree, projectRoot, uiFramework, isRootProject, mainDir) {
|
|
@@ -186,7 +186,7 @@ function editTsconfigBaseJson(tree) {
|
|
|
186
186
|
}
|
|
187
187
|
exports.editTsconfigBaseJson = editTsconfigBaseJson;
|
|
188
188
|
function configureTsProjectConfig(tree, schema) {
|
|
189
|
-
const {
|
|
189
|
+
const { project: projectName } = schema;
|
|
190
190
|
let tsConfigPath;
|
|
191
191
|
let tsConfigContent;
|
|
192
192
|
try {
|
|
@@ -218,7 +218,7 @@ function configureTsProjectConfig(tree, schema) {
|
|
|
218
218
|
}
|
|
219
219
|
exports.configureTsProjectConfig = configureTsProjectConfig;
|
|
220
220
|
function configureTsSolutionConfig(tree, schema) {
|
|
221
|
-
const {
|
|
221
|
+
const { project: projectName } = schema;
|
|
222
222
|
const { root } = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
223
223
|
const tsConfigPath = (0, path_1.join)(root, 'tsconfig.json');
|
|
224
224
|
const tsConfigContent = (0, devkit_1.readJson)(tree, tsConfigPath);
|
|
@@ -257,7 +257,7 @@ exports.configureTsSolutionConfig = configureTsSolutionConfig;
|
|
|
257
257
|
* This is done within the eslint config file.
|
|
258
258
|
*/
|
|
259
259
|
function updateLintConfig(tree, schema) {
|
|
260
|
-
const {
|
|
260
|
+
const { project: projectName } = schema;
|
|
261
261
|
const { root } = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
262
262
|
const eslintFile = (0, eslint_file_1.findEslintFile)(tree, root);
|
|
263
263
|
if (!eslintFile) {
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
"description": "Add Storybook configuration to a UI library or an application.",
|
|
7
7
|
"type": "object",
|
|
8
8
|
"properties": {
|
|
9
|
-
"
|
|
9
|
+
"project": {
|
|
10
10
|
"type": "string",
|
|
11
|
-
"aliases": ["
|
|
11
|
+
"aliases": ["name", "projectName"],
|
|
12
12
|
"description": "Project for which to generate Storybook configuration.",
|
|
13
13
|
"$default": {
|
|
14
14
|
"$source": "argv",
|
|
@@ -103,6 +103,6 @@
|
|
|
103
103
|
"x-priority": "internal"
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
|
-
"required": ["
|
|
106
|
+
"required": ["project", "uiFramework"],
|
|
107
107
|
"examplesFile": "../../../docs/configuration-generator-examples.md"
|
|
108
108
|
}
|