@nx/storybook 23.0.0-beta.11 → 23.0.0-beta.13
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 +7 -7
- package/src/generators/configuration/configuration.js +2 -2
- package/src/generators/configuration/lib/util-functions.d.ts.map +1 -1
- package/src/generators/configuration/lib/util-functions.js +35 -30
- package/src/generators/init/init.d.ts.map +1 -1
- package/src/generators/init/init.js +2 -4
- package/src/plugins/plugin.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/storybook",
|
|
3
|
-
"version": "23.0.0-beta.
|
|
3
|
+
"version": "23.0.0-beta.13",
|
|
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": {
|
|
@@ -34,20 +34,20 @@
|
|
|
34
34
|
"migrations": "./migrations.json"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@nx/devkit": "23.0.0-beta.
|
|
37
|
+
"@nx/devkit": "23.0.0-beta.13",
|
|
38
38
|
"@phenomnomnominal/tsquery": "~6.2.0",
|
|
39
39
|
"semver": "^7.6.3",
|
|
40
40
|
"tslib": "^2.3.0",
|
|
41
|
-
"@nx/cypress": "23.0.0-beta.
|
|
42
|
-
"@nx/js": "23.0.0-beta.
|
|
43
|
-
"@nx/eslint": "23.0.0-beta.
|
|
41
|
+
"@nx/cypress": "23.0.0-beta.13",
|
|
42
|
+
"@nx/js": "23.0.0-beta.13",
|
|
43
|
+
"@nx/eslint": "23.0.0-beta.13"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"nx": "23.0.0-beta.
|
|
46
|
+
"nx": "23.0.0-beta.13",
|
|
47
47
|
"storybook": "9.0.6"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@nx/web": "23.0.0-beta.
|
|
50
|
+
"@nx/web": "23.0.0-beta.13",
|
|
51
51
|
"storybook": ">=7.0.0 <11.0.0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependenciesMeta": {
|
|
@@ -11,7 +11,7 @@ const utilities_1 = require("../../utils/utilities");
|
|
|
11
11
|
const versions_1 = require("../../utils/versions");
|
|
12
12
|
const ensure_dependencies_1 = require("./lib/ensure-dependencies");
|
|
13
13
|
const edit_root_tsconfig_1 = require("./lib/edit-root-tsconfig");
|
|
14
|
-
const
|
|
14
|
+
const internal_1 = require("@nx/js/internal");
|
|
15
15
|
function configurationGenerator(tree, schema) {
|
|
16
16
|
return configurationGeneratorInternal(tree, { addPlugin: false, ...schema });
|
|
17
17
|
}
|
|
@@ -63,7 +63,7 @@ async function configurationGeneratorInternal(tree, rawSchema) {
|
|
|
63
63
|
? p === '@nx/storybook/plugin'
|
|
64
64
|
: p.plugin === '@nx/storybook/plugin');
|
|
65
65
|
const mainDir = !!nextConfigFilePath &&
|
|
66
|
-
(0,
|
|
66
|
+
(0, internal_1.getProjectType)(tree, root, projectType) === 'application'
|
|
67
67
|
? 'components'
|
|
68
68
|
: 'src';
|
|
69
69
|
const usesVite = !!viteConfigFilePath || schema.uiFramework?.endsWith('-vite');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util-functions.d.ts","sourceRoot":"","sources":["../../../../../../../packages/storybook/src/generators/configuration/lib/util-functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAWL,IAAI,EAML,MAAM,YAAY,CAAC;AASpB,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"util-functions.d.ts","sourceRoot":"","sources":["../../../../../../../packages/storybook/src/generators/configuration/lib/util-functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAWL,IAAI,EAML,MAAM,YAAY,CAAC;AASpB,OA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1 = require("../../../utils/versions");
|
|
28
28
|
const eslint_file_1 = require("@nx/eslint/src/generators/utils/eslint-file");
|
|
29
29
|
const flat_config_1 = require("@nx/eslint/src/utils/flat-config");
|
|
30
|
-
const
|
|
30
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
31
|
+
const internal_2 = require("@nx/js/internal");
|
|
31
32
|
const DEFAULT_PORT = 4400;
|
|
32
33
|
function addStorybookTarget(tree, projectName, uiFramework, interactionTests) {
|
|
33
34
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
@@ -126,7 +127,7 @@ async function addStaticTarget(tree, opts) {
|
|
|
126
127
|
function createStorybookTsconfigFile(tree, projectRoot, uiFramework, isRootProject, mainDir) {
|
|
127
128
|
const storybookMajorVersion = (0, utilities_1.storybookMajorVersion)(tree);
|
|
128
129
|
const offset = (0, devkit_1.offsetFromRoot)(projectRoot);
|
|
129
|
-
const useTsSolution = (0,
|
|
130
|
+
const useTsSolution = (0, internal_2.isUsingTsSolutionSetup)(tree);
|
|
130
131
|
// First let's check if old configuration file exists
|
|
131
132
|
// If it exists, let's rename it and move it to the new location
|
|
132
133
|
const oldStorybookTsConfigPath = (0, devkit_1.joinPathFragments)(projectRoot, '.storybook/tsconfig.json');
|
|
@@ -175,7 +176,7 @@ function createStorybookTsconfigFile(tree, projectRoot, uiFramework, isRootProje
|
|
|
175
176
|
],
|
|
176
177
|
};
|
|
177
178
|
if (useTsSolution) {
|
|
178
|
-
const runtimeConfig = (0,
|
|
179
|
+
const runtimeConfig = (0, internal_2.findRuntimeTsConfigName)(projectRoot, tree);
|
|
179
180
|
if (runtimeConfig) {
|
|
180
181
|
storybookTsConfig.references ??= [];
|
|
181
182
|
storybookTsConfig.references.push({
|
|
@@ -372,34 +373,38 @@ function addStorybookToNamedInputs(tree) {
|
|
|
372
373
|
}
|
|
373
374
|
}
|
|
374
375
|
function addStorybookToTargetDefaults(tree, setCache = true) {
|
|
375
|
-
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
376
|
-
nxJson.targetDefaults
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
//
|
|
392
|
-
const
|
|
393
|
-
if (
|
|
394
|
-
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
376
|
+
const nxJson = (0, devkit_1.readNxJson)(tree) ?? {};
|
|
377
|
+
const existing = (0, internal_1.normalizeTargetDefaults)(nxJson.targetDefaults).find((e) => e.target === 'build-storybook' &&
|
|
378
|
+
e.executor === undefined &&
|
|
379
|
+
e.projects === undefined &&
|
|
380
|
+
e.plugin === undefined);
|
|
381
|
+
const inputs = existing?.inputs
|
|
382
|
+
? [...existing.inputs]
|
|
383
|
+
: [
|
|
384
|
+
'default',
|
|
385
|
+
nxJson.namedInputs && 'production' in nxJson.namedInputs
|
|
386
|
+
? '^production'
|
|
387
|
+
: '^default',
|
|
388
|
+
];
|
|
389
|
+
if (!inputs.includes('{projectRoot}/.storybook/**/*')) {
|
|
390
|
+
inputs.push('{projectRoot}/.storybook/**/*');
|
|
391
|
+
}
|
|
392
|
+
// Drop the negation glob so Storybook rebuilds when .storybook changes.
|
|
393
|
+
const negatedIndex = inputs.indexOf('!{projectRoot}/.storybook/**/*');
|
|
394
|
+
if (negatedIndex !== -1)
|
|
395
|
+
inputs.splice(negatedIndex, 1);
|
|
396
|
+
if (!inputs.includes('{projectRoot}/tsconfig.storybook.json')) {
|
|
397
|
+
inputs.push('{projectRoot}/tsconfig.storybook.json');
|
|
398
|
+
}
|
|
399
|
+
(0, internal_1.upsertTargetDefault)(tree, nxJson, {
|
|
400
|
+
target: 'build-storybook',
|
|
401
|
+
...(setCache && existing?.cache === undefined ? { cache: true } : {}),
|
|
402
|
+
inputs,
|
|
403
|
+
});
|
|
399
404
|
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
400
405
|
}
|
|
401
406
|
function createProjectStorybookDir(tree, projectName, uiFramework, js, tsConfiguration, root, projectType, projectIsRootProjectInStandaloneWorkspace, interactionTests, mainDir, isNextJs, usesSwc, usesVite, viteConfigFilePath, hasPlugin, viteConfigFileName, usesReactNative) {
|
|
402
|
-
let projectDirectory = (0,
|
|
407
|
+
let projectDirectory = (0, internal_2.getProjectType)(tree, root, projectType) ===
|
|
403
408
|
'application'
|
|
404
409
|
? isNextJs
|
|
405
410
|
? 'components'
|
|
@@ -427,7 +432,7 @@ function createProjectStorybookDir(tree, projectName, uiFramework, js, tsConfigu
|
|
|
427
432
|
interactionTests,
|
|
428
433
|
mainDir,
|
|
429
434
|
isNextJs: isNextJs &&
|
|
430
|
-
(0,
|
|
435
|
+
(0, internal_2.getProjectType)(tree, root, projectType) ===
|
|
431
436
|
'application',
|
|
432
437
|
usesSwc,
|
|
433
438
|
usesVite,
|
|
@@ -454,7 +459,7 @@ function getTsConfigPath(tree, projectName, path) {
|
|
|
454
459
|
const { root, projectType } = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
455
460
|
return (0, path_1.join)(root, path?.length > 0
|
|
456
461
|
? path
|
|
457
|
-
: (0,
|
|
462
|
+
: (0, internal_2.getProjectType)(tree, root, projectType) === 'application'
|
|
458
463
|
? 'tsconfig.app.json'
|
|
459
464
|
: 'tsconfig.lib.json');
|
|
460
465
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../packages/storybook/src/generators/init/init.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,iBAAiB,EAIjB,IAAI,EAGL,MAAM,YAAY,CAAC;AASpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../packages/storybook/src/generators/init/init.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,iBAAiB,EAIjB,IAAI,EAGL,MAAM,YAAY,CAAC;AASpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AA2DlC,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAEvD;AAED,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAiErE;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -18,14 +18,12 @@ function checkDependenciesInstalled(host, schema) {
|
|
|
18
18
|
return (0, devkit_1.addDependenciesToPackageJson)(host, {}, devDependencies, undefined, schema.keepExistingVersions);
|
|
19
19
|
}
|
|
20
20
|
function addCacheableOperation(tree) {
|
|
21
|
-
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
21
|
+
const nxJson = (0, devkit_1.readNxJson)(tree) ?? {};
|
|
22
22
|
const cacheableOperations = nxJson.tasksRunnerOptions?.default?.options?.cacheableOperations;
|
|
23
23
|
if (cacheableOperations && !cacheableOperations.includes('build-storybook')) {
|
|
24
24
|
nxJson.tasksRunnerOptions.default.options.cacheableOperations.push('build-storybook');
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
nxJson.targetDefaults['build-storybook'] ??= {};
|
|
28
|
-
nxJson.targetDefaults['build-storybook'].cache = true;
|
|
26
|
+
(0, internal_1.upsertTargetDefault)(tree, nxJson, { target: 'build-storybook', cache: true });
|
|
29
27
|
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
30
28
|
}
|
|
31
29
|
function moveToDevDependencies(tree) {
|
package/src/plugins/plugin.js
CHANGED
|
@@ -9,7 +9,7 @@ const cache_directory_1 = require("nx/src/utils/cache-directory");
|
|
|
9
9
|
const js_1 = require("@nx/js");
|
|
10
10
|
const file_hasher_1 = require("nx/src/hasher/file-hasher");
|
|
11
11
|
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
12
|
-
const
|
|
12
|
+
const internal_2 = require("@nx/js/internal");
|
|
13
13
|
/**
|
|
14
14
|
* @deprecated The 'createDependencies' function is now a no-op. This functionality is included in 'createNodesV2'.
|
|
15
15
|
*/
|
|
@@ -87,7 +87,7 @@ async function buildStorybookTargets(configFilePath, projectRoot, options, conte
|
|
|
87
87
|
targets[options.testStorybookTargetName] = testTarget(projectRoot);
|
|
88
88
|
}
|
|
89
89
|
targets[options.staticStorybookTargetName] = serveStaticTarget(options, projectRoot);
|
|
90
|
-
(0,
|
|
90
|
+
(0, internal_2.addBuildAndWatchDepsTargets)(context.workspaceRoot, projectRoot, targets, options, pmc);
|
|
91
91
|
return targets;
|
|
92
92
|
}
|
|
93
93
|
function buildTarget(namedInputs, outputs, projectRoot, frameworkIsAngular, projectName, configFilePath) {
|