@nx/storybook 17.0.1 → 17.0.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.0.
|
|
3
|
+
"version": "17.0.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.0.
|
|
37
|
-
"@nx/devkit": "17.0.
|
|
38
|
-
"@nx/js": "17.0.
|
|
39
|
-
"@nx/eslint": "17.0.
|
|
40
|
-
"@nrwl/storybook": "17.0.
|
|
36
|
+
"@nx/cypress": "17.0.3",
|
|
37
|
+
"@nx/devkit": "17.0.3",
|
|
38
|
+
"@nx/js": "17.0.3",
|
|
39
|
+
"@nx/eslint": "17.0.3",
|
|
40
|
+
"@nrwl/storybook": "17.0.3"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
@@ -8,6 +8,8 @@ export interface CypressConfigureSchema {
|
|
|
8
8
|
standaloneConfig?: boolean;
|
|
9
9
|
ciTargetName?: string;
|
|
10
10
|
skipFormat?: boolean;
|
|
11
|
+
projectNameAndRootFormat?: 'as-provided' | 'derived';
|
|
11
12
|
}
|
|
12
13
|
export declare function cypressProjectGenerator(tree: Tree, schema: CypressConfigureSchema): Promise<GeneratorCallback>;
|
|
14
|
+
export declare function cypressProjectGeneratorInternal(tree: Tree, schema: CypressConfigureSchema): Promise<GeneratorCallback>;
|
|
13
15
|
export default cypressProjectGenerator;
|
|
@@ -1,26 +1,48 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cypressProjectGenerator = void 0;
|
|
4
|
-
const cypress_1 = require("@nx/cypress");
|
|
3
|
+
exports.cypressProjectGeneratorInternal = exports.cypressProjectGenerator = void 0;
|
|
5
4
|
const project_name_1 = require("@nx/cypress/src/utils/project-name");
|
|
6
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
7
7
|
const path_1 = require("path");
|
|
8
8
|
const utilities_1 = require("../../utils/utilities");
|
|
9
|
+
const versions_1 = require("../../utils/versions");
|
|
9
10
|
async function cypressProjectGenerator(tree, schema) {
|
|
11
|
+
return await cypressProjectGeneratorInternal(tree, {
|
|
12
|
+
projectNameAndRootFormat: 'derived',
|
|
13
|
+
...schema,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
exports.cypressProjectGenerator = cypressProjectGenerator;
|
|
17
|
+
async function cypressProjectGeneratorInternal(tree, schema) {
|
|
18
|
+
const { configurationGenerator, cypressInitGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
|
19
|
+
const e2eName = schema.name ? `${schema.name}-e2e` : undefined;
|
|
20
|
+
const { projectName, projectRoot } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
|
|
21
|
+
name: e2eName,
|
|
22
|
+
projectType: 'application',
|
|
23
|
+
directory: schema.directory,
|
|
24
|
+
projectNameAndRootFormat: schema.projectNameAndRootFormat,
|
|
25
|
+
callingGenerator: '@nx/storybook:cypress-project',
|
|
26
|
+
});
|
|
10
27
|
const libConfig = (0, devkit_1.readProjectConfiguration)(tree, schema.name);
|
|
11
28
|
const libRoot = libConfig.root;
|
|
12
|
-
const cypressProjectName = `${schema.directory ? (0, project_name_1.getUnscopedLibName)(libRoot) : schema.name}-e2e`;
|
|
13
29
|
const tasks = [];
|
|
14
30
|
if (!projectAlreadyHasCypress(tree)) {
|
|
15
|
-
tasks.push(await
|
|
31
|
+
tasks.push(await cypressInitGenerator(tree, {}));
|
|
16
32
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
33
|
+
(0, devkit_1.addProjectConfiguration)(tree, projectName, {
|
|
34
|
+
root: projectRoot,
|
|
35
|
+
projectType: 'application',
|
|
36
|
+
sourceRoot: (0, devkit_1.joinPathFragments)(projectRoot, 'src'),
|
|
37
|
+
targets: {},
|
|
38
|
+
implicitDependencies: [projectName],
|
|
39
|
+
});
|
|
40
|
+
const installTask = await configurationGenerator(tree, {
|
|
41
|
+
project: projectName,
|
|
20
42
|
js: schema.js,
|
|
21
43
|
linter: schema.linter,
|
|
22
|
-
directory:
|
|
23
|
-
|
|
44
|
+
directory: projectRoot,
|
|
45
|
+
devServerTarget: `${schema.name}:storybook`,
|
|
24
46
|
skipFormat: true,
|
|
25
47
|
});
|
|
26
48
|
tasks.push(installTask);
|
|
@@ -37,7 +59,7 @@ async function cypressProjectGenerator(tree, schema) {
|
|
|
37
59
|
}
|
|
38
60
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
39
61
|
}
|
|
40
|
-
exports.
|
|
62
|
+
exports.cypressProjectGeneratorInternal = cypressProjectGeneratorInternal;
|
|
41
63
|
function removeUnneededFiles(tree, projectName, js) {
|
|
42
64
|
const { sourceRoot, root } = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
43
65
|
const fileType = js ? 'js' : 'ts';
|
|
@@ -33,12 +33,6 @@
|
|
|
33
33
|
"enum": ["eslint", "none"],
|
|
34
34
|
"default": "eslint"
|
|
35
35
|
},
|
|
36
|
-
"standaloneConfig": {
|
|
37
|
-
"description": "Split the project configuration into `<projectRoot>/project.json` rather than including it inside `workspace.json`.",
|
|
38
|
-
"type": "boolean",
|
|
39
|
-
"default": true,
|
|
40
|
-
"x-deprecated": "Nx only supports standaloneConfig"
|
|
41
|
-
},
|
|
42
36
|
"ciTargetName": {
|
|
43
37
|
"type": "string",
|
|
44
38
|
"description": "The name of the devServerTarget to use for the Cypress CI configuration. Used to control if using <storybook-project>:static-storybook:ci or <storybook-project>:storybook:ci",
|
|
@@ -49,6 +43,11 @@
|
|
|
49
43
|
"type": "boolean",
|
|
50
44
|
"default": false,
|
|
51
45
|
"x-priority": "internal"
|
|
46
|
+
},
|
|
47
|
+
"projectNameAndRootFormat": {
|
|
48
|
+
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
|
|
49
|
+
"type": "string",
|
|
50
|
+
"enum": ["as-provided", "derived"]
|
|
52
51
|
}
|
|
53
52
|
},
|
|
54
53
|
"required": ["name"]
|
|
@@ -14,7 +14,7 @@ function callUpgrade(schema) {
|
|
|
14
14
|
],
|
|
15
15
|
color: 'blue',
|
|
16
16
|
});
|
|
17
|
-
(0, child_process_1.execSync)(`${pm.
|
|
17
|
+
(0, child_process_1.execSync)(`${pm.dlx} storybook@latest upgrade ${schema.autoAcceptAllPrompts ? '--yes' : ''}`, {
|
|
18
18
|
stdio: [0, 1, 2],
|
|
19
19
|
});
|
|
20
20
|
devkit_1.output.log({
|
|
@@ -56,7 +56,7 @@ function callAutomigrate(allStorybookProjects, schema) {
|
|
|
56
56
|
};
|
|
57
57
|
Object.entries(allStorybookProjects).forEach(([projectName, storybookProjectInfo]) => {
|
|
58
58
|
const pm = (0, devkit_1.getPackageManagerCommand)();
|
|
59
|
-
const commandToRun = `${pm.
|
|
59
|
+
const commandToRun = `${pm.dlx} storybook@latest automigrate --config-dir ${storybookProjectInfo.configDir} --renderer ${storybookProjectInfo.uiFramework}`;
|
|
60
60
|
try {
|
|
61
61
|
devkit_1.output.log({
|
|
62
62
|
title: `Calling sb automigrate for ${projectName}`,
|