@nx/storybook 23.0.0-beta.17 → 23.0.0-beta.19
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/plugins/plugin.d.ts.map +1 -1
- package/src/plugins/plugin.js +47 -9
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.19",
|
|
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.19",
|
|
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.19",
|
|
42
|
+
"@nx/js": "23.0.0-beta.19",
|
|
43
|
+
"@nx/eslint": "23.0.0-beta.19"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"nx": "23.0.0-beta.
|
|
46
|
+
"nx": "23.0.0-beta.19",
|
|
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.19",
|
|
51
51
|
"storybook": ">=7.0.0 <11.0.0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependenciesMeta": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/storybook/src/plugins/plugin.ts"],"names":[],"mappings":"AAMA,OAAO,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/storybook/src/plugins/plugin.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,kBAAkB,EAIlB,aAAa,EAMd,MAAM,YAAY,CAAC;AAUpB,MAAM,WAAW,sBAAsB;IACrC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAID;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAIF,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,sBAAsB,CA+D7D,CAAC;AAEF,eAAO,MAAM,aAAa,uCAAc,CAAC"}
|
package/src/plugins/plugin.js
CHANGED
|
@@ -29,7 +29,27 @@ exports.createNodes = [
|
|
|
29
29
|
const pmc = (0, devkit_1.getPackageManagerCommand)(packageManager);
|
|
30
30
|
const lockFileName = (0, js_1.getLockFileName)(packageManager);
|
|
31
31
|
try {
|
|
32
|
-
|
|
32
|
+
const { entries, preErrors } = await filterStorybookConfigs(configFilePaths, context);
|
|
33
|
+
const projectHashes = await (0, internal_1.calculateHashesForCreateNodes)(entries.map((e) => e.projectRoot), normalizedOptions, context, entries.map(() => [lockFileName]));
|
|
34
|
+
let results = [];
|
|
35
|
+
let nodeErrors = [];
|
|
36
|
+
try {
|
|
37
|
+
results = await (0, devkit_1.createNodesFromFiles)((configFile, _, ctx, idx) => createNodesInternal(configFile, normalizedOptions, ctx, targetsCache, pmc, entries[idx].projectRoot, projectHashes[idx]), entries.map((e) => e.configFile), normalizedOptions, context);
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
if (e instanceof devkit_1.AggregateCreateNodesError) {
|
|
41
|
+
results = e.partialResults ?? [];
|
|
42
|
+
nodeErrors = e.errors;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
throw e;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const allErrors = [...preErrors, ...nodeErrors];
|
|
49
|
+
if (allErrors.length > 0) {
|
|
50
|
+
throw new devkit_1.AggregateCreateNodesError(allErrors, results);
|
|
51
|
+
}
|
|
52
|
+
return results;
|
|
33
53
|
}
|
|
34
54
|
finally {
|
|
35
55
|
targetsCache.writeToDisk();
|
|
@@ -37,7 +57,7 @@ exports.createNodes = [
|
|
|
37
57
|
},
|
|
38
58
|
];
|
|
39
59
|
exports.createNodesV2 = exports.createNodes;
|
|
40
|
-
|
|
60
|
+
function getProjectRootFromConfigPath(configFilePath) {
|
|
41
61
|
let projectRoot = '';
|
|
42
62
|
if (configFilePath.includes('/.storybook')) {
|
|
43
63
|
projectRoot = (0, path_1.dirname)(configFilePath).replace('/.storybook', '');
|
|
@@ -48,13 +68,9 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
|
|
|
48
68
|
if (projectRoot === '') {
|
|
49
69
|
projectRoot = '.';
|
|
50
70
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
!siblingFiles.includes('project.json')) {
|
|
55
|
-
return {};
|
|
56
|
-
}
|
|
57
|
-
const hash = await (0, internal_1.calculateHashForCreateNodes)(projectRoot, options, context, [lockFileName]);
|
|
71
|
+
return projectRoot;
|
|
72
|
+
}
|
|
73
|
+
async function createNodesInternal(configFilePath, options, context, targetsCache, pmc, projectRoot, hash) {
|
|
58
74
|
const projectName = buildProjectName(projectRoot, context.workspaceRoot);
|
|
59
75
|
if (!targetsCache.has(hash)) {
|
|
60
76
|
targetsCache.set(hash, await buildStorybookTargets(configFilePath, projectRoot, options, context, projectName, pmc));
|
|
@@ -228,6 +244,28 @@ function getOutputs() {
|
|
|
228
244
|
];
|
|
229
245
|
return outputs;
|
|
230
246
|
}
|
|
247
|
+
async function filterStorybookConfigs(configFiles, context) {
|
|
248
|
+
const preErrors = [];
|
|
249
|
+
const candidates = await Promise.all(configFiles.map(async (configFile) => {
|
|
250
|
+
try {
|
|
251
|
+
const projectRoot = getProjectRootFromConfigPath(configFile);
|
|
252
|
+
const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
|
|
253
|
+
if (!siblingFiles.includes('package.json') &&
|
|
254
|
+
!siblingFiles.includes('project.json')) {
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
257
|
+
return { configFile, projectRoot };
|
|
258
|
+
}
|
|
259
|
+
catch (e) {
|
|
260
|
+
preErrors.push([configFile, e]);
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
263
|
+
}));
|
|
264
|
+
return {
|
|
265
|
+
entries: candidates.filter((c) => c !== null),
|
|
266
|
+
preErrors,
|
|
267
|
+
};
|
|
268
|
+
}
|
|
231
269
|
function normalizeOptions(options) {
|
|
232
270
|
return {
|
|
233
271
|
buildStorybookTargetName: options.buildStorybookTargetName ?? 'build-storybook',
|