@nx/storybook 24.0.0-beta.1 → 24.0.0-beta.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/dist/src/generators/configuration/configuration.js +14 -32
- package/dist/src/generators/configuration/files/v10/project-files/.storybook/main.js__tmpl__ +8 -12
- package/dist/src/generators/configuration/files/v10/project-files-ts/.storybook/main.ts__tmpl__ +8 -11
- package/dist/src/generators/configuration/files/v9/project-files/.storybook/main.js__tmpl__ +8 -12
- package/dist/src/generators/configuration/files/v9/project-files-ts/.storybook/main.ts__tmpl__ +8 -11
- package/dist/src/generators/configuration/lib/util-functions.d.ts +1 -3
- package/dist/src/generators/configuration/lib/util-functions.js +8 -79
- package/dist/src/generators/configuration/schema.d.ts +0 -2
- package/dist/src/generators/convert-to-inferred/convert-to-inferred.js +4 -3
- package/dist/src/generators/init/init.js +36 -54
- package/dist/src/generators/init/schema.d.ts +0 -1
- package/dist/src/generators/migrate-10/files/ai-instructions-for-cjs-esm.md +2 -2
- package/dist/src/migrations/update-24-0-0/finish-inferred-conversion.md +12 -0
- package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.d.ts +6 -0
- package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.js +15 -0
- package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.md +88 -0
- package/dist/src/utils/utilities.d.ts +0 -1
- package/dist/src/utils/utilities.js +0 -12
- package/dist/src/utils/versions.d.ts +1 -0
- package/dist/src/utils/versions.js +2 -1
- package/executors.json +1 -12
- package/migrations.json +7 -0
- package/package.json +8 -8
- package/dist/src/executors/build-storybook/build-storybook.impl.d.ts +0 -5
- package/dist/src/executors/build-storybook/build-storybook.impl.js +0 -32
- package/dist/src/executors/build-storybook/schema.json +0 -114
- package/dist/src/executors/storybook/schema.json +0 -119
- package/dist/src/executors/storybook/storybook.impl.d.ts +0 -9
- package/dist/src/executors/storybook/storybook.impl.js +0 -35
- package/dist/src/utils/deprecation.d.ts +0 -5
- package/dist/src/utils/deprecation.js +0 -21
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Replace removed @nx/storybook executors with inferred tasks
|
|
2
|
+
|
|
3
|
+
Nx 24 removed `@nx/storybook:storybook`, `@nx/storybook:build` (including old `@nrwl` aliases).
|
|
4
|
+
|
|
5
|
+
Before changing anything, check for leftover work: a project target, a package.json target or a `targetDefaults` entry still uses a removed executor, or the advisory context reports a conversion error. If none applies, make no changes and stop. Treat each advisory-context item as pending work.
|
|
6
|
+
|
|
7
|
+
1. Inspect all affected projects and workspace defaults. Repair config-loading errors first. Do not restore executor registrations or install older Nx packages.
|
|
8
|
+
2. Preserve framework/builder selection, configDir, ports, static assets, output directory and build/dev target names.
|
|
9
|
+
3. Register `@nx/storybook/plugin` with options/includes that preserve custom target names and mixed inferred/explicit projects. Replace remaining removed-executor targets, including those in package.json and filtered targetDefaults. Transfer their behavior before removing obsolete defaults. Preserve configurations, dependencies, cache inputs/outputs and environment behavior. Do not silently delete unsupported options or unrelated targets. Migrate old @nrwl aliases too.
|
|
10
|
+
4. Run project graph creation with the daemon and graph cache disabled (`NX_DAEMON=false NX_CACHE_PROJECT_GRAPH=false`), using the workspace package manager. Inspect resolved project targets and verify each migrated entrypoint exists and is inferred (a thin alias to an inferred target is acceptable). Resolve graph errors before completing this migration, even if task validation was skipped. Configs must load for subsequent migrations.
|
|
11
|
+
5. By default run relevant real builds/tests with task cache disabled, including alternate configurations. Honor an existing preference to skip expensive task validation; otherwise offer that option when validation is slow. Skipping expensive tasks never skips conversion or the graph check. Report each skipped task as unverified. Never weaken assertions or change application behavior to make checks pass.
|
|
12
|
+
6. Report converted projects, graph validation, task results and any skipped checks. Unconverted targets or a broken graph mean the migration is incomplete. Investigate task failures and distinguish missing environment prerequisites from conversion regressions; do not claim a working workspace with unresolved regressions.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = update;
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
5
|
+
function update(tree) {
|
|
6
|
+
return (0, internal_1.migrateRemovedExecutors)(tree, [
|
|
7
|
+
'@nx/storybook:storybook',
|
|
8
|
+
'@nx/storybook:build',
|
|
9
|
+
'@nrwl/storybook:storybook',
|
|
10
|
+
'@nrwl/storybook:build',
|
|
11
|
+
], async (tree, options) => {
|
|
12
|
+
const { convertToInferred } = require('../../generators/convert-to-inferred/convert-to-inferred');
|
|
13
|
+
return convertToInferred(tree, options);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#### Convert `@nx/storybook` build and serve targets to inferred tasks
|
|
2
|
+
|
|
3
|
+
Nx 24 removes the `@nx/storybook:storybook` and `@nx/storybook:build` executors and their `@nrwl` aliases. The migration registers `@nx/storybook/plugin` in `nx.json` and converts the targets that use those executors to inferred tasks. It moves settings such as `docsMode` and `staticDir` into `.storybook/main.*`. A target with nothing left to override is removed from project configuration. When several projects share the same remaining options, those options move to a `targetDefaults` entry scoped to the plugin. `targetDefaults` entries keyed by a removed executor are removed once no target uses that executor.
|
|
4
|
+
|
|
5
|
+
The migration lists the targets the converter cannot convert safely. In agentic runs, an AI prompt finishes them and validates the project graph.
|
|
6
|
+
|
|
7
|
+
#### Sample code changes
|
|
8
|
+
|
|
9
|
+
##### Before
|
|
10
|
+
|
|
11
|
+
```json title="apps/app1/project.json"
|
|
12
|
+
{
|
|
13
|
+
"name": "app1",
|
|
14
|
+
"targets": {
|
|
15
|
+
"build-storybook": {
|
|
16
|
+
"executor": "@nx/storybook:build",
|
|
17
|
+
"outputs": ["{options.outputDir}"],
|
|
18
|
+
"options": {
|
|
19
|
+
"configDir": "apps/app1/.storybook",
|
|
20
|
+
"outputDir": "dist/storybook/apps/app1"
|
|
21
|
+
},
|
|
22
|
+
"configurations": {}
|
|
23
|
+
},
|
|
24
|
+
"storybook": {
|
|
25
|
+
"executor": "@nx/storybook:storybook",
|
|
26
|
+
"options": {
|
|
27
|
+
"port": 4400,
|
|
28
|
+
"configDir": "apps/app1/.storybook"
|
|
29
|
+
},
|
|
30
|
+
"configurations": {
|
|
31
|
+
"ci": {
|
|
32
|
+
"quiet": true
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
##### After
|
|
41
|
+
|
|
42
|
+
```json title="apps/app1/project.json"
|
|
43
|
+
{
|
|
44
|
+
"name": "app1",
|
|
45
|
+
"targets": {
|
|
46
|
+
"build-storybook": {
|
|
47
|
+
"options": {
|
|
48
|
+
"config-dir": ".storybook",
|
|
49
|
+
"output-dir": "../../dist/storybook/apps/app1"
|
|
50
|
+
},
|
|
51
|
+
"outputs": [
|
|
52
|
+
"{projectRoot}/{options.output-dir}",
|
|
53
|
+
"{projectRoot}/storybook-static",
|
|
54
|
+
"{options.output-dir}",
|
|
55
|
+
"{options.outputDir}",
|
|
56
|
+
"{options.o}"
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
"storybook": {
|
|
60
|
+
"configurations": {
|
|
61
|
+
"ci": {
|
|
62
|
+
"args": ["--quiet"]
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"options": {
|
|
66
|
+
"config-dir": ".storybook",
|
|
67
|
+
"port": 4400
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```json title="nx.json"
|
|
75
|
+
{
|
|
76
|
+
"plugins": [
|
|
77
|
+
{
|
|
78
|
+
"plugin": "@nx/storybook/plugin",
|
|
79
|
+
"options": {
|
|
80
|
+
"buildStorybookTargetName": "build-storybook",
|
|
81
|
+
"serveStorybookTargetName": "storybook",
|
|
82
|
+
"staticStorybookTargetName": "static-storybook",
|
|
83
|
+
"testStorybookTargetName": "test-storybook"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
```
|
|
@@ -23,7 +23,6 @@ export type TsConfig = {
|
|
|
23
23
|
path: string;
|
|
24
24
|
}>;
|
|
25
25
|
};
|
|
26
|
-
export declare function storybookConfigExistsCheck(config: string, projectName: string): void;
|
|
27
26
|
export declare function dedupe(arr: string[]): string[];
|
|
28
27
|
export declare function findStorybookAndBuildTargetsAndCompiler(targets: {
|
|
29
28
|
[targetName: string]: TargetConfiguration;
|
|
@@ -3,12 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Constants = exports.getInstalledStorybookVersion = exports.storybookMajorVersion = void 0;
|
|
4
4
|
exports.getStorybookVersionToInstall = getStorybookVersionToInstall;
|
|
5
5
|
exports.safeFileDelete = safeFileDelete;
|
|
6
|
-
exports.storybookConfigExistsCheck = storybookConfigExistsCheck;
|
|
7
6
|
exports.dedupe = dedupe;
|
|
8
7
|
exports.findStorybookAndBuildTargetsAndCompiler = findStorybookAndBuildTargetsAndCompiler;
|
|
9
8
|
exports.isTheFileAStory = isTheFileAStory;
|
|
10
9
|
exports.getTsSourceFile = getTsSourceFile;
|
|
11
|
-
const fs_1 = require("fs");
|
|
12
10
|
const js_1 = require("@nx/js");
|
|
13
11
|
const ts = require("typescript");
|
|
14
12
|
const versions_1 = require("./versions");
|
|
@@ -36,16 +34,6 @@ function safeFileDelete(tree, path) {
|
|
|
36
34
|
return false;
|
|
37
35
|
}
|
|
38
36
|
}
|
|
39
|
-
function storybookConfigExistsCheck(config, projectName) {
|
|
40
|
-
const exists = !!(config && (0, fs_1.statSync)(config).isDirectory());
|
|
41
|
-
if (!exists) {
|
|
42
|
-
throw new Error(`Could not find Storybook configuration for project ${projectName}.
|
|
43
|
-
Please generate Storybook configuration using the following command:
|
|
44
|
-
|
|
45
|
-
nx g @nx/storybook:configuration --name=${projectName}
|
|
46
|
-
`);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
37
|
function dedupe(arr) {
|
|
50
38
|
return Array.from(new Set(arr));
|
|
51
39
|
}
|
|
@@ -7,6 +7,7 @@ export declare const minSupportedStorybookVersion = "8.0.0";
|
|
|
7
7
|
export declare const storybookVersion = "^10.5.0";
|
|
8
8
|
export declare const reactVersion = "^18.2.0";
|
|
9
9
|
export declare const viteVersion = "^6.0.0";
|
|
10
|
+
export declare const viteTsconfigPathsVersion = "~4.3.2";
|
|
10
11
|
export declare const coreJsVersion = "^3.36.1";
|
|
11
12
|
export declare const testRunnerVersion = "^0.24.0";
|
|
12
13
|
type StorybookVersions = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.testRunnerVersion = exports.coreJsVersion = exports.viteVersion = exports.reactVersion = exports.storybookVersion = exports.minSupportedStorybookVersion = exports.tsLibVersion = exports.tsNodeVersion = exports.litVersion = exports.nxVersion = void 0;
|
|
3
|
+
exports.testRunnerVersion = exports.coreJsVersion = exports.viteTsconfigPathsVersion = exports.viteVersion = exports.reactVersion = exports.storybookVersion = exports.minSupportedStorybookVersion = exports.tsLibVersion = exports.tsNodeVersion = exports.litVersion = exports.nxVersion = void 0;
|
|
4
4
|
exports.versions = versions;
|
|
5
5
|
exports.storybookMajorVersion = storybookMajorVersion;
|
|
6
6
|
exports.getInstalledStorybookVersion = getInstalledStorybookVersion;
|
|
@@ -16,6 +16,7 @@ exports.minSupportedStorybookVersion = '8.0.0';
|
|
|
16
16
|
exports.storybookVersion = '^10.5.0';
|
|
17
17
|
exports.reactVersion = '^18.2.0';
|
|
18
18
|
exports.viteVersion = '^6.0.0';
|
|
19
|
+
exports.viteTsconfigPathsVersion = '~4.3.2';
|
|
19
20
|
exports.coreJsVersion = '^3.36.1';
|
|
20
21
|
exports.testRunnerVersion = '^0.24.0';
|
|
21
22
|
const latestVersions = {
|
package/executors.json
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
1
|
{
|
|
2
|
-
"executors": {
|
|
3
|
-
"storybook": {
|
|
4
|
-
"implementation": "./dist/src/executors/storybook/storybook.impl",
|
|
5
|
-
"schema": "./dist/src/executors/storybook/schema.json",
|
|
6
|
-
"description": "Serve Storybook."
|
|
7
|
-
},
|
|
8
|
-
"build": {
|
|
9
|
-
"implementation": "./dist/src/executors/build-storybook/build-storybook.impl",
|
|
10
|
-
"schema": "./dist/src/executors/build-storybook/schema.json",
|
|
11
|
-
"description": "Build Storybook."
|
|
12
|
-
}
|
|
13
|
-
}
|
|
2
|
+
"executors": {}
|
|
14
3
|
}
|
package/migrations.json
CHANGED
|
@@ -33,6 +33,13 @@
|
|
|
33
33
|
"description": "Rename imports of `createNodesV2` from `@nx/storybook/plugin` to the canonical `createNodes` export.",
|
|
34
34
|
"implementation": "./dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes",
|
|
35
35
|
"documentation": "./dist/src/migrations/update-23-0-0/migrate-create-nodes-v2-to-create-nodes.md"
|
|
36
|
+
},
|
|
37
|
+
"remove-deprecated-executors": {
|
|
38
|
+
"version": "24.0.0-beta.3",
|
|
39
|
+
"description": "Converts targets using the removed `@nx/storybook` executors to inferred tasks; an AI prompt finishes the targets the converter cannot convert safely and validates the project graph.",
|
|
40
|
+
"implementation": "./dist/src/migrations/update-24-0-0/remove-deprecated-executors",
|
|
41
|
+
"prompt": "./dist/src/migrations/update-24-0-0/finish-inferred-conversion.md",
|
|
42
|
+
"documentation": "./dist/src/migrations/update-24-0-0/remove-deprecated-executors.md"
|
|
36
43
|
}
|
|
37
44
|
},
|
|
38
45
|
"packageJsonUpdates": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/storybook",
|
|
3
|
-
"version": "24.0.0-beta.
|
|
3
|
+
"version": "24.0.0-beta.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"files": [
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"executors.json",
|
|
11
11
|
"generators.json"
|
|
12
12
|
],
|
|
13
|
-
"description": "The Nx Plugin for Storybook
|
|
13
|
+
"description": "The Nx Plugin for Storybook infers tasks and provides generators for allowing your workspace to use the powerful Storybook integration testing & documenting capabilities.",
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
16
16
|
"url": "https://github.com/nrwl/nx.git",
|
|
@@ -89,20 +89,20 @@
|
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
|
-
"@nx/devkit": "24.0.0-beta.
|
|
92
|
+
"@nx/devkit": "24.0.0-beta.3",
|
|
93
93
|
"@phenomnomnominal/tsquery": "~6.2.0",
|
|
94
94
|
"semver": "^7.6.3",
|
|
95
95
|
"tslib": "^2.3.0",
|
|
96
|
-
"@nx/cypress": "24.0.0-beta.
|
|
97
|
-
"@nx/js": "24.0.0-beta.
|
|
98
|
-
"@nx/eslint": "24.0.0-beta.
|
|
96
|
+
"@nx/cypress": "24.0.0-beta.3",
|
|
97
|
+
"@nx/js": "24.0.0-beta.3",
|
|
98
|
+
"@nx/eslint": "24.0.0-beta.3"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
|
-
"nx": "24.0.0-beta.
|
|
101
|
+
"nx": "24.0.0-beta.3",
|
|
102
102
|
"storybook": "9.0.6"
|
|
103
103
|
},
|
|
104
104
|
"peerDependencies": {
|
|
105
|
-
"@nx/web": "24.0.0-beta.
|
|
105
|
+
"@nx/web": "24.0.0-beta.3",
|
|
106
106
|
"storybook": ">=8.0.0 <11.0.0"
|
|
107
107
|
},
|
|
108
108
|
"peerDependenciesMeta": {
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = buildStorybookExecutor;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const utilities_1 = require("../../utils/utilities");
|
|
6
|
-
const semver_1 = require("semver");
|
|
7
|
-
const deprecation_1 = require("../../utils/deprecation");
|
|
8
|
-
async function buildStorybookExecutor(options, context) {
|
|
9
|
-
(0, deprecation_1.warnStorybookBuildExecutorDeprecation)();
|
|
10
|
-
(0, utilities_1.storybookConfigExistsCheck)(options.configDir, context.projectName);
|
|
11
|
-
const buildOptions = options;
|
|
12
|
-
devkit_1.logger.info(`NX Storybook builder starting ...`);
|
|
13
|
-
await runInstance(buildOptions);
|
|
14
|
-
devkit_1.logger.info(`NX Storybook builder finished ...`);
|
|
15
|
-
devkit_1.logger.info(`NX Storybook files available in ${buildOptions.outputDir}`);
|
|
16
|
-
return { success: true };
|
|
17
|
-
}
|
|
18
|
-
async function runInstance(options) {
|
|
19
|
-
const installedStorybookVersion = (0, utilities_1.getInstalledStorybookVersion)();
|
|
20
|
-
const hasCoreServerInStorybookPackage = (0, semver_1.gte)(installedStorybookVersion, '8.2.0');
|
|
21
|
-
const storybookCore = await (hasCoreServerInStorybookPackage
|
|
22
|
-
? import('storybook/internal/core-server')
|
|
23
|
-
: // This is needed for backwards compatibility - but we do not have the package installed in the nx repo
|
|
24
|
-
// @ts-ignore
|
|
25
|
-
import('@storybook/core-server'));
|
|
26
|
-
const env = process.env.NODE_ENV ?? 'production';
|
|
27
|
-
process.env.NODE_ENV = env;
|
|
28
|
-
return storybookCore.build({
|
|
29
|
-
...options,
|
|
30
|
-
mode: 'static',
|
|
31
|
-
});
|
|
32
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 2,
|
|
3
|
-
"outputCapture": "direct-nodejs",
|
|
4
|
-
"title": "Storybook Builder",
|
|
5
|
-
"cli": "nx",
|
|
6
|
-
"description": "Build storybook in production mode.",
|
|
7
|
-
"type": "object",
|
|
8
|
-
"x-deprecated": "The `@nx/storybook:build` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/storybook:convert-to-inferred` to migrate to the `@nx/storybook/plugin` inferred plugin. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.",
|
|
9
|
-
"presets": [
|
|
10
|
-
{
|
|
11
|
-
"name": "Default minimum setup",
|
|
12
|
-
"keys": ["outputDir", "configDir"]
|
|
13
|
-
}
|
|
14
|
-
],
|
|
15
|
-
"properties": {
|
|
16
|
-
"outputDir": {
|
|
17
|
-
"type": "string",
|
|
18
|
-
"description": "Directory where to store built files.",
|
|
19
|
-
"x-completion-type": "directory"
|
|
20
|
-
},
|
|
21
|
-
"styles": {
|
|
22
|
-
"type": "array",
|
|
23
|
-
"description": "Global styles to be included in the build.",
|
|
24
|
-
"items": {
|
|
25
|
-
"$ref": "#/definitions/extraEntryPoint"
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"stylePreprocessorOptions": {
|
|
29
|
-
"type": "object",
|
|
30
|
-
"description": "Options to pass to style preprocessors.",
|
|
31
|
-
"properties": {
|
|
32
|
-
"includePaths": {
|
|
33
|
-
"type": "array",
|
|
34
|
-
"description": "The paths to include. Paths will be resolved to workspace root.",
|
|
35
|
-
"items": {
|
|
36
|
-
"type": "string"
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
"docsMode": {
|
|
42
|
-
"type": "boolean",
|
|
43
|
-
"description": "Build a documentation-only site using addon-docs.",
|
|
44
|
-
"default": false
|
|
45
|
-
},
|
|
46
|
-
"configDir": {
|
|
47
|
-
"type": "string",
|
|
48
|
-
"description": "Directory where to load Storybook configurations from.",
|
|
49
|
-
"x-completion-type": "directory",
|
|
50
|
-
"x-priority": "important"
|
|
51
|
-
},
|
|
52
|
-
"loglevel": {
|
|
53
|
-
"type": "string",
|
|
54
|
-
"description": "Controls level of logging during build. Can be one of: [silly, verbose, info (default), warn, error, silent].",
|
|
55
|
-
"pattern": "(silly|verbose|info|warn|silent)"
|
|
56
|
-
},
|
|
57
|
-
"quiet": {
|
|
58
|
-
"type": "boolean",
|
|
59
|
-
"description": "Suppress verbose build output."
|
|
60
|
-
},
|
|
61
|
-
"docs": {
|
|
62
|
-
"type": "boolean",
|
|
63
|
-
"description": "Starts Storybook in documentation mode. Learn more about it : https://storybook.js.org/docs/react/writing-docs/build-documentation#preview-storybooks-documentation."
|
|
64
|
-
},
|
|
65
|
-
"webpackStatsJson": {
|
|
66
|
-
"type": ["boolean", "string"],
|
|
67
|
-
"description": "Write Webpack Stats JSON to disk.",
|
|
68
|
-
"default": false
|
|
69
|
-
},
|
|
70
|
-
"debugWebpack": {
|
|
71
|
-
"type": "boolean",
|
|
72
|
-
"description": "Display final webpack configurations for debugging purposes."
|
|
73
|
-
},
|
|
74
|
-
"disableTelemetry": {
|
|
75
|
-
"type": "boolean",
|
|
76
|
-
"description": "Disables Storybook's telemetry."
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
"definitions": {
|
|
80
|
-
"extraEntryPoint": {
|
|
81
|
-
"oneOf": [
|
|
82
|
-
{
|
|
83
|
-
"type": "object",
|
|
84
|
-
"properties": {
|
|
85
|
-
"input": {
|
|
86
|
-
"type": "string",
|
|
87
|
-
"description": "The file to include.",
|
|
88
|
-
"x-completion-type": "file"
|
|
89
|
-
},
|
|
90
|
-
"bundleName": {
|
|
91
|
-
"type": "string",
|
|
92
|
-
"pattern": "^[\\w\\-.]*$",
|
|
93
|
-
"description": "The bundle name for this extra entry point."
|
|
94
|
-
},
|
|
95
|
-
"inject": {
|
|
96
|
-
"type": "boolean",
|
|
97
|
-
"description": "If the bundle will be referenced in the HTML file.",
|
|
98
|
-
"default": true
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
"additionalProperties": false,
|
|
102
|
-
"required": ["input"]
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
"type": "string",
|
|
106
|
-
"description": "The file to include."
|
|
107
|
-
}
|
|
108
|
-
]
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
"additionalProperties": true,
|
|
112
|
-
"required": ["configDir"],
|
|
113
|
-
"examplesFile": "../../../docs/build-storybook-executor-examples.md"
|
|
114
|
-
}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 2,
|
|
3
|
-
"continuous": true,
|
|
4
|
-
"outputCapture": "direct-nodejs",
|
|
5
|
-
"title": "Storybook Dev Builder",
|
|
6
|
-
"cli": "nx",
|
|
7
|
-
"description": "Serve up Storybook in development mode.",
|
|
8
|
-
"type": "object",
|
|
9
|
-
"x-deprecated": "The `@nx/storybook:storybook` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/storybook:convert-to-inferred` to migrate to the `@nx/storybook/plugin` inferred plugin. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.",
|
|
10
|
-
"presets": [
|
|
11
|
-
{
|
|
12
|
-
"name": "Default minimum setup",
|
|
13
|
-
"keys": ["port", "configDir"]
|
|
14
|
-
}
|
|
15
|
-
],
|
|
16
|
-
"properties": {
|
|
17
|
-
"port": {
|
|
18
|
-
"type": "number",
|
|
19
|
-
"description": "Port to listen on.",
|
|
20
|
-
"default": 9009
|
|
21
|
-
},
|
|
22
|
-
"previewUrl": {
|
|
23
|
-
"type": "string",
|
|
24
|
-
"description": "Preview URL."
|
|
25
|
-
},
|
|
26
|
-
"host": {
|
|
27
|
-
"type": "string",
|
|
28
|
-
"description": "Host to listen on."
|
|
29
|
-
},
|
|
30
|
-
"configDir": {
|
|
31
|
-
"type": "string",
|
|
32
|
-
"description": "Directory where to load Storybook configurations from.",
|
|
33
|
-
"x-completion-type": "directory",
|
|
34
|
-
"x-priority": "important"
|
|
35
|
-
},
|
|
36
|
-
"https": {
|
|
37
|
-
"type": "boolean",
|
|
38
|
-
"description": "Serve Storybook over HTTPS. Note: You must provide your own certificate information.",
|
|
39
|
-
"default": false
|
|
40
|
-
},
|
|
41
|
-
"open": {
|
|
42
|
-
"type": "boolean",
|
|
43
|
-
"description": "Open browser window automatically."
|
|
44
|
-
},
|
|
45
|
-
"ci": {
|
|
46
|
-
"type": "boolean",
|
|
47
|
-
"description": "CI mode (skip interactive prompts, don't open browser).",
|
|
48
|
-
"default": false
|
|
49
|
-
},
|
|
50
|
-
"loglevel": {
|
|
51
|
-
"type": "string",
|
|
52
|
-
"description": "Controls level of logging during build. Can be one of: [silly, verbose, info (default), warn, error, silent].",
|
|
53
|
-
"pattern": "(silly|verbose|info|warn|silent)"
|
|
54
|
-
},
|
|
55
|
-
"quiet": {
|
|
56
|
-
"type": "boolean",
|
|
57
|
-
"description": "Suppress verbose build output."
|
|
58
|
-
},
|
|
59
|
-
"docs": {
|
|
60
|
-
"type": "boolean",
|
|
61
|
-
"description": "Starts Storybook in documentation mode. Learn more about it : https://storybook.js.org/docs/react/writing-docs/build-documentation#preview-storybooks-documentation."
|
|
62
|
-
},
|
|
63
|
-
"docsMode": {
|
|
64
|
-
"type": "boolean",
|
|
65
|
-
"description": "Starts Storybook in documentation mode. Learn more about it : https://storybook.js.org/docs/react/writing-docs/build-documentation#preview-storybooks-documentation.",
|
|
66
|
-
"default": false
|
|
67
|
-
},
|
|
68
|
-
"uiFramework": {
|
|
69
|
-
"type": "string",
|
|
70
|
-
"description": "Storybook framework npm package.",
|
|
71
|
-
"enum": [
|
|
72
|
-
"@storybook/react",
|
|
73
|
-
"@storybook/html",
|
|
74
|
-
"@storybook/web-components",
|
|
75
|
-
"@storybook/vue",
|
|
76
|
-
"@storybook/vue3",
|
|
77
|
-
"@storybook/svelte"
|
|
78
|
-
],
|
|
79
|
-
"x-deprecated": "Upgrade to Storybook 7."
|
|
80
|
-
},
|
|
81
|
-
"webpackStatsJson": {
|
|
82
|
-
"type": ["boolean", "string"],
|
|
83
|
-
"description": "Write Webpack Stats JSON to disk.",
|
|
84
|
-
"default": false
|
|
85
|
-
},
|
|
86
|
-
"sslCa": {
|
|
87
|
-
"type": "string",
|
|
88
|
-
"description": "Provide an SSL certificate authority. (Optional with --https, required if using a self-signed certificate)."
|
|
89
|
-
},
|
|
90
|
-
"sslCert": {
|
|
91
|
-
"type": "string",
|
|
92
|
-
"description": "Provide an SSL certificate. (Required with --https)."
|
|
93
|
-
},
|
|
94
|
-
"sslKey": {
|
|
95
|
-
"type": "string",
|
|
96
|
-
"description": "Provide an SSL key. (Required with --https)."
|
|
97
|
-
},
|
|
98
|
-
"smokeTest": {
|
|
99
|
-
"type": "boolean",
|
|
100
|
-
"description": "Exit after successful start."
|
|
101
|
-
},
|
|
102
|
-
"noOpen": {
|
|
103
|
-
"type": "boolean",
|
|
104
|
-
"description": "Do not open Storybook automatically in the browser."
|
|
105
|
-
},
|
|
106
|
-
"debugWebpack": {
|
|
107
|
-
"type": "boolean",
|
|
108
|
-
"description": "Display final webpack configurations for debugging purposes."
|
|
109
|
-
},
|
|
110
|
-
"disableTelemetry": {
|
|
111
|
-
"type": "boolean",
|
|
112
|
-
"description": "Disables Storybook's telemetry."
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
"additionalProperties": true,
|
|
116
|
-
"definitions": {},
|
|
117
|
-
"required": ["configDir"],
|
|
118
|
-
"examplesFile": "../../../docs/storybook-executor-examples.md"
|
|
119
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ExecutorContext } from '@nx/devkit';
|
|
2
|
-
import type { CLIOptions } from 'storybook/internal/types';
|
|
3
|
-
export default function storybookExecutor(options: CLIOptions, context: ExecutorContext): AsyncGenerator<{
|
|
4
|
-
success: boolean;
|
|
5
|
-
info?: {
|
|
6
|
-
port: number;
|
|
7
|
-
baseUrl?: string;
|
|
8
|
-
};
|
|
9
|
-
}>;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = storybookExecutor;
|
|
4
|
-
const utilities_1 = require("../../utils/utilities");
|
|
5
|
-
const semver_1 = require("semver");
|
|
6
|
-
const deprecation_1 = require("../../utils/deprecation");
|
|
7
|
-
async function* storybookExecutor(options, context) {
|
|
8
|
-
(0, deprecation_1.warnStorybookExecutorDeprecation)();
|
|
9
|
-
(0, utilities_1.storybookConfigExistsCheck)(options.configDir, context.projectName);
|
|
10
|
-
const buildOptions = options;
|
|
11
|
-
const result = await runInstance(buildOptions);
|
|
12
|
-
yield {
|
|
13
|
-
success: true,
|
|
14
|
-
info: {
|
|
15
|
-
port: result?.['port'],
|
|
16
|
-
baseUrl: `${options.https ? 'https' : 'http'}://${options.host ?? 'localhost'}:${result?.['port']}`,
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
await new Promise(() => { });
|
|
20
|
-
}
|
|
21
|
-
async function runInstance(options) {
|
|
22
|
-
const installedStorybookVersion = (0, utilities_1.getInstalledStorybookVersion)();
|
|
23
|
-
const hasCoreServerInStorybookPackage = (0, semver_1.gte)(installedStorybookVersion, '8.2.0');
|
|
24
|
-
const storybookCore = await (hasCoreServerInStorybookPackage
|
|
25
|
-
? import('storybook/internal/core-server')
|
|
26
|
-
: // This is needed for backwards compatibility - but we do not have the package installed in the nx repo
|
|
27
|
-
// @ts-ignore
|
|
28
|
-
import('@storybook/core-server'));
|
|
29
|
-
const env = process.env.NODE_ENV ?? 'development';
|
|
30
|
-
process.env.NODE_ENV = env;
|
|
31
|
-
return storybookCore.build({
|
|
32
|
-
...options,
|
|
33
|
-
mode: 'dev',
|
|
34
|
-
});
|
|
35
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare const STORYBOOK_EXECUTOR_DEPRECATION_MESSAGE = "The `@nx/storybook:storybook` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/storybook:convert-to-inferred` to migrate to the `@nx/storybook/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.";
|
|
2
|
-
export declare const STORYBOOK_BUILD_EXECUTOR_DEPRECATION_MESSAGE = "The `@nx/storybook:build` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/storybook:convert-to-inferred` to migrate to the `@nx/storybook/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.";
|
|
3
|
-
export declare function warnStorybookExecutorDeprecation(): void;
|
|
4
|
-
export declare function warnStorybookBuildExecutorDeprecation(): void;
|
|
5
|
-
export declare function warnStorybookExecutorGenerating(): void;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.STORYBOOK_BUILD_EXECUTOR_DEPRECATION_MESSAGE = exports.STORYBOOK_EXECUTOR_DEPRECATION_MESSAGE = void 0;
|
|
4
|
-
exports.warnStorybookExecutorDeprecation = warnStorybookExecutorDeprecation;
|
|
5
|
-
exports.warnStorybookBuildExecutorDeprecation = warnStorybookBuildExecutorDeprecation;
|
|
6
|
-
exports.warnStorybookExecutorGenerating = warnStorybookExecutorGenerating;
|
|
7
|
-
const devkit_1 = require("@nx/devkit");
|
|
8
|
-
// TODO(v24): Remove the @nx/storybook:storybook and @nx/storybook:build
|
|
9
|
-
// executors. The inferred plugin (@nx/storybook/plugin) and the
|
|
10
|
-
// convert-to-inferred generator stay supported.
|
|
11
|
-
exports.STORYBOOK_EXECUTOR_DEPRECATION_MESSAGE = 'The `@nx/storybook:storybook` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/storybook:convert-to-inferred` to migrate to the `@nx/storybook/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.';
|
|
12
|
-
exports.STORYBOOK_BUILD_EXECUTOR_DEPRECATION_MESSAGE = 'The `@nx/storybook:build` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/storybook:convert-to-inferred` to migrate to the `@nx/storybook/plugin` inferred targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.';
|
|
13
|
-
function warnStorybookExecutorDeprecation() {
|
|
14
|
-
devkit_1.logger.warn(exports.STORYBOOK_EXECUTOR_DEPRECATION_MESSAGE);
|
|
15
|
-
}
|
|
16
|
-
function warnStorybookBuildExecutorDeprecation() {
|
|
17
|
-
devkit_1.logger.warn(exports.STORYBOOK_BUILD_EXECUTOR_DEPRECATION_MESSAGE);
|
|
18
|
-
}
|
|
19
|
-
function warnStorybookExecutorGenerating() {
|
|
20
|
-
devkit_1.logger.warn('Generating targets that use the deprecated `@nx/storybook:storybook` and `@nx/storybook:build` executors. These executors will be removed in Nx v24. Run `nx g @nx/storybook:convert-to-inferred` next to migrate these targets to the `@nx/storybook/plugin` inferred plugin and prevent future generators from emitting executor targets. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.');
|
|
21
|
-
}
|