@nx/storybook 23.1.0 → 23.1.2
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 +2 -2
- package/dist/src/generators/configuration/lib/util-functions.d.ts +2 -2
- package/dist/src/generators/configuration/lib/util-functions.js +6 -4
- package/dist/src/generators/migrate-10/migrate-10.js +1 -2
- package/dist/src/generators/migrate-8/helper-functions.js +2 -2
- package/dist/src/generators/migrate-8/migrate-8.js +1 -2
- package/dist/src/generators/migrate-9/helper-functions.js +2 -2
- package/dist/src/generators/migrate-9/migrate-9.js +1 -2
- package/dist/src/migrations/update-21-1-0/update-sb-9.js +2 -2
- package/dist/src/migrations/update-22-1-0/migrate-to-storybook-10.js +2 -2
- package/dist/src/plugins/plugin.js +2 -4
- package/package.json +7 -7
|
@@ -76,9 +76,9 @@ async function configurationGeneratorInternal(tree, rawSchema) {
|
|
|
76
76
|
(0, util_functions_1.configureTsSolutionConfig)(tree, schema);
|
|
77
77
|
(0, util_functions_1.updateLintConfig)(tree, schema);
|
|
78
78
|
(0, util_functions_1.addBuildStorybookToCacheableOperations)(tree);
|
|
79
|
-
(0, util_functions_1.addStorybookToNamedInputs)(tree);
|
|
79
|
+
(0, util_functions_1.addStorybookToNamedInputs)(tree, schema);
|
|
80
80
|
if (!hasPlugin) {
|
|
81
|
-
(0, util_functions_1.addStorybookToTargetDefaults)(tree);
|
|
81
|
+
(0, util_functions_1.addStorybookToTargetDefaults)(tree, schema);
|
|
82
82
|
}
|
|
83
83
|
let devDeps = {};
|
|
84
84
|
if (!hasPlugin || schema.addExplicitTargets) {
|
|
@@ -17,8 +17,8 @@ export declare function configureTsSolutionConfig(tree: Tree, schema: StorybookC
|
|
|
17
17
|
*/
|
|
18
18
|
export declare function updateLintConfig(tree: Tree, schema: StorybookConfigureSchema): void;
|
|
19
19
|
export declare function normalizeSchema(schema: StorybookConfigureSchema): StorybookConfigureSchema;
|
|
20
|
-
export declare function addStorybookToNamedInputs(tree: Tree): void;
|
|
21
|
-
export declare function addStorybookToTargetDefaults(tree: Tree, setCache?: boolean): void;
|
|
20
|
+
export declare function addStorybookToNamedInputs(tree: Tree, schema: StorybookConfigureSchema): void;
|
|
21
|
+
export declare function addStorybookToTargetDefaults(tree: Tree, schema: StorybookConfigureSchema, setCache?: boolean): void;
|
|
22
22
|
export declare function createProjectStorybookDir(tree: Tree, projectName: string, uiFramework: UiFramework, js: boolean, tsConfiguration: boolean, root: string, projectType: string, projectIsRootProjectInStandaloneWorkspace: boolean, interactionTests: boolean, mainDir?: string, isNextJs?: boolean, usesSwc?: boolean, usesVite?: boolean, viteConfigFilePath?: string, hasPlugin?: boolean, viteConfigFileName?: string, usesReactNative?: boolean): void;
|
|
23
23
|
export declare function getTsConfigPath(tree: Tree, projectName: string, path?: string): string;
|
|
24
24
|
export declare function addBuildStorybookToCacheableOperations(tree: Tree): void;
|
|
@@ -353,7 +353,7 @@ function normalizeSchema(schema) {
|
|
|
353
353
|
...schema,
|
|
354
354
|
};
|
|
355
355
|
}
|
|
356
|
-
function addStorybookToNamedInputs(tree) {
|
|
356
|
+
function addStorybookToNamedInputs(tree, schema) {
|
|
357
357
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
358
358
|
if (nxJson.namedInputs) {
|
|
359
359
|
const hasProductionFileset = !!nxJson.namedInputs?.production;
|
|
@@ -364,14 +364,15 @@ function addStorybookToNamedInputs(tree) {
|
|
|
364
364
|
if (!nxJson.namedInputs.production.includes('!{projectRoot}/.storybook/**/*')) {
|
|
365
365
|
nxJson.namedInputs.production.push('!{projectRoot}/.storybook/**/*');
|
|
366
366
|
}
|
|
367
|
-
if (
|
|
367
|
+
if (schema.uiFramework !== '@storybook/angular' &&
|
|
368
|
+
!nxJson.namedInputs.production.includes('!{projectRoot}/tsconfig.storybook.json')) {
|
|
368
369
|
nxJson.namedInputs.production.push('!{projectRoot}/tsconfig.storybook.json');
|
|
369
370
|
}
|
|
370
371
|
}
|
|
371
372
|
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
372
373
|
}
|
|
373
374
|
}
|
|
374
|
-
function addStorybookToTargetDefaults(tree, setCache = true) {
|
|
375
|
+
function addStorybookToTargetDefaults(tree, schema, setCache = true) {
|
|
375
376
|
const nxJson = (0, devkit_1.readNxJson)(tree) ?? {};
|
|
376
377
|
const existing = (0, internal_2.findTargetDefault)(nxJson.targetDefaults, {
|
|
377
378
|
target: 'build-storybook',
|
|
@@ -391,7 +392,8 @@ function addStorybookToTargetDefaults(tree, setCache = true) {
|
|
|
391
392
|
const negatedIndex = inputs.indexOf('!{projectRoot}/.storybook/**/*');
|
|
392
393
|
if (negatedIndex !== -1)
|
|
393
394
|
inputs.splice(negatedIndex, 1);
|
|
394
|
-
if (
|
|
395
|
+
if (schema.uiFramework !== '@storybook/angular' &&
|
|
396
|
+
!inputs.includes('{projectRoot}/tsconfig.storybook.json')) {
|
|
395
397
|
inputs.push('{projectRoot}/tsconfig.storybook.json');
|
|
396
398
|
}
|
|
397
399
|
(0, internal_2.upsertTargetDefault)(tree, nxJson, {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.migrate10Generator = migrate10Generator;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const output_1 = require("nx/src/utils/output");
|
|
6
5
|
const calling_storybook_cli_1 = require("./calling-storybook-cli");
|
|
7
6
|
const path_1 = require("path");
|
|
8
7
|
const fs_1 = require("fs");
|
|
@@ -11,7 +10,7 @@ async function migrate10Generator(tree, schema) {
|
|
|
11
10
|
(0, assert_supported_storybook_version_1.assertSupportedStorybookVersion)(tree);
|
|
12
11
|
const packageJson = (0, devkit_1.readJson)(tree, 'package.json');
|
|
13
12
|
if (!(0, calling_storybook_cli_1.checkStorybookInstalled)(packageJson)) {
|
|
14
|
-
|
|
13
|
+
devkit_1.output.error({
|
|
15
14
|
title: 'No Storybook packages installed',
|
|
16
15
|
bodyLines: [
|
|
17
16
|
`🚨 Nx did not find any Storybook packages installed in your workspace.`,
|
|
@@ -6,9 +6,9 @@ exports.handleMigrationResult = handleMigrationResult;
|
|
|
6
6
|
exports.checkStorybookInstalled = checkStorybookInstalled;
|
|
7
7
|
exports.logResult = logResult;
|
|
8
8
|
const devkit_1 = require("@nx/devkit");
|
|
9
|
-
const fileutils_1 = require("nx/src/utils/fileutils");
|
|
10
9
|
const fs_1 = require("fs");
|
|
11
10
|
const path_1 = require("path");
|
|
11
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
12
12
|
function onlyShowGuide(storybookProjects) {
|
|
13
13
|
const packageManager = (0, devkit_1.detectPackageManager)();
|
|
14
14
|
const pm = (0, devkit_1.getPackageManagerCommand)(packageManager);
|
|
@@ -65,7 +65,7 @@ function getAllStorybookInfo(tree) {
|
|
|
65
65
|
return allStorybookDirs;
|
|
66
66
|
}
|
|
67
67
|
function handleMigrationResult(migrateResult, allStorybookProjects) {
|
|
68
|
-
if ((0,
|
|
68
|
+
if ((0, internal_1.fileExists)((0, path_1.join)(devkit_1.workspaceRoot, 'migration-storybook.log')) &&
|
|
69
69
|
Object.keys(migrateResult.successfulProjects)?.length) {
|
|
70
70
|
const sbLogFile = (0, fs_1.readFileSync)((0, path_1.join)(devkit_1.workspaceRoot, 'migration-storybook.log'), 'utf-8');
|
|
71
71
|
Object.keys(migrateResult.successfulProjects).forEach((projectName) => {
|
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.migrate8Generator = migrate8Generator;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const output_1 = require("nx/src/utils/output");
|
|
6
5
|
const calling_storybook_cli_1 = require("./calling-storybook-cli");
|
|
7
6
|
const helper_functions_1 = require("./helper-functions");
|
|
8
7
|
async function migrate8Generator(tree, schema) {
|
|
9
8
|
const packageJson = (0, devkit_1.readJson)(tree, 'package.json');
|
|
10
9
|
if (!(0, helper_functions_1.checkStorybookInstalled)(packageJson)) {
|
|
11
|
-
|
|
10
|
+
devkit_1.output.error({
|
|
12
11
|
title: 'No Storybook packages installed',
|
|
13
12
|
bodyLines: [
|
|
14
13
|
`🚨 Nx did not find any Storybook packages installed in your workspace.`,
|
|
@@ -6,9 +6,9 @@ exports.handleMigrationResult = handleMigrationResult;
|
|
|
6
6
|
exports.checkStorybookInstalled = checkStorybookInstalled;
|
|
7
7
|
exports.logResult = logResult;
|
|
8
8
|
const devkit_1 = require("@nx/devkit");
|
|
9
|
-
const fileutils_1 = require("nx/src/utils/fileutils");
|
|
10
9
|
const fs_1 = require("fs");
|
|
11
10
|
const path_1 = require("path");
|
|
11
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
12
12
|
function onlyShowGuide(storybookProjects) {
|
|
13
13
|
const packageManager = (0, devkit_1.detectPackageManager)();
|
|
14
14
|
const pm = (0, devkit_1.getPackageManagerCommand)(packageManager);
|
|
@@ -66,7 +66,7 @@ function getAllStorybookInfo(tree) {
|
|
|
66
66
|
return allStorybookDirs;
|
|
67
67
|
}
|
|
68
68
|
function handleMigrationResult(migrateResult, allStorybookProjects) {
|
|
69
|
-
if ((0,
|
|
69
|
+
if ((0, internal_1.fileExists)((0, path_1.join)(devkit_1.workspaceRoot, 'migration-storybook.log')) &&
|
|
70
70
|
Object.keys(migrateResult.successfulProjects)?.length) {
|
|
71
71
|
const sbLogFile = (0, fs_1.readFileSync)((0, path_1.join)(devkit_1.workspaceRoot, 'migration-storybook.log'), 'utf-8');
|
|
72
72
|
Object.keys(migrateResult.successfulProjects).forEach((projectName) => {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.migrate9Generator = migrate9Generator;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const output_1 = require("nx/src/utils/output");
|
|
6
5
|
const calling_storybook_cli_1 = require("./calling-storybook-cli");
|
|
7
6
|
const helper_functions_1 = require("./helper-functions");
|
|
8
7
|
const assert_supported_storybook_version_1 = require("../../utils/assert-supported-storybook-version");
|
|
@@ -11,7 +10,7 @@ async function migrate9Generator(tree, schema) {
|
|
|
11
10
|
schema.versionTag = schema.versionTag ?? 'latest';
|
|
12
11
|
const packageJson = (0, devkit_1.readJson)(tree, 'package.json');
|
|
13
12
|
if (!(0, helper_functions_1.checkStorybookInstalled)(packageJson)) {
|
|
14
|
-
|
|
13
|
+
devkit_1.output.error({
|
|
15
14
|
title: 'No Storybook packages installed',
|
|
16
15
|
bodyLines: [
|
|
17
16
|
`🚨 Nx did not find any Storybook packages installed in your workspace.`,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = changeStorybookTargets;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const migrate_9_1 = tslib_1.__importDefault(require("../../generators/migrate-9/migrate-9"));
|
|
7
7
|
const utilities_1 = require("../../utils/utilities");
|
|
8
8
|
async function changeStorybookTargets(tree) {
|
|
@@ -18,7 +18,7 @@ async function changeStorybookTargets(tree) {
|
|
|
18
18
|
*/
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
devkit_1.output.log({
|
|
22
22
|
title: 'Migrating Storybook to v9',
|
|
23
23
|
bodyLines: [
|
|
24
24
|
`🚀 This migration will update your Storybook configuration to v9.`,
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = migrateToStorybook10;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const migrate_10_1 = tslib_1.__importDefault(require("../../generators/migrate-10/migrate-10"));
|
|
7
7
|
async function migrateToStorybook10(tree) {
|
|
8
|
-
|
|
8
|
+
devkit_1.output.log({
|
|
9
9
|
title: 'Migrating Storybook to v10',
|
|
10
10
|
bodyLines: [
|
|
11
11
|
`🚀 This migration will update your Storybook configuration to v10.`,
|
|
@@ -5,9 +5,7 @@ const internal_1 = require("@nx/devkit/internal");
|
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
|
-
const cache_directory_1 = require("nx/src/utils/cache-directory");
|
|
9
8
|
const js_1 = require("@nx/js");
|
|
10
|
-
const file_hasher_1 = require("nx/src/hasher/file-hasher");
|
|
11
9
|
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
12
10
|
const internal_2 = require("@nx/js/internal");
|
|
13
11
|
/**
|
|
@@ -22,8 +20,8 @@ exports.createNodes = [
|
|
|
22
20
|
storybookConfigGlob,
|
|
23
21
|
async (configFilePaths, options, context) => {
|
|
24
22
|
const normalizedOptions = normalizeOptions(options);
|
|
25
|
-
const optionsHash = (0,
|
|
26
|
-
const cachePath = (0, path_1.join)(
|
|
23
|
+
const optionsHash = (0, internal_1.hashObject)(normalizedOptions);
|
|
24
|
+
const cachePath = (0, path_1.join)(internal_1.workspaceDataDirectory, `storybook-${optionsHash}.hash`);
|
|
27
25
|
const targetsCache = new internal_1.PluginCache(cachePath);
|
|
28
26
|
const packageManager = (0, devkit_1.detectPackageManager)(context.workspaceRoot);
|
|
29
27
|
const pmc = (0, devkit_1.getPackageManagerCommand)(packageManager);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/storybook",
|
|
3
|
-
"version": "23.1.
|
|
3
|
+
"version": "23.1.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"files": [
|
|
@@ -92,18 +92,18 @@
|
|
|
92
92
|
"@phenomnomnominal/tsquery": "~6.2.0",
|
|
93
93
|
"semver": "^7.6.3",
|
|
94
94
|
"tslib": "^2.3.0",
|
|
95
|
-
"@nx/devkit": "23.1.
|
|
96
|
-
"@nx/cypress": "23.1.
|
|
97
|
-
"@nx/
|
|
98
|
-
"@nx/
|
|
95
|
+
"@nx/devkit": "23.1.2",
|
|
96
|
+
"@nx/cypress": "23.1.2",
|
|
97
|
+
"@nx/js": "23.1.2",
|
|
98
|
+
"@nx/eslint": "23.1.2"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
101
|
"storybook": "9.0.6",
|
|
102
|
-
"nx": "23.1.
|
|
102
|
+
"nx": "23.1.2"
|
|
103
103
|
},
|
|
104
104
|
"peerDependencies": {
|
|
105
105
|
"storybook": ">=8.0.0 <11.0.0",
|
|
106
|
-
"@nx/web": "23.1.
|
|
106
|
+
"@nx/web": "23.1.2"
|
|
107
107
|
},
|
|
108
108
|
"peerDependenciesMeta": {
|
|
109
109
|
"@nx/web": {
|