@nx/storybook 22.7.0-beta.0 → 22.7.0-beta.10
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 +9 -10
- package/src/executors/build-storybook/build-storybook.impl.js +35 -2
- package/src/executors/storybook/storybook.impl.js +35 -2
- package/src/generators/migrate-10/calling-storybook-cli.js +1 -1
- package/src/generators/migrate-8/calling-storybook-cli.js +2 -2
- package/src/generators/migrate-9/calling-storybook-cli.js +2 -2
- package/src/migrations/update-21-1-0/update-sb-9.js +2 -1
- package/src/migrations/update-22-1-0/migrate-to-storybook-10.js +2 -1
- package/src/plugins/plugin.d.ts.map +1 -1
- package/src/plugins/plugin.js +5 -5
- package/project.json +0 -69
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/storybook",
|
|
3
|
-
"version": "22.7.0-beta.
|
|
3
|
+
"version": "22.7.0-beta.10",
|
|
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": {
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"Testing"
|
|
20
20
|
],
|
|
21
21
|
"main": "./index.js",
|
|
22
|
-
"
|
|
22
|
+
"type": "commonjs",
|
|
23
|
+
"types": "./index.d.ts",
|
|
23
24
|
"author": "Isaac Mann",
|
|
24
25
|
"license": "MIT",
|
|
25
26
|
"bugs": {
|
|
@@ -33,16 +34,16 @@
|
|
|
33
34
|
"migrations": "./migrations.json"
|
|
34
35
|
},
|
|
35
36
|
"dependencies": {
|
|
36
|
-
"@nx/devkit": "22.7.0-beta.
|
|
37
|
+
"@nx/devkit": "22.7.0-beta.10",
|
|
37
38
|
"@phenomnomnominal/tsquery": "~6.1.4",
|
|
38
39
|
"semver": "^7.6.3",
|
|
39
40
|
"tslib": "^2.3.0",
|
|
40
|
-
"@nx/cypress": "22.7.0-beta.
|
|
41
|
-
"@nx/js": "22.7.0-beta.
|
|
42
|
-
"@nx/eslint": "22.7.0-beta.
|
|
41
|
+
"@nx/cypress": "22.7.0-beta.10",
|
|
42
|
+
"@nx/js": "22.7.0-beta.10",
|
|
43
|
+
"@nx/eslint": "22.7.0-beta.10"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
|
-
"nx": "22.7.0-beta.
|
|
46
|
+
"nx": "22.7.0-beta.10",
|
|
46
47
|
"storybook": "9.0.6"
|
|
47
48
|
},
|
|
48
49
|
"peerDependencies": {
|
|
@@ -50,7 +51,5 @@
|
|
|
50
51
|
},
|
|
51
52
|
"publishConfig": {
|
|
52
53
|
"access": "public"
|
|
53
|
-
}
|
|
54
|
-
"types": "./index.d.ts",
|
|
55
|
-
"type": "commonjs"
|
|
54
|
+
}
|
|
56
55
|
}
|
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.default = buildStorybookExecutor;
|
|
4
37
|
const devkit_1 = require("@nx/devkit");
|
|
@@ -21,8 +54,8 @@ async function runInstance(options) {
|
|
|
21
54
|
const installedStorybookVersion = (0, utilities_1.getInstalledStorybookVersion)();
|
|
22
55
|
const hasCoreServerInStorybookPackage = (0, semver_1.gte)(installedStorybookVersion, '8.2.0');
|
|
23
56
|
const storybookCore = await (hasCoreServerInStorybookPackage
|
|
24
|
-
? Promise.resolve().then(() => require('storybook/internal/core-server')) : // This is needed for backwards compatibility - but we do not have the package installed in the nx repo
|
|
25
|
-
Promise.resolve().then(() => require('@storybook/core-server')));
|
|
57
|
+
? Promise.resolve().then(() => __importStar(require('storybook/internal/core-server'))) : // This is needed for backwards compatibility - but we do not have the package installed in the nx repo
|
|
58
|
+
Promise.resolve().then(() => __importStar(require('@storybook/core-server'))));
|
|
26
59
|
const env = process.env.NODE_ENV ?? 'production';
|
|
27
60
|
process.env.NODE_ENV = env;
|
|
28
61
|
return storybookCore.build({
|
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.default = storybookExecutor;
|
|
4
37
|
const utilities_1 = require("../../utils/utilities");
|
|
@@ -24,8 +57,8 @@ async function runInstance(options) {
|
|
|
24
57
|
const installedStorybookVersion = (0, utilities_1.getInstalledStorybookVersion)();
|
|
25
58
|
const hasCoreServerInStorybookPackage = (0, semver_1.gte)(installedStorybookVersion, '8.2.0');
|
|
26
59
|
const storybookCore = await (hasCoreServerInStorybookPackage
|
|
27
|
-
? Promise.resolve().then(() => require('storybook/internal/core-server')) : // This is needed for backwards compatibility - but we do not have the package installed in the nx repo
|
|
28
|
-
Promise.resolve().then(() => require('@storybook/core-server')));
|
|
60
|
+
? Promise.resolve().then(() => __importStar(require('storybook/internal/core-server'))) : // This is needed for backwards compatibility - but we do not have the package installed in the nx repo
|
|
61
|
+
Promise.resolve().then(() => __importStar(require('@storybook/core-server'))));
|
|
29
62
|
const env = process.env.NODE_ENV ?? 'development';
|
|
30
63
|
process.env.NODE_ENV = env;
|
|
31
64
|
return storybookCore.build({
|
|
@@ -18,7 +18,7 @@ function callUpgrade(schema) {
|
|
|
18
18
|
});
|
|
19
19
|
(0, child_process_1.execSync)(`${pm.dlx} ${packageManager === 'yarn' ? 'storybook' : 'storybook@latest'} upgrade ${schema.autoAcceptAllPrompts ? '--yes' : ''}`, {
|
|
20
20
|
stdio: [0, 1, 2],
|
|
21
|
-
windowsHide:
|
|
21
|
+
windowsHide: true,
|
|
22
22
|
});
|
|
23
23
|
devkit_1.output.log({
|
|
24
24
|
title: `Storybook packages upgraded.`,
|
|
@@ -18,7 +18,7 @@ function callUpgrade(schema) {
|
|
|
18
18
|
});
|
|
19
19
|
(0, child_process_1.execSync)(`${pm.dlx} ${packageManager === 'yarn' ? 'storybook' : 'storybook@latest'} upgrade ${schema.autoAcceptAllPrompts ? '--yes' : ''}`, {
|
|
20
20
|
stdio: [0, 1, 2],
|
|
21
|
-
windowsHide:
|
|
21
|
+
windowsHide: true,
|
|
22
22
|
});
|
|
23
23
|
devkit_1.output.log({
|
|
24
24
|
title: `Storybook packages upgraded.`,
|
|
@@ -68,7 +68,7 @@ function callAutomigrate(allStorybookProjects, schema) {
|
|
|
68
68
|
});
|
|
69
69
|
(0, child_process_1.execSync)(`${commandToRun} ${schema.autoAcceptAllPrompts ? '--yes' : ''}`, {
|
|
70
70
|
stdio: 'inherit',
|
|
71
|
-
windowsHide:
|
|
71
|
+
windowsHide: true,
|
|
72
72
|
});
|
|
73
73
|
resultOfMigration.successfulProjects[projectName] = commandToRun;
|
|
74
74
|
}
|
|
@@ -18,7 +18,7 @@ function callUpgrade(schema) {
|
|
|
18
18
|
});
|
|
19
19
|
(0, child_process_1.execSync)(`${pm.dlx} ${packageManager === 'yarn' ? 'storybook' : 'storybook@latest'} upgrade ${schema.autoAcceptAllPrompts ? '--yes' : ''}`, {
|
|
20
20
|
stdio: [0, 1, 2],
|
|
21
|
-
windowsHide:
|
|
21
|
+
windowsHide: true,
|
|
22
22
|
});
|
|
23
23
|
devkit_1.output.log({
|
|
24
24
|
title: `Storybook packages upgraded.`,
|
|
@@ -68,7 +68,7 @@ function callAutomigrate(allStorybookProjects, schema) {
|
|
|
68
68
|
});
|
|
69
69
|
(0, child_process_1.execSync)(`${commandToRun} ${schema.autoAcceptAllPrompts ? '--yes' : ''}`, {
|
|
70
70
|
stdio: 'inherit',
|
|
71
|
-
windowsHide:
|
|
71
|
+
windowsHide: true,
|
|
72
72
|
env: process.env,
|
|
73
73
|
});
|
|
74
74
|
resultOfMigration.successfulProjects[projectName] = commandToRun;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = changeStorybookTargets;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const output_1 = require("nx/src/utils/output");
|
|
5
|
-
const migrate_9_1 = require("../../generators/migrate-9/migrate-9");
|
|
6
|
+
const migrate_9_1 = tslib_1.__importDefault(require("../../generators/migrate-9/migrate-9"));
|
|
6
7
|
const utilities_1 = require("../../utils/utilities");
|
|
7
8
|
async function changeStorybookTargets(tree) {
|
|
8
9
|
const storybookVersion = (0, utilities_1.storybookMajorVersion)();
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = migrateToStorybook10;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const output_1 = require("nx/src/utils/output");
|
|
5
|
-
const migrate_10_1 = require("../../generators/migrate-10/migrate-10");
|
|
6
|
+
const migrate_10_1 = tslib_1.__importDefault(require("../../generators/migrate-10/migrate-10"));
|
|
6
7
|
async function migrateToStorybook10(tree) {
|
|
7
8
|
output_1.output.log({
|
|
8
9
|
title: 'Migrating Storybook to v10',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/storybook/src/plugins/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAGlB,aAAa,EAQd,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/storybook/src/plugins/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAGlB,aAAa,EAQd,MAAM,YAAY,CAAC;AAapB,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;AAeD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAIF,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,sBAAsB,CAgC7D,CAAC;AAEF,eAAO,MAAM,aAAa,uCAAc,CAAC"}
|
package/src/plugins/plugin.js
CHANGED
|
@@ -12,7 +12,6 @@ const config_utils_1 = require("@nx/devkit/src/utils/config-utils");
|
|
|
12
12
|
const file_hasher_1 = require("nx/src/hasher/file-hasher");
|
|
13
13
|
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
14
14
|
const util_1 = require("@nx/js/src/plugins/typescript/util");
|
|
15
|
-
const pmc = (0, devkit_1.getPackageManagerCommand)();
|
|
16
15
|
function readTargetsCache(cachePath) {
|
|
17
16
|
return (0, fs_1.existsSync)(cachePath) ? (0, devkit_1.readJsonFile)(cachePath) : {};
|
|
18
17
|
}
|
|
@@ -34,8 +33,9 @@ exports.createNodes = [
|
|
|
34
33
|
const optionsHash = (0, file_hasher_1.hashObject)(normalizedOptions);
|
|
35
34
|
const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, `storybook-${optionsHash}.hash`);
|
|
36
35
|
const targetsCache = readTargetsCache(cachePath);
|
|
36
|
+
const pmc = (0, devkit_1.getPackageManagerCommand)((0, devkit_1.detectPackageManager)(context.workspaceRoot));
|
|
37
37
|
try {
|
|
38
|
-
return await (0, devkit_1.createNodesFromFiles)((configFile, _, context) => createNodesInternal(configFile, normalizedOptions, context, targetsCache), configFilePaths, normalizedOptions, context);
|
|
38
|
+
return await (0, devkit_1.createNodesFromFiles)((configFile, _, context) => createNodesInternal(configFile, normalizedOptions, context, targetsCache, pmc), configFilePaths, normalizedOptions, context);
|
|
39
39
|
}
|
|
40
40
|
finally {
|
|
41
41
|
writeTargetsToCache(cachePath, targetsCache);
|
|
@@ -43,7 +43,7 @@ exports.createNodes = [
|
|
|
43
43
|
},
|
|
44
44
|
];
|
|
45
45
|
exports.createNodesV2 = exports.createNodes;
|
|
46
|
-
async function createNodesInternal(configFilePath, options, context, targetsCache) {
|
|
46
|
+
async function createNodesInternal(configFilePath, options, context, targetsCache, pmc) {
|
|
47
47
|
let projectRoot = '';
|
|
48
48
|
if (configFilePath.includes('/.storybook')) {
|
|
49
49
|
projectRoot = (0, path_1.dirname)(configFilePath).replace('/.storybook', '');
|
|
@@ -62,7 +62,7 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
|
|
|
62
62
|
}
|
|
63
63
|
const hash = await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, options, context, [(0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot))]);
|
|
64
64
|
const projectName = buildProjectName(projectRoot, context.workspaceRoot);
|
|
65
|
-
targetsCache[hash] ??= await buildStorybookTargets(configFilePath, projectRoot, options, context, projectName);
|
|
65
|
+
targetsCache[hash] ??= await buildStorybookTargets(configFilePath, projectRoot, options, context, projectName, pmc);
|
|
66
66
|
const result = {
|
|
67
67
|
projects: {
|
|
68
68
|
[projectRoot]: {
|
|
@@ -73,7 +73,7 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
|
|
|
73
73
|
};
|
|
74
74
|
return result;
|
|
75
75
|
}
|
|
76
|
-
async function buildStorybookTargets(configFilePath, projectRoot, options, context, projectName) {
|
|
76
|
+
async function buildStorybookTargets(configFilePath, projectRoot, options, context, projectName, pmc) {
|
|
77
77
|
const buildOutputs = getOutputs();
|
|
78
78
|
const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
|
|
79
79
|
// First attempt to do a very fast lookup for the framework
|
package/project.json
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "storybook",
|
|
3
|
-
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
-
"sourceRoot": "packages/storybook",
|
|
5
|
-
"projectType": "library",
|
|
6
|
-
"targets": {
|
|
7
|
-
"build": {
|
|
8
|
-
"outputs": ["{workspaceRoot}/dist/packages/storybook/README.md"],
|
|
9
|
-
"command": "node ./scripts/copy-readme.js storybook"
|
|
10
|
-
},
|
|
11
|
-
"nx-release-publish": {
|
|
12
|
-
"executor": "@nx/js:release-publish",
|
|
13
|
-
"options": {
|
|
14
|
-
"packageRoot": "dist/packages/storybook"
|
|
15
|
-
},
|
|
16
|
-
"dependsOn": ["^nx-release-publish"]
|
|
17
|
-
},
|
|
18
|
-
"legacy-post-build": {
|
|
19
|
-
"executor": "@nx/workspace-plugin:legacy-post-build",
|
|
20
|
-
"options": {
|
|
21
|
-
"tsConfig": "./tsconfig.lib.json",
|
|
22
|
-
"assets": [
|
|
23
|
-
{
|
|
24
|
-
"input": "packages/storybook",
|
|
25
|
-
"glob": "**/files/**",
|
|
26
|
-
"output": "/"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"input": "packages/storybook",
|
|
30
|
-
"glob": "**/project-files/.storybook/**",
|
|
31
|
-
"output": "/"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"input": "packages/storybook",
|
|
35
|
-
"glob": "**/project-files-ts/.storybook/**",
|
|
36
|
-
"output": "/"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"input": "packages/storybook",
|
|
40
|
-
"glob": "**/*.json",
|
|
41
|
-
"ignore": [
|
|
42
|
-
"**/tsconfig*.json",
|
|
43
|
-
"project.json",
|
|
44
|
-
".eslintrc.json",
|
|
45
|
-
"**/test-configs/**"
|
|
46
|
-
],
|
|
47
|
-
"output": "/"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"input": "packages/storybook",
|
|
51
|
-
"glob": "**/*.js",
|
|
52
|
-
"ignore": ["**/jest.config.js"],
|
|
53
|
-
"output": "/"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"input": "packages/storybook",
|
|
57
|
-
"glob": "**/*.d.ts",
|
|
58
|
-
"output": "/"
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
"input": "",
|
|
62
|
-
"glob": "LICENSE",
|
|
63
|
-
"output": "/"
|
|
64
|
-
}
|
|
65
|
-
]
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|