@nx/storybook 18.2.0-beta.1 → 18.2.0-beta.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/migrations.json +9 -0
- package/package.json +6 -6
- package/src/generators/configuration/configuration.js +1 -1
- package/src/generators/configuration/lib/util-functions.d.ts +2 -2
- package/src/generators/configuration/lib/util-functions.js +13 -21
- package/src/migrations/update-16-5-0/move-storybook-tsconfig.js +1 -1
package/migrations.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/storybook",
|
|
3
|
-
"version": "18.2.0-beta.
|
|
3
|
+
"version": "18.2.0-beta.2",
|
|
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": {
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
"migrations": "./migrations.json"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@nx/devkit": "18.2.0-beta.
|
|
33
|
+
"@nx/devkit": "18.2.0-beta.2",
|
|
34
34
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
35
35
|
"semver": "^7.5.3",
|
|
36
36
|
"tslib": "^2.3.0",
|
|
37
|
-
"@nx/cypress": "18.2.0-beta.
|
|
38
|
-
"@nx/js": "18.2.0-beta.
|
|
39
|
-
"@nx/eslint": "18.2.0-beta.
|
|
40
|
-
"@nrwl/storybook": "18.2.0-beta.
|
|
37
|
+
"@nx/cypress": "18.2.0-beta.2",
|
|
38
|
+
"@nx/js": "18.2.0-beta.2",
|
|
39
|
+
"@nx/eslint": "18.2.0-beta.2",
|
|
40
|
+
"@nrwl/storybook": "18.2.0-beta.2"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
@@ -87,7 +87,7 @@ async function configurationGeneratorInternal(tree, rawSchema) {
|
|
|
87
87
|
(0, util_functions_1.addStorybookTarget)(tree, schema.project, schema.uiFramework, schema.interactionTests);
|
|
88
88
|
}
|
|
89
89
|
if (schema.configureStaticServe) {
|
|
90
|
-
(0, util_functions_1.addStaticTarget)(tree, schema);
|
|
90
|
+
await (0, util_functions_1.addStaticTarget)(tree, schema);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
else {
|
|
@@ -3,7 +3,7 @@ import { StorybookConfigureSchema } from '../schema';
|
|
|
3
3
|
import { UiFramework } from '../../../utils/models';
|
|
4
4
|
export declare function addStorybookTarget(tree: Tree, projectName: string, uiFramework: UiFramework, interactionTests: boolean): void;
|
|
5
5
|
export declare function addAngularStorybookTarget(tree: Tree, projectName: string, interactionTests: boolean): void;
|
|
6
|
-
export declare function addStaticTarget(tree: Tree, opts: StorybookConfigureSchema): void
|
|
6
|
+
export declare function addStaticTarget(tree: Tree, opts: StorybookConfigureSchema): Promise<void>;
|
|
7
7
|
export declare function createStorybookTsconfigFile(tree: Tree, projectRoot: string, uiFramework: UiFramework, isRootProject: boolean, mainDir: 'components' | 'src'): void;
|
|
8
8
|
export declare function editTsconfigBaseJson(tree: Tree): void;
|
|
9
9
|
export declare function configureTsProjectConfig(tree: Tree, schema: StorybookConfigureSchema): void;
|
|
@@ -18,7 +18,7 @@ export declare function configureTsSolutionConfig(tree: Tree, schema: StorybookC
|
|
|
18
18
|
export declare function updateLintConfig(tree: Tree, schema: StorybookConfigureSchema): void;
|
|
19
19
|
export declare function normalizeSchema(schema: StorybookConfigureSchema): StorybookConfigureSchema;
|
|
20
20
|
export declare function addStorybookToNamedInputs(tree: Tree): void;
|
|
21
|
-
export declare function addStorybookToTargetDefaults(tree: Tree): void;
|
|
21
|
+
export declare function addStorybookToTargetDefaults(tree: Tree, 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, useReactNative?: boolean): void;
|
|
23
23
|
export declare function getTsConfigPath(tree: Tree, projectName: string, path?: string): string;
|
|
24
24
|
export declare function addBuildStorybookToCacheableOperations(tree: Tree): void;
|
|
@@ -91,9 +91,9 @@ function addAngularStorybookTarget(tree, projectName, interactionTests) {
|
|
|
91
91
|
(0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfig);
|
|
92
92
|
}
|
|
93
93
|
exports.addAngularStorybookTarget = addAngularStorybookTarget;
|
|
94
|
-
function addStaticTarget(tree, opts) {
|
|
95
|
-
const
|
|
96
|
-
|
|
94
|
+
async function addStaticTarget(tree, opts) {
|
|
95
|
+
const { webStaticServeGenerator } = (0, devkit_1.ensurePackage)('@nx/web', versions_1.nxVersion);
|
|
96
|
+
await webStaticServeGenerator(tree, {
|
|
97
97
|
buildTarget: `${opts.project}:build-storybook`,
|
|
98
98
|
outputPath: (0, devkit_1.joinPathFragments)('dist/storybook', opts.project),
|
|
99
99
|
targetName: 'static-storybook',
|
|
@@ -339,10 +339,13 @@ function addStorybookToNamedInputs(tree) {
|
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
341
|
exports.addStorybookToNamedInputs = addStorybookToNamedInputs;
|
|
342
|
-
function addStorybookToTargetDefaults(tree) {
|
|
342
|
+
function addStorybookToTargetDefaults(tree, setCache = true) {
|
|
343
343
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
344
344
|
nxJson.targetDefaults ??= {};
|
|
345
345
|
nxJson.targetDefaults['build-storybook'] ??= {};
|
|
346
|
+
if (setCache) {
|
|
347
|
+
nxJson.targetDefaults['build-storybook'].cache ??= true;
|
|
348
|
+
}
|
|
346
349
|
nxJson.targetDefaults['build-storybook'].inputs ??= [
|
|
347
350
|
'default',
|
|
348
351
|
nxJson.namedInputs && 'production' in nxJson.namedInputs
|
|
@@ -423,23 +426,12 @@ function getTsConfigPath(tree, projectName, path) {
|
|
|
423
426
|
}
|
|
424
427
|
exports.getTsConfigPath = getTsConfigPath;
|
|
425
428
|
function addBuildStorybookToCacheableOperations(tree) {
|
|
426
|
-
(0, devkit_1.
|
|
427
|
-
|
|
428
|
-
tasksRunnerOptions
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
options: {
|
|
433
|
-
...(json.tasksRunnerOptions?.default?.options ?? {}),
|
|
434
|
-
cacheableOperations: Array.from(new Set([
|
|
435
|
-
...(json.tasksRunnerOptions?.default?.options
|
|
436
|
-
?.cacheableOperations ?? []),
|
|
437
|
-
'build-storybook',
|
|
438
|
-
])),
|
|
439
|
-
},
|
|
440
|
-
},
|
|
441
|
-
},
|
|
442
|
-
}));
|
|
429
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
430
|
+
if (nxJson.tasksRunnerOptions?.default?.options?.cacheableOperations &&
|
|
431
|
+
!nxJson.tasksRunnerOptions.default.options.cacheableOperations.includes('build-storybook')) {
|
|
432
|
+
nxJson.tasksRunnerOptions.default.options.cacheableOperations.push('build-storybook');
|
|
433
|
+
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
434
|
+
}
|
|
443
435
|
}
|
|
444
436
|
exports.addBuildStorybookToCacheableOperations = addBuildStorybookToCacheableOperations;
|
|
445
437
|
function projectIsRootProjectInStandaloneWorkspace(projectRoot) {
|
|
@@ -14,7 +14,7 @@ async function default_1(tree) {
|
|
|
14
14
|
(0, util_functions_1.renameAndMoveOldTsConfig)(projectRoot, pathToStorybookConfigFile, tree);
|
|
15
15
|
});
|
|
16
16
|
(0, util_functions_1.addStorybookToNamedInputs)(tree);
|
|
17
|
-
(0, util_functions_1.addStorybookToTargetDefaults)(tree);
|
|
17
|
+
(0, util_functions_1.addStorybookToTargetDefaults)(tree, false);
|
|
18
18
|
await (0, devkit_1.formatFiles)(tree);
|
|
19
19
|
}
|
|
20
20
|
exports.default = default_1;
|