@storybook/cli 11.0.0-alpha.8 → 11.0.0-alpha.9
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/_node-chunks/{block-create-react-app-7FNU4CBM.js → block-create-react-app-ZGUQ7EOA.js} +8 -8
- package/dist/_node-chunks/{block-dependencies-versions-3HIVYTAD.js → block-dependencies-versions-SM3CKNIG.js} +13 -13
- package/dist/_node-chunks/{block-experimental-addon-test-2NBRKH5B.js → block-experimental-addon-test-6GKXSR5Y.js} +9 -9
- package/dist/_node-chunks/{block-major-version-K2Y53V3L.js → block-major-version-ZOLCWSRX.js} +9 -9
- package/dist/_node-chunks/{block-node-version-PUUM26IQ.js → block-node-version-UVUV3CB6.js} +8 -8
- package/dist/_node-chunks/{block-react-legacy-root-api-ESXDCB2N.js → block-react-legacy-root-api-CFLW63LD.js} +8 -8
- package/dist/_node-chunks/{block-webpack5-frameworks-M3L7NMZH.js → block-webpack5-frameworks-T7IYRF76.js} +11 -11
- package/dist/_node-chunks/{chunk-WMRVFXLT.js → chunk-2SDOEETA.js} +7 -7
- package/dist/_node-chunks/{chunk-J5HVJRFW.js → chunk-6ZVCSJYW.js} +7 -7
- package/dist/_node-chunks/chunk-HJMJIBRR.js +11 -0
- package/dist/_node-chunks/{chunk-IC37BRUZ.js → chunk-Q65PSJT5.js} +17 -17
- package/dist/_node-chunks/{chunk-5F2NM7VF.js → chunk-VJYEBOLK.js} +6 -6
- package/dist/_node-chunks/{globby-7OAS3ZTU.js → globby-CK6XLGSW.js} +8 -8
- package/dist/_node-chunks/{p-limit-BO6YVIDZ.js → p-limit-TO3VPQQY.js} +7 -7
- package/dist/_node-chunks/{run-FR35DMP3.js → run-NYUBA27L.js} +251 -263
- package/dist/bin/index.js +7 -7
- package/package.json +4 -4
- package/dist/_node-chunks/chunk-VW3ZGBUF.js +0 -11
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_dkhomef0dow from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_dkhomef0dow from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_dkhomef0dow from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_dkhomef0dow.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_dkhomef0dow.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_dkhomef0dow.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -20,18 +20,18 @@ import {
|
|
|
20
20
|
shortenPath,
|
|
21
21
|
up,
|
|
22
22
|
upgradeStorybookDependencies
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-Q65PSJT5.js";
|
|
24
24
|
import {
|
|
25
25
|
slash
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-2SDOEETA.js";
|
|
27
27
|
import {
|
|
28
28
|
require_semver
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-6ZVCSJYW.js";
|
|
30
30
|
import {
|
|
31
31
|
__commonJS,
|
|
32
32
|
__require,
|
|
33
33
|
__toESM
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-VJYEBOLK.js";
|
|
35
35
|
|
|
36
36
|
// ../../../node_modules/envinfo/dist/envinfo.js
|
|
37
37
|
var require_envinfo = __commonJS({
|
|
@@ -4752,10 +4752,10 @@ function leven(first, second, options) {
|
|
|
4752
4752
|
}
|
|
4753
4753
|
|
|
4754
4754
|
// src/bin/run.ts
|
|
4755
|
-
var
|
|
4755
|
+
var import_picocolors23 = __toESM(require_picocolors(), 1);
|
|
4756
4756
|
|
|
4757
4757
|
// package.json
|
|
4758
|
-
var version = "11.0.0-alpha.
|
|
4758
|
+
var version = "11.0.0-alpha.9";
|
|
4759
4759
|
|
|
4760
4760
|
// src/add.ts
|
|
4761
4761
|
var import_semver2 = __toESM(require_semver(), 1);
|
|
@@ -5166,7 +5166,7 @@ function isValidVersion(version2) {
|
|
|
5166
5166
|
}
|
|
5167
5167
|
|
|
5168
5168
|
// src/automigrate/index.ts
|
|
5169
|
-
var
|
|
5169
|
+
var import_picocolors20 = __toESM(require_picocolors(), 1);
|
|
5170
5170
|
import { versions as versions2 } from "storybook/internal/common";
|
|
5171
5171
|
import { logTracker as logTracker2, logger as logger19, prompt as prompt5 } from "storybook/internal/node-logger";
|
|
5172
5172
|
import { AutomigrateError } from "storybook/internal/server-errors";
|
|
@@ -5767,13 +5767,10 @@ import {
|
|
|
5767
5767
|
|
|
5768
5768
|
// src/automigrate/helpers/edit-parsed-file.ts
|
|
5769
5769
|
import { HandledError } from "storybook/internal/common";
|
|
5770
|
-
|
|
5771
|
-
unwrapExpression
|
|
5772
|
-
} from "storybook/internal/csf-tools";
|
|
5773
|
-
var covered = /* @__PURE__ */ new WeakSet(), describeDiagnostic = ({ message, loc }) => loc ? `line ${loc.start.line}: ${message}` : message, editParsedFile = async (file, edit2) => {
|
|
5770
|
+
var describeDiagnostic = ({ message, loc }) => loc ? `line ${loc.start.line}: ${message}` : message, editParsedFile = async (file, edit2) => {
|
|
5774
5771
|
let diagnosticsBefore = file.mutationDiagnostics.length;
|
|
5775
5772
|
await edit2(file);
|
|
5776
|
-
let diagnostics = file.mutationDiagnostics.slice(diagnosticsBefore).filter((
|
|
5773
|
+
let diagnostics = file.mutationDiagnostics.slice(diagnosticsBefore).filter(({ code }) => code !== "aliased-story");
|
|
5777
5774
|
if (diagnostics.length > 0)
|
|
5778
5775
|
throw new HandledError([...new Set(diagnostics.map(describeDiagnostic))].join("; "));
|
|
5779
5776
|
}, readForEdit = (object, path4) => {
|
|
@@ -5781,31 +5778,6 @@ var covered = /* @__PURE__ */ new WeakSet(), describeDiagnostic = ({ message, lo
|
|
|
5781
5778
|
if (found.kind === "unreadable")
|
|
5782
5779
|
throw new HandledError(describeDiagnostic(found.diagnostic));
|
|
5783
5780
|
return found.kind === "value" ? found.node : void 0;
|
|
5784
|
-
}, constInitializer = (csf, name) => {
|
|
5785
|
-
for (let statement of csf.program.body) {
|
|
5786
|
-
let declaration = statement.type === "ExportNamedDeclaration" ? statement.declaration : statement;
|
|
5787
|
-
if (!(declaration?.type !== "VariableDeclaration" || declaration.kind !== "const")) {
|
|
5788
|
-
for (let declarator of declaration.declarations)
|
|
5789
|
-
if (declarator.id.type === "Identifier" && declarator.id.name === name)
|
|
5790
|
-
return declarator.init ? unwrapExpression(declarator.init) : void 0;
|
|
5791
|
-
}
|
|
5792
|
-
}
|
|
5793
|
-
}, everyCsfObject = (csf) => {
|
|
5794
|
-
let diagnosticsBefore = csf.mutationDiagnostics.length, objects = csf.objects(), edited = new Set(
|
|
5795
|
-
objects.flatMap(({ target }) => target.kind === "story" ? [target.localName] : [])
|
|
5796
|
-
), aliases = csf.mutationDiagnostics.slice(diagnosticsBefore).flatMap((diagnostic) => {
|
|
5797
|
-
let { code, path: path4, target } = diagnostic;
|
|
5798
|
-
if (code !== "unsupported-initializer" || path4.length > 0 || target.kind !== "story")
|
|
5799
|
-
return [];
|
|
5800
|
-
let init = constInitializer(csf, target.localName);
|
|
5801
|
-
return init?.type === "Identifier" ? [{ diagnostic, name: target.localName, of: init.name }] : [];
|
|
5802
|
-
});
|
|
5803
|
-
for (let found = !0; found; ) {
|
|
5804
|
-
found = !1;
|
|
5805
|
-
for (let { diagnostic, name, of } of aliases)
|
|
5806
|
-
!covered.has(diagnostic) && edited.has(of) && (covered.add(diagnostic), edited.add(name), found = !0);
|
|
5807
|
-
}
|
|
5808
|
-
return objects;
|
|
5809
5781
|
};
|
|
5810
5782
|
|
|
5811
5783
|
// src/automigrate/fix-files.ts
|
|
@@ -5887,7 +5859,7 @@ var KIND_ORDER = ["main", "preview", "manager", "config", "story"], parse2 = (co
|
|
|
5887
5859
|
project.mainConfigPath && claim(project.mainConfigPath, "main"), project.previewConfigPath && claim(project.previewConfigPath, "preview");
|
|
5888
5860
|
let managerConfigPath = project.configDir && findConfigFile("manager", project.configDir);
|
|
5889
5861
|
if (managerConfigPath && claim(managerConfigPath, "manager"), project.storiesPaths.forEach((id) => claim(id, "story")), kinds.has("config")) {
|
|
5890
|
-
let { globby } = await import("./globby-
|
|
5862
|
+
let { globby } = await import("./globby-CK6XLGSW.js");
|
|
5891
5863
|
(await globby("**/*.{js,jsx,ts,tsx,mjs,cjs,mts,cts}", {
|
|
5892
5864
|
cwd: project.configDir,
|
|
5893
5865
|
absolute: !0,
|
|
@@ -6102,7 +6074,7 @@ import { logger as logger4 } from "storybook/internal/node-logger";
|
|
|
6102
6074
|
import { promises as fs } from "fs";
|
|
6103
6075
|
var maxConcurrentTasks = Math.max(1, os.cpus().length - 1);
|
|
6104
6076
|
async function runCodemod(globPattern = "**/*.{stories,story}.{js,jsx,ts,tsx,mjs,mjsx,mts,mtsx}", transform, { dryRun = !1, skipFormatting = !1 } = {}) {
|
|
6105
|
-
let modifiedCount = 0, unmodifiedCount = 0, errorCount = 0, { globby } = await import("./globby-
|
|
6077
|
+
let modifiedCount = 0, unmodifiedCount = 0, errorCount = 0, { globby } = await import("./globby-CK6XLGSW.js"), files = await globby(slash(globPattern), {
|
|
6106
6078
|
followSymbolicLinks: !0,
|
|
6107
6079
|
ignore: ["**/node_modules/**", "**/dist/**", "**/storybook-static/**", "**/build/**"]
|
|
6108
6080
|
});
|
|
@@ -6113,7 +6085,7 @@ Please try a different pattern.
|
|
|
6113
6085
|
`
|
|
6114
6086
|
), new Error("No files matched");
|
|
6115
6087
|
try {
|
|
6116
|
-
let pLimit = (await import("./p-limit-
|
|
6088
|
+
let pLimit = (await import("./p-limit-TO3VPQQY.js")).default, limit = pLimit(maxConcurrentTasks);
|
|
6117
6089
|
await Promise.all(
|
|
6118
6090
|
files.map(
|
|
6119
6091
|
(file) => limit(async () => {
|
|
@@ -6163,7 +6135,7 @@ import {
|
|
|
6163
6135
|
removeStatements as removeStatements2,
|
|
6164
6136
|
setImportSpecifiers as setImportSpecifiers2,
|
|
6165
6137
|
prependStatement,
|
|
6166
|
-
unwrapExpression
|
|
6138
|
+
unwrapExpression
|
|
6167
6139
|
} from "storybook/internal/csf-tools";
|
|
6168
6140
|
import { logger as logger5 } from "storybook/internal/node-logger";
|
|
6169
6141
|
|
|
@@ -6257,7 +6229,7 @@ ${err}`), info.source;
|
|
|
6257
6229
|
let methodName = configType === "main" ? "defineMain" : "definePreview", editor = config.editor, exportDecls = config._exportDecls, defineConfigProps = getConfigProperties(editor, exportDecls, { configType }), hasNamedExports = defineConfigProps.length > 0, isAlreadyTransformed = config.program.body.some((node) => {
|
|
6258
6230
|
if (node.type !== "ExportDefaultDeclaration")
|
|
6259
6231
|
return !1;
|
|
6260
|
-
let declaration =
|
|
6232
|
+
let declaration = unwrapExpression(node.declaration);
|
|
6261
6233
|
return declaration?.type === "CallExpression" && declaration.callee.type === "Identifier" && declaration.callee.name === methodName;
|
|
6262
6234
|
}), expectedImportSource = frameworkPackage + (configType === "main" ? "/node" : ""), findFrameworkImport = () => config.program.body.find(
|
|
6263
6235
|
(node) => node.type === "ImportDeclaration" && node.importKind !== "type" && node.source.value === expectedImportSource
|
|
@@ -6268,7 +6240,7 @@ ${err}`), info.source;
|
|
|
6268
6240
|
return info.source;
|
|
6269
6241
|
let findObjectDeclaration = (declarationName) => config.program.body.find(
|
|
6270
6242
|
(n) => n.type === "VariableDeclaration" && n.declarations.some(
|
|
6271
|
-
(d) => d.id.type === "Identifier" && d.id.name === declarationName &&
|
|
6243
|
+
(d) => d.id.type === "Identifier" && d.id.name === declarationName && unwrapExpression(d.init)?.type === "ObjectExpression"
|
|
6272
6244
|
)
|
|
6273
6245
|
), wrapDefaultExport = (unwrapIdentifier) => {
|
|
6274
6246
|
let exportsObject = config._exportsObject;
|
|
@@ -6278,7 +6250,7 @@ ${err}`), info.source;
|
|
|
6278
6250
|
for (let node of config.program.body) {
|
|
6279
6251
|
if (node.type !== "ExportDefaultDeclaration")
|
|
6280
6252
|
continue;
|
|
6281
|
-
let declaration = unwrapIdentifier ?
|
|
6253
|
+
let declaration = unwrapIdentifier ? unwrapExpression(node.declaration) : node.declaration;
|
|
6282
6254
|
if (declaration?.type === "Identifier") {
|
|
6283
6255
|
let declarationNode = findObjectDeclaration(declaration.name);
|
|
6284
6256
|
if (!declarationNode)
|
|
@@ -6837,7 +6809,7 @@ import {
|
|
|
6837
6809
|
walk as walk4,
|
|
6838
6810
|
setImportSpecifiers as setImportSpecifiers3,
|
|
6839
6811
|
staticKey,
|
|
6840
|
-
unwrapExpression as
|
|
6812
|
+
unwrapExpression as unwrapExpression2,
|
|
6841
6813
|
wrapExpression
|
|
6842
6814
|
} from "storybook/internal/csf-tools";
|
|
6843
6815
|
var mockMembers = [
|
|
@@ -6882,7 +6854,7 @@ function wrapArgsMocks(editor) {
|
|
|
6882
6854
|
let binding = bindingOf(node);
|
|
6883
6855
|
binding && bindings.add(binding);
|
|
6884
6856
|
}, isArgsObject = (expression) => {
|
|
6885
|
-
let node =
|
|
6857
|
+
let node = unwrapExpression2(expression);
|
|
6886
6858
|
return isBoundIn(argsObjects, node) || isMember(node) && nameOf(node.property) === "args";
|
|
6887
6859
|
}, addArgs = (pattern) => {
|
|
6888
6860
|
let target = withoutDefault(pattern);
|
|
@@ -6897,7 +6869,7 @@ function wrapArgsMocks(editor) {
|
|
|
6897
6869
|
}, collectTarget = (node) => {
|
|
6898
6870
|
if (!isMember(node) || !mockMembers.includes(nameOf(node.property) ?? "") || node.object.type === "TSAsExpression")
|
|
6899
6871
|
return;
|
|
6900
|
-
let object =
|
|
6872
|
+
let object = unwrapExpression2(node.object);
|
|
6901
6873
|
(isBoundIn(argValues, object) || isMember(object) && isArgsObject(object.object)) && targets.push(node.object);
|
|
6902
6874
|
};
|
|
6903
6875
|
if (walk4(program2, (node) => {
|
|
@@ -6906,7 +6878,7 @@ function wrapArgsMocks(editor) {
|
|
|
6906
6878
|
index === 0 && isRender(editor, node) ? addArgs(param) : addContext(param);
|
|
6907
6879
|
});
|
|
6908
6880
|
else if (node.type === "VariableDeclarator") {
|
|
6909
|
-
let { id, init } = node, value = init &&
|
|
6881
|
+
let { id, init } = node, value = init && unwrapExpression2(init);
|
|
6910
6882
|
init && isArgsObject(init) ? addArgs(id) : value && isMember(value) && isArgsObject(value.object) ? bind(argValues, id) : addContext(id);
|
|
6911
6883
|
} else node.type === "MemberExpression" && collectTarget(node);
|
|
6912
6884
|
}), targets.length === 0)
|
|
@@ -7140,11 +7112,11 @@ var csfFactories = {
|
|
|
7140
7112
|
}) {
|
|
7141
7113
|
let inSandbox = optionalEnvToBoolean(process.env.IN_STORYBOOK_SANDBOX) ?? !1, isReactNativePreview = isReactNativeStorybookPath(previewConfigPath) || isReactNativeStorybookPath(configDir) || hasSiblingReactNativeConfig(configDir, existsSync), useSubPathImports = inSandbox || isReactNativePreview;
|
|
7142
7114
|
!yes && !inSandbox && !isReactNativePreview && (logger8.logBox(dedent3`
|
|
7143
|
-
The CSF
|
|
7115
|
+
The CSF 4 format can benefit from using absolute imports of your ${import_picocolors8.default.cyan(previewConfigPath)} file. We can configure that for you, using subpath imports (a node standard), by adjusting the imports property of your package.json.
|
|
7144
7116
|
|
|
7145
7117
|
However, we cannot broadly recommend it for all projects, because it might not work in some monorepo setups or if you have an outdated tsconfig, use custom paths, or have type alias plugins configured in your project. You can always rerun this codemod and select another option to update your code later.
|
|
7146
7118
|
|
|
7147
|
-
More info: ${import_picocolors8.default.yellow("https://storybook.js.org/docs/
|
|
7119
|
+
More info: ${import_picocolors8.default.yellow("https://storybook.js.org/docs/writing-stories/csf/?ref=upgrade#subpath-imports")}
|
|
7148
7120
|
`), useSubPathImports = await prompt2.select({
|
|
7149
7121
|
message: "Which import type would you like to use for your story files?",
|
|
7150
7122
|
options: [
|
|
@@ -7184,10 +7156,10 @@ var csfFactories = {
|
|
|
7184
7156
|
(fileInfo) => configToCsfFactory(fileInfo, { configType: "preview", frameworkPackage }, { dryRun })
|
|
7185
7157
|
), await syncStorybookAddons(mainConfig, previewConfigPath, configDir), logger8.logBox(
|
|
7186
7158
|
dedent3`
|
|
7187
|
-
You can now run Storybook with the new CSF
|
|
7159
|
+
You can now run Storybook with the new CSF 4 format.
|
|
7188
7160
|
|
|
7189
7161
|
For more info, check out the docs:
|
|
7190
|
-
${import_picocolors8.default.yellow("https://storybook.js.org/docs/
|
|
7162
|
+
${import_picocolors8.default.yellow("https://storybook.js.org/docs/writing-stories/csf/upgrade?ref=upgrade")}
|
|
7191
7163
|
`
|
|
7192
7164
|
);
|
|
7193
7165
|
}
|
|
@@ -7254,7 +7226,7 @@ var readJsonFile = async (files, path4) => {
|
|
|
7254
7226
|
return null;
|
|
7255
7227
|
}
|
|
7256
7228
|
}, findWorkspaceFiles = async (basename5) => {
|
|
7257
|
-
let { globby } = await import("./globby-
|
|
7229
|
+
let { globby } = await import("./globby-CK6XLGSW.js");
|
|
7258
7230
|
return globby([`**/${basename5}`], {
|
|
7259
7231
|
cwd: getProjectRoot2(),
|
|
7260
7232
|
ignore: ["**/node_modules/**", "**/dist/**", "**/storybook-static/**"],
|
|
@@ -7954,12 +7926,12 @@ var SETTER_NAMES = ["setCustomElementsManifest", "setCustomElements"], WEB_COMPO
|
|
|
7954
7926
|
};
|
|
7955
7927
|
|
|
7956
7928
|
// src/automigrate/helpers/versionBoundary.ts
|
|
7957
|
-
var import_semver7 = __toESM(require_semver(), 1), crossesVersionBoundary = (beforeVersion, targetVersion,
|
|
7929
|
+
var import_semver7 = __toESM(require_semver(), 1), crossesVersionBoundary = (beforeVersion, targetVersion, introducedIn4) => {
|
|
7958
7930
|
let before = import_semver7.default.coerce(beforeVersion), target = import_semver7.default.coerce(targetVersion);
|
|
7959
|
-
return !before || !target ? !1 : import_semver7.default.lt(before,
|
|
7960
|
-
}, isAtOrPastVersion = (version2,
|
|
7931
|
+
return !before || !target ? !1 : import_semver7.default.lt(before, introducedIn4) && import_semver7.default.gte(target, introducedIn4);
|
|
7932
|
+
}, isAtOrPastVersion = (version2, introducedIn4) => {
|
|
7961
7933
|
let coerced = import_semver7.default.coerce(version2);
|
|
7962
|
-
return coerced !== null && import_semver7.default.gte(coerced,
|
|
7934
|
+
return coerced !== null && import_semver7.default.gte(coerced, introducedIn4);
|
|
7963
7935
|
};
|
|
7964
7936
|
|
|
7965
7937
|
// src/automigrate/fixes/csf-next-mocked-args.ts
|
|
@@ -8207,7 +8179,7 @@ var argName = (property) => {
|
|
|
8207
8179
|
filter: { kind: ["preview", "story"], code: "defaultValue" },
|
|
8208
8180
|
editConfig: strip,
|
|
8209
8181
|
editCsf: (csf) => {
|
|
8210
|
-
|
|
8182
|
+
csf.objects().forEach(strip);
|
|
8211
8183
|
}
|
|
8212
8184
|
}
|
|
8213
8185
|
]
|
|
@@ -8633,6 +8605,28 @@ var removeChangeDetectionFlag = {
|
|
|
8633
8605
|
]
|
|
8634
8606
|
};
|
|
8635
8607
|
|
|
8608
|
+
// src/automigrate/fixes/remove-legacy-feature-flags.ts
|
|
8609
|
+
var removeLegacyFeatureFlags = {
|
|
8610
|
+
id: "remove-legacy-feature-flags",
|
|
8611
|
+
link: "https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#argtypetargetsv7-feature-flag-removed",
|
|
8612
|
+
prompt: () => "Remove features.argTypeTargetsV7 and features.disallowImplicitActionsInRenderV8. Both flags are always on in Storybook 11.",
|
|
8613
|
+
check: async ({ storybookVersion, mainConfig }) => {
|
|
8614
|
+
if (!isAtOrPastVersion(storybookVersion, "11.0.0"))
|
|
8615
|
+
return null;
|
|
8616
|
+
let features = mainConfig.features ?? {};
|
|
8617
|
+
return "argTypeTargetsV7" in features || "disallowImplicitActionsInRenderV8" in features ? {} : null;
|
|
8618
|
+
},
|
|
8619
|
+
transform: () => [
|
|
8620
|
+
{
|
|
8621
|
+
filter: { kind: ["main"], code: /argTypeTargetsV7|disallowImplicitActionsInRenderV8/ },
|
|
8622
|
+
// `remove` fails on a spread in `features`, even when the flag is only mentioned in a comment.
|
|
8623
|
+
editConfig: (main) => {
|
|
8624
|
+
main.getFieldNode(["features", "argTypeTargetsV7"]) && main.remove(["features", "argTypeTargetsV7"]), main.getFieldNode(["features", "disallowImplicitActionsInRenderV8"]) && main.remove(["features", "disallowImplicitActionsInRenderV8"]);
|
|
8625
|
+
}
|
|
8626
|
+
}
|
|
8627
|
+
]
|
|
8628
|
+
};
|
|
8629
|
+
|
|
8636
8630
|
// src/automigrate/fixes/remove-experimental-review.ts
|
|
8637
8631
|
var removeExperimentalReview = {
|
|
8638
8632
|
id: "remove-experimental-review",
|
|
@@ -8933,8 +8927,57 @@ var tagOptionRenames = {
|
|
|
8933
8927
|
]
|
|
8934
8928
|
};
|
|
8935
8929
|
|
|
8930
|
+
// src/automigrate/fixes/typescript-dependency.ts
|
|
8931
|
+
var import_picocolors17 = __toESM(require_picocolors(), 1), import_semver8 = __toESM(require_semver(), 1);
|
|
8932
|
+
import {
|
|
8933
|
+
RENDERERS_WITH_TYPESCRIPT_DOCGEN,
|
|
8934
|
+
TYPESCRIPT_FOR_DOCGEN_PACKAGE,
|
|
8935
|
+
hasTypeScriptCompilerApi
|
|
8936
|
+
} from "storybook/internal/common";
|
|
8937
|
+
import { SupportedRenderer as SupportedRenderer2 } from "storybook/internal/types";
|
|
8938
|
+
var introducedIn3 = "11.0.0", upgradesAcrossPeerChange = ({ beforeVersion, storybookVersion, requested }) => requested || !!beforeVersion && crossesVersionBoundary(beforeVersion, storybookVersion, introducedIn3), typescriptDependency = {
|
|
8939
|
+
id: "typescript-dependency",
|
|
8940
|
+
link: "https://storybook.js.org/docs/configure/integration/typescript",
|
|
8941
|
+
async check(options) {
|
|
8942
|
+
let { mainConfig, packageManager } = options;
|
|
8943
|
+
if (!upgradesAcrossPeerChange(options))
|
|
8944
|
+
return null;
|
|
8945
|
+
let renderer = getRendererName(mainConfig);
|
|
8946
|
+
return !!renderer && RENDERERS_WITH_TYPESCRIPT_DOCGEN.includes(renderer) && !packageManager.isDependencyInstalled("typescript") ? !0 : null;
|
|
8947
|
+
},
|
|
8948
|
+
prompt() {
|
|
8949
|
+
return `Add ${TYPESCRIPT_FOR_DOCGEN_PACKAGE} to devDependencies, so Storybook can read your component types for Controls and the Docs args table`;
|
|
8950
|
+
},
|
|
8951
|
+
async run({ packageManager }) {
|
|
8952
|
+
await packageManager.addDependencies({ type: "devDependencies", skipInstall: !0 }, [
|
|
8953
|
+
TYPESCRIPT_FOR_DOCGEN_PACKAGE
|
|
8954
|
+
]);
|
|
8955
|
+
}
|
|
8956
|
+
}, typescriptCompilerApi = {
|
|
8957
|
+
id: "typescript-compiler-api",
|
|
8958
|
+
promptType: "notification",
|
|
8959
|
+
link: "https://storybook.js.org/docs/configure/integration/typescript#typescript-7",
|
|
8960
|
+
async check(options) {
|
|
8961
|
+
let { mainConfig, packageManager } = options;
|
|
8962
|
+
if (!upgradesAcrossPeerChange(options))
|
|
8963
|
+
return null;
|
|
8964
|
+
let renderer = getRendererName(mainConfig);
|
|
8965
|
+
if (!renderer || ![...RENDERERS_WITH_TYPESCRIPT_DOCGEN, SupportedRenderer2.ANGULAR].includes(renderer))
|
|
8966
|
+
return null;
|
|
8967
|
+
let version2 = (0, import_semver8.coerce)(await packageManager.getDeclaredVersionSpecifier("typescript"))?.version;
|
|
8968
|
+
return version2 && !hasTypeScriptCompilerApi(version2) ? { version: version2 } : null;
|
|
8969
|
+
},
|
|
8970
|
+
// The upgrade prints the full prompt only when it differs from the one-line hint without a result.
|
|
8971
|
+
prompt(result) {
|
|
8972
|
+
if (!result)
|
|
8973
|
+
return "TypeScript 7 has no compiler API, so Storybook cannot read your component types. Install TypeScript 6 side by side.";
|
|
8974
|
+
let native = `"@typescript/native": "npm:typescript@^${result.version}"`;
|
|
8975
|
+
return `TypeScript 7 has no compiler API, so Storybook cannot read your component types. In package.json, replace the ${import_picocolors17.default.cyan("typescript")} devDependency with ${import_picocolors17.default.cyan(native)} and ${import_picocolors17.default.cyan('"typescript": "npm:@typescript/typescript6@^6.0.2"')}. This is not automigrated.`;
|
|
8976
|
+
}
|
|
8977
|
+
};
|
|
8978
|
+
|
|
8936
8979
|
// src/automigrate/fixes/upgrade-storybook-related-dependencies.ts
|
|
8937
|
-
var
|
|
8980
|
+
var import_semver9 = __toESM(require_semver(), 1);
|
|
8938
8981
|
import { dirname as dirname4 } from "node:path";
|
|
8939
8982
|
import { JsPackageManager as JsPackageManager2, isCorePackage, isSatelliteAddon } from "storybook/internal/common";
|
|
8940
8983
|
import { logger as logger17 } from "storybook/internal/node-logger";
|
|
@@ -8969,7 +9012,7 @@ var NON_REGISTRY_SPECIFIER = /^(patch|file|link|portal|git|http|https|workspace)
|
|
|
8969
9012
|
};
|
|
8970
9013
|
})
|
|
8971
9014
|
)).filter(
|
|
8972
|
-
(pkg) => pkg.beforeVersion !== null && pkg.afterVersion !== null && (0,
|
|
9015
|
+
(pkg) => pkg.beforeVersion !== null && pkg.afterVersion !== null && (0, import_semver9.gt)(pkg.afterVersion, pkg.beforeVersion)
|
|
8973
9016
|
);
|
|
8974
9017
|
return upgradable.length > 0 ? { upgradable } : null;
|
|
8975
9018
|
},
|
|
@@ -8988,7 +9031,7 @@ var NON_REGISTRY_SPECIFIER = /^(patch|file|link|portal|git|http|https|workspace)
|
|
|
8988
9031
|
};
|
|
8989
9032
|
|
|
8990
9033
|
// src/automigrate/fixes/vitest-setup-file.ts
|
|
8991
|
-
var
|
|
9034
|
+
var import_picocolors18 = __toESM(require_picocolors(), 1), import_semver10 = __toESM(require_semver(), 1);
|
|
8992
9035
|
import { existsSync as existsSync5 } from "fs";
|
|
8993
9036
|
import {
|
|
8994
9037
|
formatExistingFile as formatExistingFile2,
|
|
@@ -9028,7 +9071,7 @@ var VITEST_ADDON_NAME = "@storybook/addon-vitest", VITEST_PLUGIN_MODULE = "@stor
|
|
|
9028
9071
|
(source) => source.includes(VITEST_PLUGIN_MODULE)
|
|
9029
9072
|
) && !addons.some((addon) => addon.includes(VITEST_ADDON_NAME)))
|
|
9030
9073
|
return null;
|
|
9031
|
-
let vitestVersion = await packageManager.getInstalledVersion("vitest"), inheritsRootByDefault = vitestVersion === null ? "unknown" :
|
|
9074
|
+
let vitestVersion = await packageManager.getInstalledVersion("vitest"), inheritsRootByDefault = vitestVersion === null ? "unknown" : import_semver10.default.major(vitestVersion) >= 5, candidateSetupFiles = new Set(
|
|
9032
9075
|
SETUP_FILE_EXTENSIONS.map(
|
|
9033
9076
|
(extension) => path3.join(configDir, `vitest.setup${extension}`)
|
|
9034
9077
|
).filter((filePath) => existsSync5(filePath))
|
|
@@ -9098,14 +9141,14 @@ var VITEST_ADDON_NAME = "@storybook/addon-vitest", VITEST_PLUGIN_MODULE = "@stor
|
|
|
9098
9141
|
(setupFile) => setupFile.transform.kind === "empty" ? [setupFile.path] : []
|
|
9099
9142
|
)
|
|
9100
9143
|
), rewritesAny = setupFiles.some((setupFile) => setupFile.transform.kind === "rewritten"), problems = setupFiles.flatMap(
|
|
9101
|
-
(setupFile) => setupFile.transform.kind === "manual" ? [`${
|
|
9144
|
+
(setupFile) => setupFile.transform.kind === "manual" ? [`${import_picocolors18.default.cyan(setupFile.path)}: ${setupFile.transform.reason}`] : []
|
|
9102
9145
|
);
|
|
9103
9146
|
for (let entry of unresolvedEntries) {
|
|
9104
|
-
let location = `${
|
|
9147
|
+
let location = `${import_picocolors18.default.cyan(entry.configFile)}: ${import_picocolors18.default.gray(entry.expression)} is computed at runtime`;
|
|
9105
9148
|
deletedPaths.size > 0 ? problems.push(
|
|
9106
|
-
`${location}, so the ${
|
|
9149
|
+
`${location}, so the ${import_picocolors18.default.cyan("setupFiles")} it selects can't be matched without executing your config`
|
|
9107
9150
|
) : rewritesAny && entry.project !== "storybook" && configFiles.includes(entry.configFile) && problems.push(
|
|
9108
|
-
`${location} in a Vitest project without the Storybook plugin, so it may select a setup file whose ${
|
|
9151
|
+
`${location} in a Vitest project without the Storybook plugin, so it may select a setup file whose ${import_picocolors18.default.cyan("setProjectAnnotations")} call is still needed there`
|
|
9109
9152
|
);
|
|
9110
9153
|
}
|
|
9111
9154
|
if (problems.length > 0)
|
|
@@ -9117,12 +9160,12 @@ var VITEST_ADDON_NAME = "@storybook/addon-vitest", VITEST_PLUGIN_MODULE = "@stor
|
|
|
9117
9160
|
|
|
9118
9161
|
`)}
|
|
9119
9162
|
|
|
9120
|
-
${
|
|
9121
|
-
1. If the call only passes your ${
|
|
9122
|
-
2. If it passes an addon's annotations, register that addon in the ${
|
|
9123
|
-
3. If it passes custom annotations, move them into ${
|
|
9124
|
-
4. If nothing else remains in the file, delete it and remove its entry from ${
|
|
9125
|
-
5. If the file is shared with a Vitest project that uses portable stories directly, list it only in that project's ${
|
|
9163
|
+
${import_picocolors18.default.cyan(VITEST_ADDON_NAME)} applies your project annotations itself: your ${import_picocolors18.default.cyan(".storybook/preview")} file and the previews of the addons registered in ${import_picocolors18.default.cyan(".storybook/main")}. ${import_picocolors18.default.cyan("setProjectAnnotations")} replaces those annotations, so it must not be called from a Vitest setup file. For each file listed above:
|
|
9164
|
+
1. If the call only passes your ${import_picocolors18.default.cyan(".storybook/preview")} annotations, delete the call.
|
|
9165
|
+
2. If it passes an addon's annotations, register that addon in the ${import_picocolors18.default.cyan("addons")} field of ${import_picocolors18.default.cyan(".storybook/main")} and delete the call.
|
|
9166
|
+
3. If it passes custom annotations, move them into ${import_picocolors18.default.cyan(".storybook/preview")} and delete the call.
|
|
9167
|
+
4. If nothing else remains in the file, delete it and remove its entry from ${import_picocolors18.default.cyan("setupFiles")} in your Vitest config.
|
|
9168
|
+
5. If the file is shared with a Vitest project that uses portable stories directly, list it only in that project's ${import_picocolors18.default.cyan("setupFiles")}.
|
|
9126
9169
|
|
|
9127
9170
|
Read more: ${this.link}
|
|
9128
9171
|
`
|
|
@@ -9494,12 +9537,15 @@ var allFixes = [
|
|
|
9494
9537
|
csfNextMockedArgs,
|
|
9495
9538
|
removeExperimentalReview,
|
|
9496
9539
|
removeChangeDetectionFlag,
|
|
9540
|
+
removeLegacyFeatureFlags,
|
|
9497
9541
|
skills,
|
|
9498
|
-
docgenServer
|
|
9542
|
+
docgenServer,
|
|
9543
|
+
typescriptDependency,
|
|
9544
|
+
typescriptCompilerApi
|
|
9499
9545
|
], commandFixes = [csfFactories];
|
|
9500
9546
|
|
|
9501
9547
|
// src/automigrate/helpers/logMigrationSummary.ts
|
|
9502
|
-
var
|
|
9548
|
+
var import_picocolors19 = __toESM(require_picocolors(), 1);
|
|
9503
9549
|
import { CLI_COLORS as CLI_COLORS2, logger as logger18 } from "storybook/internal/node-logger";
|
|
9504
9550
|
import { dedent as dedent13 } from "ts-dedent";
|
|
9505
9551
|
var messageDivider2 = `
|
|
@@ -9511,19 +9557,19 @@ var messageDivider2 = `
|
|
|
9511
9557
|
`;
|
|
9512
9558
|
function getGlossaryMessages(fixSummary, fixResults, dryRun) {
|
|
9513
9559
|
let messages2 = [];
|
|
9514
|
-
return fixSummary.succeeded.length > 0 && (messages2.push(
|
|
9515
|
-
Object.entries(fixSummary.failed).map(([id, error]) => `${
|
|
9560
|
+
return fixSummary.succeeded.length > 0 && (messages2.push(import_picocolors19.default.bold("Successful migrations:")), messages2.push(fixSummary.succeeded.map((m) => import_picocolors19.default.green(m)).join(", "))), Object.keys(fixSummary.failed).length > 0 && (messages2.push(import_picocolors19.default.bold("Failed migrations:")), messages2.push(
|
|
9561
|
+
Object.entries(fixSummary.failed).map(([id, error]) => `${import_picocolors19.default.bold(import_picocolors19.default.red(id))}:
|
|
9516
9562
|
${error}`).join(`
|
|
9517
9563
|
`)
|
|
9518
|
-
)), fixSummary.manual.length > 0 && (messages2.push(
|
|
9564
|
+
)), fixSummary.manual.length > 0 && (messages2.push(import_picocolors19.default.bold("Manual migrations:")), messages2.push(
|
|
9519
9565
|
fixSummary.manual.map(
|
|
9520
|
-
(m) => fixResults[m] === "manual_succeeded" /* MANUAL_SUCCEEDED */ ?
|
|
9566
|
+
(m) => fixResults[m] === "manual_succeeded" /* MANUAL_SUCCEEDED */ ? import_picocolors19.default.green(m) : import_picocolors19.default.blue(m)
|
|
9521
9567
|
).join(", ")
|
|
9522
9568
|
)), fixSummary.skipped.length > 0 && (messages2.push(
|
|
9523
|
-
|
|
9569
|
+
import_picocolors19.default.bold(
|
|
9524
9570
|
dryRun ? "Migrations that a run would apply (dry run, no files changed):" : "Skipped migrations:"
|
|
9525
9571
|
)
|
|
9526
|
-
), messages2.push(fixSummary.skipped.map((m) =>
|
|
9572
|
+
), messages2.push(fixSummary.skipped.map((m) => import_picocolors19.default.cyan(m)).join(", "))), messages2;
|
|
9527
9573
|
}
|
|
9528
9574
|
function logMigrationSummary({
|
|
9529
9575
|
fixResults,
|
|
@@ -9533,7 +9579,7 @@ function logMigrationSummary({
|
|
|
9533
9579
|
}) {
|
|
9534
9580
|
let messages2 = [];
|
|
9535
9581
|
messages2.push(getGlossaryMessages(fixSummary, fixResults, dryRun).join(messageDivider2)), messages2.push(dedent13`If you'd like to run the migrations again, you can do so by running
|
|
9536
|
-
${
|
|
9582
|
+
${import_picocolors19.default.cyan("npx storybook automigrate")}
|
|
9537
9583
|
|
|
9538
9584
|
The automigrations try to migrate common patterns in your project, but might not contain everything needed to migrate to the latest version of Storybook.
|
|
9539
9585
|
|
|
@@ -9551,7 +9597,7 @@ function logMigrationSummary({
|
|
|
9551
9597
|
|
|
9552
9598
|
// src/automigrate/index.ts
|
|
9553
9599
|
var logAvailableMigrations = () => {
|
|
9554
|
-
let availableFixes = [...allFixes, ...commandFixes].map((f) =>
|
|
9600
|
+
let availableFixes = [...allFixes, ...commandFixes].map((f) => import_picocolors20.default.yellow(f.id)).map((x) => `- ${x}`).join(`
|
|
9555
9601
|
`);
|
|
9556
9602
|
logger19.log(dedent14`
|
|
9557
9603
|
The following migrations are available:
|
|
@@ -9598,8 +9644,8 @@ var logAvailableMigrations = () => {
|
|
|
9598
9644
|
})), outcome && !options.skipDoctor && await doctor({ configDir, packageManager: options.packageManager });
|
|
9599
9645
|
let failedMigrations = Object.entries(outcome?.fixResults ?? {}).filter(([, status]) => status === "failed" /* FAILED */ || status === "check_failed" /* CHECK_FAILED */).map(([id, status]) => {
|
|
9600
9646
|
let statusLabel = status === "check_failed" /* CHECK_FAILED */ ? "check failed" : "failed";
|
|
9601
|
-
return `${
|
|
9602
|
-
}), skippedFiles = [...Map.groupBy(outcome?.fileFailures ?? [], ({ fixId }) => fixId)].filter(([id]) => outcome?.fixResults[id] === "succeeded" /* SUCCEEDED */).map(([id, failures]) => `${
|
|
9647
|
+
return `${import_picocolors20.default.cyan(id)} (${statusLabel})`;
|
|
9648
|
+
}), skippedFiles = [...Map.groupBy(outcome?.fileFailures ?? [], ({ fixId }) => fixId)].filter(([id]) => outcome?.fixResults[id] === "succeeded" /* SUCCEEDED */).map(([id, failures]) => `${import_picocolors20.default.cyan(id)} (${pluralFiles(failures.length)} skipped)`);
|
|
9603
9649
|
if (failedMigrations.length > 0 || skippedFiles.length > 0)
|
|
9604
9650
|
throw new AutomigrateError({ errors: [...failedMigrations, ...skippedFiles] });
|
|
9605
9651
|
}, automigrate = async ({
|
|
@@ -9625,7 +9671,7 @@ var logAvailableMigrations = () => {
|
|
|
9625
9671
|
return logAvailableMigrations(), null;
|
|
9626
9672
|
let commandFix = commandFixes.find((f) => f.id === fixId);
|
|
9627
9673
|
if (commandFix)
|
|
9628
|
-
return logger19.step(`Running migration ${
|
|
9674
|
+
return logger19.step(`Running migration ${import_picocolors20.default.magenta(fixId)}..`), await commandFix.run({
|
|
9629
9675
|
mainConfigPath,
|
|
9630
9676
|
previewConfigPath,
|
|
9631
9677
|
packageManager,
|
|
@@ -9640,7 +9686,7 @@ var logAvailableMigrations = () => {
|
|
|
9640
9686
|
}), null;
|
|
9641
9687
|
let selectedFixes = inputFixes || allFixes.filter((fix) => !(fix.id === upgradeStorybookRelatedDependencies.id && isLatest === !1 && fixId !== upgradeStorybookRelatedDependencies.id)), fixes = fixId ? selectedFixes.filter((f) => f.id === fixId) : selectedFixes;
|
|
9642
9688
|
if (fixId && fixes.length === 0)
|
|
9643
|
-
return logger19.log(`\u{1F4ED} No migrations found for ${
|
|
9689
|
+
return logger19.log(`\u{1F4ED} No migrations found for ${import_picocolors20.default.magenta(fixId)}.`), logAvailableMigrations(), null;
|
|
9644
9690
|
logger19.step("Checking possible migrations..");
|
|
9645
9691
|
let { fixResults, fixSummary, preCheckFailure, addonsToPostinstall, fileFailures, verified } = await runFixes({
|
|
9646
9692
|
fixes,
|
|
@@ -9694,7 +9740,7 @@ async function runFixes({
|
|
|
9694
9740
|
for (let f of fixes) {
|
|
9695
9741
|
let check;
|
|
9696
9742
|
try {
|
|
9697
|
-
logger19.debug(`Running ${
|
|
9743
|
+
logger19.debug(`Running ${import_picocolors20.default.cyan(f.id)} migration checks`), check = await runCheck(f, {
|
|
9698
9744
|
packageManager,
|
|
9699
9745
|
configDir,
|
|
9700
9746
|
mainConfig,
|
|
@@ -9703,9 +9749,9 @@ async function runFixes({
|
|
|
9703
9749
|
mainConfigPath,
|
|
9704
9750
|
storiesPaths,
|
|
9705
9751
|
requested: fixId === f.id
|
|
9706
|
-
}), logger19.debug(`End of ${
|
|
9752
|
+
}), logger19.debug(`End of ${import_picocolors20.default.cyan(f.id)} migration checks`);
|
|
9707
9753
|
} catch (error) {
|
|
9708
|
-
logger19.warn(`\u26A0\uFE0F failed to check fix ${
|
|
9754
|
+
logger19.warn(`\u26A0\uFE0F failed to check fix ${import_picocolors20.default.bold(f.id)}`), error instanceof Error && (logger19.error(`
|
|
9709
9755
|
${error.stack}`), fixSummary.failed[f.id] = error.message), fixResults[f.id] = "check_failed" /* CHECK_FAILED */;
|
|
9710
9756
|
}
|
|
9711
9757
|
check?.result ? checked.push(check) : fixResults[f.id] = fixResults[f.id] || "unnecessary" /* UNNECESSARY */;
|
|
@@ -9716,7 +9762,7 @@ ${error.stack}`), fixSummary.failed[f.id] = error.message), fixResults[f.id] = "
|
|
|
9716
9762
|
let selected = [];
|
|
9717
9763
|
for (let check of applicable) {
|
|
9718
9764
|
let { fix: f, result } = check, promptType = typeof f.promptType == "function" ? await f.promptType(result) : f.promptType ?? "auto";
|
|
9719
|
-
logger19.log(`\u{1F50E} found a '${
|
|
9765
|
+
logger19.log(`\u{1F50E} found a '${import_picocolors20.default.cyan(f.id)}' migration:`);
|
|
9720
9766
|
let getTitle = () => {
|
|
9721
9767
|
switch (promptType) {
|
|
9722
9768
|
case "auto":
|
|
@@ -9727,7 +9773,7 @@ ${error.stack}`), fixSummary.failed[f.id] = error.message), fixResults[f.id] = "
|
|
|
9727
9773
|
return "Migration notification";
|
|
9728
9774
|
}
|
|
9729
9775
|
};
|
|
9730
|
-
logger19.step(`${getTitle()}: ${
|
|
9776
|
+
logger19.step(`${getTitle()}: ${import_picocolors20.default.cyan(f.id)}`), logger19.logBox(f.prompt(result));
|
|
9731
9777
|
let runAnswer;
|
|
9732
9778
|
try {
|
|
9733
9779
|
if (dryRun)
|
|
@@ -9755,7 +9801,7 @@ ${error.stack}`), fixSummary.failed[f.id] = error.message), fixResults[f.id] = "
|
|
|
9755
9801
|
}
|
|
9756
9802
|
} else promptType === "auto" ? runAnswer = { fix: yes ? !0 : await prompt5.confirm(
|
|
9757
9803
|
{
|
|
9758
|
-
message: `Do you want to run the '${
|
|
9804
|
+
message: `Do you want to run the '${import_picocolors20.default.cyan(f.id)}' migration on your project?`,
|
|
9759
9805
|
initialValue: f.defaultSelected ?? !0
|
|
9760
9806
|
},
|
|
9761
9807
|
{
|
|
@@ -9776,33 +9822,33 @@ ${error.stack}`), fixSummary.failed[f.id] = error.message), fixResults[f.id] = "
|
|
|
9776
9822
|
} catch {
|
|
9777
9823
|
break;
|
|
9778
9824
|
}
|
|
9779
|
-
promptType === "auto" && (invariant(runAnswer, "runAnswer must be defined if not promptOnly"), runAnswer.fix ? selected.push(check) : (fixResults[f.id] = "skipped" /* SKIPPED */, fixSummary.skipped.push(f.id), logger19.log(`Skipped ${
|
|
9825
|
+
promptType === "auto" && (invariant(runAnswer, "runAnswer must be defined if not promptOnly"), runAnswer.fix ? selected.push(check) : (fixResults[f.id] = "skipped" /* SKIPPED */, fixSummary.skipped.push(f.id), logger19.log(`Skipped ${import_picocolors20.default.cyan(f.id)} migration`)));
|
|
9780
9826
|
}
|
|
9781
9827
|
if (selected.length === 0)
|
|
9782
9828
|
return { fixResults, fixSummary, addonsToPostinstall, fileFailures, verified };
|
|
9783
9829
|
let taskLog = prompt5.taskLog({
|
|
9784
9830
|
id: "automigrate-run",
|
|
9785
|
-
title: selected.length === 1 ? `Running ${
|
|
9831
|
+
title: selected.length === 1 ? `Running ${import_picocolors20.default.cyan(selected[0].fix.id)} migration` : "Running automigrations"
|
|
9786
9832
|
}), outcomes = await applyFixes(
|
|
9787
9833
|
{ ...project, skipInstall, yes, addonsToPostinstall },
|
|
9788
9834
|
selected
|
|
9789
9835
|
);
|
|
9790
9836
|
for (let [fixId2, outcome] of outcomes) {
|
|
9791
9837
|
if (outcome.status === "skipped") {
|
|
9792
|
-
fixResults[fixId2] = "skipped" /* SKIPPED */, fixSummary.skipped.push(fixId2), taskLog.message(`Skipped ${
|
|
9838
|
+
fixResults[fixId2] = "skipped" /* SKIPPED */, fixSummary.skipped.push(fixId2), taskLog.message(`Skipped ${import_picocolors20.default.cyan(fixId2)} migration`);
|
|
9793
9839
|
continue;
|
|
9794
9840
|
}
|
|
9795
9841
|
if (fileFailures.push(...outcome.fileFailures.map((failure) => ({ ...failure, fixId: fixId2 }))), outcome.status === "failed")
|
|
9796
|
-
fixResults[fixId2] = "failed" /* FAILED */, fixSummary.failed[fixId2] = outcome.error instanceof Error ? outcome.error.message : "Failed to run migration", taskLog.message(`${logger19.SYMBOLS.error} ${
|
|
9842
|
+
fixResults[fixId2] = "failed" /* FAILED */, fixSummary.failed[fixId2] = outcome.error instanceof Error ? outcome.error.message : "Failed to run migration", taskLog.message(`${logger19.SYMBOLS.error} ${import_picocolors20.default.cyan(fixId2)}`);
|
|
9797
9843
|
else {
|
|
9798
9844
|
fixResults[fixId2] = "succeeded" /* SUCCEEDED */, fixSummary.succeeded.push(fixId2);
|
|
9799
9845
|
let skipped = outcome.fileFailures.length;
|
|
9800
9846
|
taskLog.message(
|
|
9801
|
-
`${logger19.SYMBOLS.success} ${
|
|
9847
|
+
`${logger19.SYMBOLS.success} ${import_picocolors20.default.cyan(fixId2)}${skipped > 0 ? ` (${pluralFiles(skipped)} skipped)` : ""}`
|
|
9802
9848
|
);
|
|
9803
9849
|
}
|
|
9804
9850
|
}
|
|
9805
|
-
let ran = selected.length === 1 ? `${
|
|
9851
|
+
let ran = selected.length === 1 ? `${import_picocolors20.default.cyan(selected[0].fix.id)} migration` : "automigrations";
|
|
9806
9852
|
return Object.values(fixResults).includes("failed" /* FAILED */) ? taskLog.error(selected.length === 1 ? `Could not run ${ran}` : "Some automigrations failed") : taskLog.success(`Ran ${ran}`), { fixResults, fixSummary, addonsToPostinstall, fileFailures, verified };
|
|
9807
9853
|
}
|
|
9808
9854
|
|
|
@@ -9825,6 +9871,10 @@ import { mkdir, readFile as readFile4, writeFile as writeFile4 } from "node:fs/p
|
|
|
9825
9871
|
import { basename as basename4, extname as extname3, join as join8 } from "node:path";
|
|
9826
9872
|
import { executeCommand } from "storybook/internal/common";
|
|
9827
9873
|
import { logger as logger20 } from "storybook/internal/node-logger";
|
|
9874
|
+
function isYarnBerryVersion(version2) {
|
|
9875
|
+
let major = Number.parseInt(version2, 10);
|
|
9876
|
+
return Number.isInteger(major) && major >= 2;
|
|
9877
|
+
}
|
|
9828
9878
|
var link = async ({ target, local, start }) => {
|
|
9829
9879
|
let storybookDir = process.cwd();
|
|
9830
9880
|
try {
|
|
@@ -9847,7 +9897,7 @@ var link = async ({ target, local, start }) => {
|
|
|
9847
9897
|
stdio: "pipe",
|
|
9848
9898
|
shell: !0
|
|
9849
9899
|
}).stdout.toString();
|
|
9850
|
-
if (
|
|
9900
|
+
if (!isYarnBerryVersion(version2)) {
|
|
9851
9901
|
logger20.warn(`\u{1F6A8} Expected yarn 2 or higher in ${reproDir}!`), logger20.warn(""), logger20.warn("Please set it up with `yarn set version berry`,"), logger20.warn(`then link '${reproDir}' with the '--local' flag.`);
|
|
9852
9902
|
return;
|
|
9853
9903
|
}
|
|
@@ -9901,7 +9951,7 @@ import {
|
|
|
9901
9951
|
versions as versions3
|
|
9902
9952
|
} from "storybook/internal/common";
|
|
9903
9953
|
import { logger as logger22, prompt as prompt6 } from "storybook/internal/node-logger";
|
|
9904
|
-
var
|
|
9954
|
+
var import_picocolors21 = __toESM(require_picocolors(), 1), import_semver11 = __toESM(require_semver(), 1);
|
|
9905
9955
|
import { dedent as dedent15 } from "ts-dedent";
|
|
9906
9956
|
|
|
9907
9957
|
// src/sandbox-templates.ts
|
|
@@ -10061,7 +10111,17 @@ var baseTemplates = {
|
|
|
10061
10111
|
},
|
|
10062
10112
|
modifications: {
|
|
10063
10113
|
useCsfFactory: !0,
|
|
10064
|
-
|
|
10114
|
+
// create-vite >= 9.3.3 scaffolds TypeScript 7.0, which Storybook's TS docgen cannot use
|
|
10115
|
+
// (TS 7.0 has no compiler API; #37004 supports 7.1+). Keep this pin until docgen supports
|
|
10116
|
+
// the TypeScript version that create-vite scaffolds (#36987, #37004). Overwrite the
|
|
10117
|
+
// scaffold's own devDependencies range; pinning via devDependencies avoids a conflicting
|
|
10118
|
+
// duplicate entry.
|
|
10119
|
+
extraDevDependencies: [
|
|
10120
|
+
"prop-types",
|
|
10121
|
+
"@types/prop-types",
|
|
10122
|
+
"@storybook/addon-mcp",
|
|
10123
|
+
"typescript@^6"
|
|
10124
|
+
],
|
|
10065
10125
|
editAddons: (addons) => [...addons, "@storybook/addon-mcp"],
|
|
10066
10126
|
mainConfig: {
|
|
10067
10127
|
features: {
|
|
@@ -10089,7 +10149,13 @@ var baseTemplates = {
|
|
|
10089
10149
|
modifications: {
|
|
10090
10150
|
useCsfFactory: !0,
|
|
10091
10151
|
extraDependencies: ["react@canary", "react-dom@canary"],
|
|
10092
|
-
extraDevDependencies: [
|
|
10152
|
+
extraDevDependencies: [
|
|
10153
|
+
"prop-types",
|
|
10154
|
+
"@types/react@latest",
|
|
10155
|
+
"@types/react-dom@latest",
|
|
10156
|
+
// See `react-vite/default-ts` for why TypeScript is pinned to 6.
|
|
10157
|
+
"typescript@^6"
|
|
10158
|
+
],
|
|
10093
10159
|
resolutions: {
|
|
10094
10160
|
"@types/react": "npm:@types/react@latest",
|
|
10095
10161
|
"@types/react-dom": "npm:@types/react-dom@latest",
|
|
@@ -10229,21 +10295,6 @@ var baseTemplates = {
|
|
|
10229
10295
|
},
|
|
10230
10296
|
skipTasks: ["bench"]
|
|
10231
10297
|
},
|
|
10232
|
-
"vue3-vite/default-js": {
|
|
10233
|
-
name: "Vue v3 (Vite | JavaScript)",
|
|
10234
|
-
script: "npm create vite --yes {{beforeDir}} -- --template vue",
|
|
10235
|
-
// vue-component-meta@^3.3.9 pins @vue/language-core; both are inside the age gate.
|
|
10236
|
-
minAgeGateExemptions: ["vue-component-meta", "@vue/language-core"],
|
|
10237
|
-
expected: {
|
|
10238
|
-
framework: "@storybook/vue3-vite",
|
|
10239
|
-
renderer: "@storybook/vue3",
|
|
10240
|
-
builder: "@storybook/builder-vite"
|
|
10241
|
-
},
|
|
10242
|
-
modifications: {
|
|
10243
|
-
useCsfFactory: !0
|
|
10244
|
-
},
|
|
10245
|
-
skipTasks: ["e2e-tests", "bench"]
|
|
10246
|
-
},
|
|
10247
10298
|
"vue3-vite/default-ts": {
|
|
10248
10299
|
name: "Vue v3 (Vite | TypeScript)",
|
|
10249
10300
|
script: "npm create vite --yes {{beforeDir}} -- --template vue-ts",
|
|
@@ -10310,19 +10361,6 @@ var baseTemplates = {
|
|
|
10310
10361
|
// },
|
|
10311
10362
|
// skipTasks: ['e2e-tests', 'bench', 'vitest-integration'],
|
|
10312
10363
|
// },
|
|
10313
|
-
"html-vite/default-js": {
|
|
10314
|
-
name: "HTML Latest (Vite | JavaScript)",
|
|
10315
|
-
script: 'npm create vite --yes {{beforeDir}} -- --template vanilla && cd {{beforeDir}} && echo "export default {}" > vite.config.js',
|
|
10316
|
-
expected: {
|
|
10317
|
-
framework: "@storybook/html-vite",
|
|
10318
|
-
renderer: "@storybook/html",
|
|
10319
|
-
builder: "@storybook/builder-vite"
|
|
10320
|
-
},
|
|
10321
|
-
skipTasks: ["e2e-tests", "bench"],
|
|
10322
|
-
initOptions: {
|
|
10323
|
-
type: "html" /* HTML */
|
|
10324
|
-
}
|
|
10325
|
-
},
|
|
10326
10364
|
"html-vite/default-ts": {
|
|
10327
10365
|
name: "HTML Latest (Vite | TypeScript)",
|
|
10328
10366
|
script: 'npm create vite --yes {{beforeDir}} -- --template vanilla-ts && cd {{beforeDir}} && echo "export default {}" > vite.config.js',
|
|
@@ -10352,19 +10390,6 @@ var baseTemplates = {
|
|
|
10352
10390
|
type: "html" /* HTML */
|
|
10353
10391
|
}
|
|
10354
10392
|
},
|
|
10355
|
-
"svelte-vite/default-js": {
|
|
10356
|
-
name: "Svelte Latest (Vite | JavaScript)",
|
|
10357
|
-
script: "npm create vite --yes {{beforeDir}} -- --template svelte",
|
|
10358
|
-
expected: {
|
|
10359
|
-
framework: "@storybook/svelte-vite",
|
|
10360
|
-
renderer: "@storybook/svelte",
|
|
10361
|
-
builder: "@storybook/builder-vite"
|
|
10362
|
-
},
|
|
10363
|
-
modifications: {
|
|
10364
|
-
useCsfFactory: !0
|
|
10365
|
-
},
|
|
10366
|
-
skipTasks: ["e2e-tests", "bench"]
|
|
10367
|
-
},
|
|
10368
10393
|
"svelte-vite/default-ts": {
|
|
10369
10394
|
name: "Svelte Latest (Vite | TypeScript)",
|
|
10370
10395
|
script: "npm create vite --yes {{beforeDir}} -- --template svelte-ts",
|
|
@@ -10374,7 +10399,8 @@ var baseTemplates = {
|
|
|
10374
10399
|
builder: "@storybook/builder-vite"
|
|
10375
10400
|
},
|
|
10376
10401
|
modifications: {
|
|
10377
|
-
useCsfFactory: !0
|
|
10402
|
+
useCsfFactory: !0,
|
|
10403
|
+
mainConfig: { features: { componentsManifest: !0 } }
|
|
10378
10404
|
},
|
|
10379
10405
|
// Remove smoke-test from the list once https://github.com/storybookjs/storybook/issues/19351 is fixed.
|
|
10380
10406
|
skipTasks: ["smoke-test", "bench"]
|
|
@@ -10401,9 +10427,6 @@ var baseTemplates = {
|
|
|
10401
10427
|
// the `^22` major `ng new` uses for the other @angular packages so every @angular/* aligns.
|
|
10402
10428
|
// Also, Angular 22 needs TypeScript 6 or more recent.
|
|
10403
10429
|
extraDependencies: ["@angular/forms@^22", "@angular/animations@^22", "typescript@^6"],
|
|
10404
|
-
resolutions: {
|
|
10405
|
-
webpack: "5.107.2"
|
|
10406
|
-
},
|
|
10407
10430
|
useCsfFactory: !0
|
|
10408
10431
|
},
|
|
10409
10432
|
extraCiSteps: {
|
|
@@ -10476,32 +10499,6 @@ var baseTemplates = {
|
|
|
10476
10499
|
skipTasks: ["bench"],
|
|
10477
10500
|
initOptions: { builder: "vite" /* VITE */ }
|
|
10478
10501
|
},
|
|
10479
|
-
"lit-vite/default-js": {
|
|
10480
|
-
name: "Lit Latest (Vite | JavaScript)",
|
|
10481
|
-
script: 'npm create vite --yes {{beforeDir}} -- --template lit && cd {{beforeDir}} && echo "export default {}" > vite.config.js',
|
|
10482
|
-
// TODO: remove after oct 21 2026
|
|
10483
|
-
minAgeGateExemptions: ["@wc-toolkit/*"],
|
|
10484
|
-
expected: {
|
|
10485
|
-
framework: "@storybook/web-components-vite",
|
|
10486
|
-
renderer: "@storybook/web-components",
|
|
10487
|
-
builder: "@storybook/builder-vite"
|
|
10488
|
-
},
|
|
10489
|
-
modifications: {
|
|
10490
|
-
useCsfFactory: !0,
|
|
10491
|
-
mainConfig: {
|
|
10492
|
-
framework: {
|
|
10493
|
-
name: "@storybook/web-components-vite",
|
|
10494
|
-
options: {
|
|
10495
|
-
customElementsManifest: [
|
|
10496
|
-
"../src/stories/renderers/web-components/custom-elements.json"
|
|
10497
|
-
]
|
|
10498
|
-
}
|
|
10499
|
-
}
|
|
10500
|
-
}
|
|
10501
|
-
},
|
|
10502
|
-
// Remove smoke-test from the list once https://github.com/storybookjs/storybook/issues/19351 is fixed.
|
|
10503
|
-
skipTasks: ["smoke-test", "e2e-tests", "bench"]
|
|
10504
|
-
},
|
|
10505
10502
|
"lit-vite/default-ts": {
|
|
10506
10503
|
name: "Lit Latest (Vite | TypeScript)",
|
|
10507
10504
|
script: 'npm create vite --yes {{beforeDir}} -- --template lit-ts && cd {{beforeDir}} && echo "export default {}" > vite.config.js',
|
|
@@ -10547,9 +10544,9 @@ var baseTemplates = {
|
|
|
10547
10544
|
},
|
|
10548
10545
|
skipTasks: ["e2e-tests", "e2e-tests-dev", "bench", "vitest-integration"]
|
|
10549
10546
|
},
|
|
10550
|
-
"preact-vite/default-
|
|
10551
|
-
name: "Preact Latest (Vite |
|
|
10552
|
-
script: "npm create vite --yes {{beforeDir}} -- --template preact",
|
|
10547
|
+
"preact-vite/default-ts": {
|
|
10548
|
+
name: "Preact Latest (Vite | TypeScript)",
|
|
10549
|
+
script: "npm create vite --yes {{beforeDir}} -- --template preact-ts",
|
|
10553
10550
|
preferNoLink: !0,
|
|
10554
10551
|
expected: {
|
|
10555
10552
|
framework: "@storybook/preact-vite",
|
|
@@ -10565,8 +10562,8 @@ var baseTemplates = {
|
|
|
10565
10562
|
},
|
|
10566
10563
|
skipTasks: ["e2e-tests", "bench"]
|
|
10567
10564
|
},
|
|
10568
|
-
"preact-vite/
|
|
10569
|
-
name: "Preact
|
|
10565
|
+
"preact-vite/10-ts": {
|
|
10566
|
+
name: "Preact v10 (Vite | TypeScript)",
|
|
10570
10567
|
script: "npm create vite --yes {{beforeDir}} -- --template preact-ts",
|
|
10571
10568
|
preferNoLink: !0,
|
|
10572
10569
|
expected: {
|
|
@@ -10575,10 +10572,9 @@ var baseTemplates = {
|
|
|
10575
10572
|
builder: "@storybook/builder-vite"
|
|
10576
10573
|
},
|
|
10577
10574
|
modifications: {
|
|
10578
|
-
|
|
10579
|
-
extraDependencies: ["preact-render-to-string", "preact@^11"],
|
|
10575
|
+
extraDependencies: ["preact-render-to-string", "preact@^10"],
|
|
10580
10576
|
resolutions: {
|
|
10581
|
-
preact: "npm:preact@^
|
|
10577
|
+
preact: "npm:preact@^10"
|
|
10582
10578
|
}
|
|
10583
10579
|
},
|
|
10584
10580
|
skipTasks: ["e2e-tests", "bench"]
|
|
@@ -10597,26 +10593,6 @@ var baseTemplates = {
|
|
|
10597
10593
|
// // TODO: The community template does not provide standard stories, which is required for e2e tests.
|
|
10598
10594
|
// skipTasks: ['e2e-tests-dev', 'e2e-tests', 'bench', 'vitest-integration', 'chromatic'],
|
|
10599
10595
|
// },
|
|
10600
|
-
"ember/3-js": {
|
|
10601
|
-
name: "Ember v3 (Webpack | JavaScript)",
|
|
10602
|
-
script: "npx --package ember-cli@3.28.1 ember new {{beforeDir}} --skip-install",
|
|
10603
|
-
inDevelopment: !0,
|
|
10604
|
-
expected: {
|
|
10605
|
-
framework: "@storybook/ember",
|
|
10606
|
-
renderer: "@storybook/ember",
|
|
10607
|
-
builder: "@storybook/builder-webpack5"
|
|
10608
|
-
}
|
|
10609
|
-
},
|
|
10610
|
-
"ember/default-js": {
|
|
10611
|
-
name: "Ember v4 (Webpack | JavaScript)",
|
|
10612
|
-
script: "npx --package ember-cli@4.12.1 ember new {{beforeDir}} --yarn && cd {{beforeDir}} && yarn add --dev @storybook/ember-cli-storybook && yarn build",
|
|
10613
|
-
inDevelopment: !0,
|
|
10614
|
-
expected: {
|
|
10615
|
-
framework: "@storybook/ember",
|
|
10616
|
-
renderer: "@storybook/ember",
|
|
10617
|
-
builder: "@storybook/builder-webpack5"
|
|
10618
|
-
}
|
|
10619
|
-
},
|
|
10620
10596
|
"react-native-web-vite/expo-ts": {
|
|
10621
10597
|
// NOTE: create-expo-app installs React 18.2.0. But yarn portal
|
|
10622
10598
|
// expects 18.3.1 (dunno why). Therefore to run this in dev you
|
|
@@ -10628,19 +10604,6 @@ var baseTemplates = {
|
|
|
10628
10604
|
// yarn portals.
|
|
10629
10605
|
name: "React Native Expo Latest (Vite | TypeScript)",
|
|
10630
10606
|
script: "npx create-expo-app -y --no-install {{beforeDir}}",
|
|
10631
|
-
// create-expo-app pins the current SDK, whose packages are released
|
|
10632
|
-
// together and are routinely younger than the gate window.
|
|
10633
|
-
// `babel-preset-expo` is part of that set despite not matching `expo-*`.
|
|
10634
|
-
// `multitars` is pulled in transitively by the Expo CLI toolchain.
|
|
10635
|
-
minAgeGateExemptions: [
|
|
10636
|
-
"expo",
|
|
10637
|
-
"expo-*",
|
|
10638
|
-
"@expo/*",
|
|
10639
|
-
"babel-preset-expo",
|
|
10640
|
-
"multitars",
|
|
10641
|
-
"react-native",
|
|
10642
|
-
"@react-native/*"
|
|
10643
|
-
],
|
|
10644
10607
|
expected: {
|
|
10645
10608
|
framework: "@storybook/react-native-web-vite",
|
|
10646
10609
|
renderer: "@storybook/react",
|
|
@@ -10738,7 +10701,10 @@ var baseTemplates = {
|
|
|
10738
10701
|
isInternal: !0,
|
|
10739
10702
|
modifications: {
|
|
10740
10703
|
skipTemplateStories: !0,
|
|
10741
|
-
skipMocking: !0
|
|
10704
|
+
skipMocking: !0,
|
|
10705
|
+
// This modifications block replaces the base template's, so the pin must be repeated here.
|
|
10706
|
+
// See `react-vite/default-ts` for why TypeScript is pinned to 6.
|
|
10707
|
+
extraDevDependencies: ["typescript@^6"]
|
|
10742
10708
|
},
|
|
10743
10709
|
skipTasks: ["e2e-tests", "e2e-tests-dev", "chromatic", "vitest-integration"],
|
|
10744
10710
|
typeCheck: !1
|
|
@@ -10760,7 +10726,10 @@ var baseTemplates = {
|
|
|
10760
10726
|
modifications: {
|
|
10761
10727
|
skipTemplateStories: !0,
|
|
10762
10728
|
disableDocs: !0,
|
|
10763
|
-
skipMocking: !0
|
|
10729
|
+
skipMocking: !0,
|
|
10730
|
+
// This modifications block replaces the base template's, so the pin must be repeated here.
|
|
10731
|
+
// See `react-vite/default-ts` for why TypeScript is pinned to 6.
|
|
10732
|
+
extraDevDependencies: ["typescript@^6"]
|
|
10764
10733
|
},
|
|
10765
10734
|
skipTasks: ["e2e-tests", "e2e-tests-dev", "chromatic", "vitest-integration"],
|
|
10766
10735
|
typeCheck: !1
|
|
@@ -10772,7 +10741,10 @@ var baseTemplates = {
|
|
|
10772
10741
|
modifications: {
|
|
10773
10742
|
skipTemplateStories: !0,
|
|
10774
10743
|
testBuild: !0,
|
|
10775
|
-
skipMocking: !0
|
|
10744
|
+
skipMocking: !0,
|
|
10745
|
+
// This modifications block replaces the base template's, so the pin must be repeated here.
|
|
10746
|
+
// See `react-vite/default-ts` for why TypeScript is pinned to 6.
|
|
10747
|
+
extraDevDependencies: ["typescript@^6"]
|
|
10776
10748
|
},
|
|
10777
10749
|
skipTasks: ["e2e-tests", "e2e-tests-dev", "vitest-integration"],
|
|
10778
10750
|
typeCheck: !1
|
|
@@ -10808,7 +10780,6 @@ var baseTemplates = {
|
|
|
10808
10780
|
"bench/react-vite-default-ts-nodocs",
|
|
10809
10781
|
"bench/react-vite-default-ts-test-build",
|
|
10810
10782
|
"bench/react-webpack-18-ts-test-build",
|
|
10811
|
-
// 'ember/default-js',
|
|
10812
10783
|
// Disabled in CI: the published storybook-builder-rsbuild imports `babelParser` from
|
|
10813
10784
|
// `storybook/internal/mocking-utils`, which Storybook 11 removed, so the sandbox cannot be
|
|
10814
10785
|
// created. Fix: https://github.com/rstackjs/storybook-rsbuild/pull/603
|
|
@@ -10816,33 +10787,27 @@ var baseTemplates = {
|
|
|
10816
10787
|
// 'react-rsbuild/default-ts',
|
|
10817
10788
|
"tanstack-react-router/default-ts",
|
|
10818
10789
|
"tanstack-react-start/default-ts"
|
|
10819
|
-
],
|
|
10790
|
+
], daily = [
|
|
10820
10791
|
...normal,
|
|
10821
10792
|
"react-webpack/18-ts",
|
|
10822
10793
|
"nextjs/15-ts",
|
|
10823
10794
|
"nextjs-vite/15-ts",
|
|
10824
10795
|
"preact-vite/default-ts",
|
|
10825
10796
|
"html-vite/default-ts",
|
|
10826
|
-
"solid-vite/default-ts"
|
|
10797
|
+
"solid-vite/default-ts",
|
|
10827
10798
|
// Disabled in CI: the published storybook-builder-rsbuild imports `babelParser` from
|
|
10828
10799
|
// `storybook/internal/mocking-utils`, which Storybook 11 removed, so the sandbox cannot be
|
|
10829
10800
|
// created. Fix: https://github.com/rstackjs/storybook-rsbuild/pull/603
|
|
10830
10801
|
// Re-enable once storybook-builder-rsbuild releases a version that works with Storybook 11.
|
|
10831
10802
|
// 'vue3-rsbuild/default-ts',
|
|
10832
|
-
], daily = [
|
|
10833
|
-
...merged,
|
|
10834
10803
|
"angular-vite/21-ts",
|
|
10835
10804
|
"react-vite/default-js",
|
|
10836
10805
|
"react-vite/prerelease-ts",
|
|
10837
10806
|
"react-webpack/prerelease-ts",
|
|
10838
|
-
"vue3-vite/default-js",
|
|
10839
10807
|
"vue3-vite/prerelease-ts",
|
|
10840
|
-
"lit-vite/default-js",
|
|
10841
|
-
"svelte-vite/default-js",
|
|
10842
10808
|
"nextjs/prerelease",
|
|
10843
10809
|
// 'qwik-vite/default-ts',
|
|
10844
|
-
"preact-vite/
|
|
10845
|
-
"html-vite/default-js",
|
|
10810
|
+
"preact-vite/10-ts",
|
|
10846
10811
|
"internal/react18-webpack-babel",
|
|
10847
10812
|
"react-native-web-vite/expo-ts"
|
|
10848
10813
|
// Disabled in CI: the published storybook-builder-rsbuild imports `babelParser` from
|
|
@@ -10863,19 +10828,19 @@ var toChoices = (c) => ({ label: allTemplates[c].name, value: c }), sandbox = as
|
|
|
10863
10828
|
}) => {
|
|
10864
10829
|
let selectedConfig = allTemplates[filterValue], templateId = selectedConfig ? filterValue : null, packageManager = JsPackageManagerFactory.getPackageManager({
|
|
10865
10830
|
force: PackageManagerName.NPM
|
|
10866
|
-
}), latestVersion = await packageManager.latestVersion("storybook"), nextVersion = await packageManager.latestVersion("storybook@next") ?? "0.0.0", currentVersion = versions3.storybook, isPrerelease = (0,
|
|
10867
|
-
welcome: `Creating a Storybook ${
|
|
10868
|
-
notLatest:
|
|
10869
|
-
This version is behind the latest release, which is: ${
|
|
10831
|
+
}), latestVersion = await packageManager.latestVersion("storybook"), nextVersion = await packageManager.latestVersion("storybook@next") ?? "0.0.0", currentVersion = versions3.storybook, isPrerelease = (0, import_semver11.prerelease)(currentVersion), isOutdated = (0, import_semver11.lt)(currentVersion, isPrerelease ? nextVersion : latestVersion), downloadType = !isOutdated && init ? "after-storybook" : "before-storybook", branch = isPrerelease ? "next" : "main", messages2 = {
|
|
10832
|
+
welcome: `Creating a Storybook ${import_picocolors21.default.bold(currentVersion)} sandbox..`,
|
|
10833
|
+
notLatest: import_picocolors21.default.red(dedent15`
|
|
10834
|
+
This version is behind the latest release, which is: ${import_picocolors21.default.bold(latestVersion)}!
|
|
10870
10835
|
You likely ran the init command through npx, which can use a locally cached version, to get the latest please run:
|
|
10871
|
-
${
|
|
10836
|
+
${import_picocolors21.default.bold("npx storybook@latest sandbox")}
|
|
10872
10837
|
|
|
10873
10838
|
You may want to CTRL+C to stop, and run with the latest version instead.
|
|
10874
10839
|
`),
|
|
10875
|
-
longInitTime:
|
|
10840
|
+
longInitTime: import_picocolors21.default.yellow(
|
|
10876
10841
|
"The creation of the sandbox will take longer, because we will need to run init."
|
|
10877
10842
|
),
|
|
10878
|
-
prerelease:
|
|
10843
|
+
prerelease: import_picocolors21.default.yellow("This is a pre-release version.")
|
|
10879
10844
|
};
|
|
10880
10845
|
if (logger22.logBox(
|
|
10881
10846
|
[messages2.welcome].concat(isOutdated && !isPrerelease ? [messages2.notLatest] : []).concat(init && (isOutdated || isPrerelease) ? [messages2.longInitTime] : []).concat(isPrerelease ? [messages2.prerelease] : []).join(`
|
|
@@ -10892,20 +10857,20 @@ var toChoices = (c) => ({ label: allTemplates[c].name, value: c }), sandbox = as
|
|
|
10892
10857
|
dedent15`
|
|
10893
10858
|
🔎 You filtered out all templates. 🔍
|
|
10894
10859
|
|
|
10895
|
-
After filtering all the templates with "${
|
|
10860
|
+
After filtering all the templates with "${import_picocolors21.default.yellow(
|
|
10896
10861
|
filterValue
|
|
10897
10862
|
)}", we found no results. Please try again with a different filter.
|
|
10898
10863
|
|
|
10899
10864
|
Available templates:
|
|
10900
|
-
${keys.map((key) =>
|
|
10865
|
+
${keys.map((key) => import_picocolors21.default.blue(`- ${key}`)).join(`
|
|
10901
10866
|
`)}
|
|
10902
10867
|
`.trim(),
|
|
10903
10868
|
{ borderStyle: "round", padding: 1, borderColor: "#F1618C" }
|
|
10904
10869
|
), process.exit(1)), choices.length === 1 ? [templateId] = choices : (logger22.logBox(
|
|
10905
10870
|
dedent15`
|
|
10906
|
-
🤗 Welcome to ${
|
|
10871
|
+
🤗 Welcome to ${import_picocolors21.default.yellow("sb sandbox")}! 🤗
|
|
10907
10872
|
|
|
10908
|
-
Create a ${
|
|
10873
|
+
Create a ${import_picocolors21.default.green("new project")} to minimally reproduce Storybook issues.
|
|
10909
10874
|
|
|
10910
10875
|
1. select an environment that most closely matches your project setup.
|
|
10911
10876
|
2. select a location for the reproduction, outside of your project.
|
|
@@ -10935,15 +10900,15 @@ var toChoices = (c) => ({ label: allTemplates[c].name, value: c }), sandbox = as
|
|
|
10935
10900
|
)), invariant(selectedDirectory);
|
|
10936
10901
|
try {
|
|
10937
10902
|
let templateDestination = isAbsolute3(selectedDirectory) ? selectedDirectory : join4(process.cwd(), selectedDirectory);
|
|
10938
|
-
logger22.log(`\u{1F3C3} Adding ${selectedConfig.name} into ${templateDestination}`), logger22.log(`\u{1F4E6} Downloading sandbox template (${
|
|
10903
|
+
logger22.log(`\u{1F3C3} Adding ${selectedConfig.name} into ${templateDestination}`), logger22.log(`\u{1F4E6} Downloading sandbox template (${import_picocolors21.default.bold(downloadType)})...`);
|
|
10939
10904
|
try {
|
|
10940
10905
|
let gitPath = `storybookjs/sandboxes/tree/${branch}/${templateId}/${downloadType}`;
|
|
10941
10906
|
if (await mkdir2(templateDestination, { recursive: !0 }), (0, import_cross_spawn2.sync)("npx", ["gitpick@4.12.4", gitPath, templateDestination, "-o"], {
|
|
10942
10907
|
stdio: "inherit"
|
|
10943
10908
|
}), (await readdir(templateDestination)).length === 0) {
|
|
10944
|
-
let selected =
|
|
10909
|
+
let selected = import_picocolors21.default.yellow(templateId);
|
|
10945
10910
|
throw new Error(dedent15`
|
|
10946
|
-
Template downloaded from ${
|
|
10911
|
+
Template downloaded from ${import_picocolors21.default.blue(gitPath)} is empty.
|
|
10947
10912
|
Are you use it exists? Or did you want to set ${selected} to inDevelopment first?
|
|
10948
10913
|
`);
|
|
10949
10914
|
}
|
|
@@ -10961,20 +10926,20 @@ var toChoices = (c) => ({ label: allTemplates[c].name, value: c }), sandbox = as
|
|
|
10961
10926
|
} catch (err) {
|
|
10962
10927
|
throw logger22.error(`\u{1F6A8} Failed to download sandbox template: ${String(err)}`), err;
|
|
10963
10928
|
}
|
|
10964
|
-
let initMessage = init ?
|
|
10929
|
+
let initMessage = init ? import_picocolors21.default.yellow(dedent15`
|
|
10965
10930
|
yarn install
|
|
10966
10931
|
yarn storybook
|
|
10967
|
-
`) : `Recreate your setup, then ${
|
|
10932
|
+
`) : `Recreate your setup, then ${import_picocolors21.default.yellow("npx storybook@latest init")}`;
|
|
10968
10933
|
logger22.logBox(
|
|
10969
10934
|
dedent15`
|
|
10970
10935
|
🎉 Your Storybook reproduction project is ready to use! 🎉
|
|
10971
10936
|
|
|
10972
|
-
${
|
|
10937
|
+
${import_picocolors21.default.yellow(`cd ${selectedDirectory}`)}
|
|
10973
10938
|
${initMessage}
|
|
10974
10939
|
|
|
10975
10940
|
Once you've recreated the problem you're experiencing, please:
|
|
10976
10941
|
|
|
10977
|
-
1. Document any additional steps in ${
|
|
10942
|
+
1. Document any additional steps in ${import_picocolors21.default.cyan("README.md")}
|
|
10978
10943
|
2. Publish the repository to github
|
|
10979
10944
|
3. Link to the repro repository in your issue
|
|
10980
10945
|
|
|
@@ -10994,7 +10959,7 @@ async function promptSelectedTemplate(choices) {
|
|
|
10994
10959
|
}
|
|
10995
10960
|
|
|
10996
10961
|
// src/upgrade.ts
|
|
10997
|
-
var import_cross_spawn3 = __toESM(require_cross_spawn(), 1),
|
|
10962
|
+
var import_cross_spawn3 = __toESM(require_cross_spawn(), 1), import_picocolors22 = __toESM(require_picocolors(), 1), import_semver12 = __toESM(require_semver(), 1);
|
|
10998
10963
|
import {
|
|
10999
10964
|
hasStorybookSkills as hasStorybookSkills2,
|
|
11000
10965
|
installSkills as installSkills2,
|
|
@@ -11006,6 +10971,7 @@ import {
|
|
|
11006
10971
|
JsPackageManagerFactory as JsPackageManagerFactory2,
|
|
11007
10972
|
isCI as isCI3,
|
|
11008
10973
|
isCorePackage as isCorePackage2,
|
|
10974
|
+
isNpmPeerResolutionError,
|
|
11009
10975
|
resolveStorybookVersionSpecifier,
|
|
11010
10976
|
getProcessAncestry
|
|
11011
10977
|
} from "storybook/internal/common";
|
|
@@ -11361,7 +11327,7 @@ ${projectList}`);
|
|
|
11361
11327
|
}
|
|
11362
11328
|
} else
|
|
11363
11329
|
Object.values(doctorResults).every((result) => result.status === "healthy") ? logger24.step(`${CLI_COLORS4.success("Your project(s) have been upgraded successfully! \u{1F389}")}`) : logger24.step(
|
|
11364
|
-
`${
|
|
11330
|
+
`${import_picocolors22.default.yellow("Your project(s) have been upgraded successfully, but some issues were found which need your attention, please check Storybook doctor logs above.")}`
|
|
11365
11331
|
);
|
|
11366
11332
|
let automigrationLinks = detectedAutomigrations.filter(
|
|
11367
11333
|
(am) => Object.entries(projectResults).some(
|
|
@@ -11421,9 +11387,9 @@ async function upgrade(options) {
|
|
|
11421
11387
|
return;
|
|
11422
11388
|
let { allProjects, selectedProjects: storybookProjects } = projectsResult;
|
|
11423
11389
|
storybookProjects.length > 1 ? logger24.info(`Upgrading the following projects:
|
|
11424
|
-
${storybookProjects.map((p) => `${
|
|
11390
|
+
${storybookProjects.map((p) => `${import_picocolors22.default.cyan(shortenPath(p.configDir))}: ${import_picocolors22.default.bold(p.beforeVersion)} -> ${import_picocolors22.default.bold(p.currentCLIVersion)}`).join(`
|
|
11425
11391
|
`)}`) : logger24.info(
|
|
11426
|
-
`Upgrading from ${
|
|
11392
|
+
`Upgrading from ${import_picocolors22.default.bold(storybookProjects[0].beforeVersion)} to ${import_picocolors22.default.bold(storybookProjects[0].currentCLIVersion)}`
|
|
11427
11393
|
);
|
|
11428
11394
|
let automigrationResults = {}, doctorResults = {}, handleInterruption = async () => {
|
|
11429
11395
|
throw logger24.log(`
|
|
@@ -11443,7 +11409,7 @@ Upgrade interrupted by user.`), allProjects.length > 1 && await sendMultiUpgrade
|
|
|
11443
11409
|
}))
|
|
11444
11410
|
throw new HandledError5("Blockers detected");
|
|
11445
11411
|
if (storybookProjects.some((project) => {
|
|
11446
|
-
if (!project.isCanary && (0,
|
|
11412
|
+
if (!project.isCanary && (0, import_semver12.lt)(project.currentCLIVersion, project.beforeVersion))
|
|
11447
11413
|
throw new UpgradeStorybookToLowerVersionError({
|
|
11448
11414
|
beforeVersion: project.beforeVersion,
|
|
11449
11415
|
currentVersion: project.currentCLIVersion
|
|
@@ -11496,12 +11462,18 @@ Upgrade interrupted by user.`), allProjects.length > 1 && await sendMultiUpgrade
|
|
|
11496
11462
|
options
|
|
11497
11463
|
);
|
|
11498
11464
|
let rootPackageManager = storybookProjects.length > 1 ? JsPackageManagerFactory2.getPackageManager({ force: options.packageManager }) : storybookProjects[0].packageManager;
|
|
11499
|
-
if (
|
|
11465
|
+
if (await withNpmForceFallback(
|
|
11466
|
+
rootPackageManager,
|
|
11467
|
+
(installOptions) => rootPackageManager.installDependencies(installOptions)
|
|
11468
|
+
), rootPackageManager.type !== PackageManagerName2.YARN1 && rootPackageManager.isStorybookInMonorepo() && (logger24.warn(
|
|
11500
11469
|
"Since you are in a monorepo, we advise you to deduplicate your dependencies. We can do this for you but it might take some time."
|
|
11501
11470
|
), options.yes || await prompt8.confirm({
|
|
11502
11471
|
message: `Execute ${rootPackageManager.getRunCommand("dedupe")}?`,
|
|
11503
11472
|
initialValue: !0
|
|
11504
|
-
}) ?
|
|
11473
|
+
}) ? await withNpmForceFallback(
|
|
11474
|
+
rootPackageManager,
|
|
11475
|
+
(dedupeOptions) => rootPackageManager.dedupeDependencies(dedupeOptions)
|
|
11476
|
+
) : logger24.log(
|
|
11505
11477
|
`If you find any issues running Storybook, you can run ${rootPackageManager.getRunCommand("dedupe")} manually to deduplicate your dependencies and try again.`
|
|
11506
11478
|
)), !options.dryRun && !options.skipInstall)
|
|
11507
11479
|
for (let project of storybookProjects) {
|
|
@@ -11569,6 +11541,19 @@ Upgrade interrupted by user.`), allProjects.length > 1 && await sendMultiUpgrade
|
|
|
11569
11541
|
process.removeListener("SIGINT", handleInterruption), process.removeListener("SIGTERM", handleInterruption);
|
|
11570
11542
|
}
|
|
11571
11543
|
}
|
|
11544
|
+
var withNpmForceFallback = async (packageManager, operation) => {
|
|
11545
|
+
try {
|
|
11546
|
+
await operation();
|
|
11547
|
+
} catch (error) {
|
|
11548
|
+
if (error instanceof HandledError5 || packageManager.type !== PackageManagerName2.NPM || !isNpmPeerResolutionError(error))
|
|
11549
|
+
throw error;
|
|
11550
|
+
try {
|
|
11551
|
+
logger24.warn("Peer dependency conflict detected; retrying with --legacy-peer-deps"), await operation({ legacyPeerDeps: !0 });
|
|
11552
|
+
} catch {
|
|
11553
|
+
logger24.warn("Retry with --legacy-peer-deps failed; retrying with --force"), await operation({ force: !0 });
|
|
11554
|
+
}
|
|
11555
|
+
}
|
|
11556
|
+
};
|
|
11572
11557
|
|
|
11573
11558
|
// src/bin/run.ts
|
|
11574
11559
|
addToGlobalContext("cliVersion", versions4.storybook);
|
|
@@ -11606,7 +11591,10 @@ var handleCommandFailure = (logFilePath) => async (error) => {
|
|
|
11606
11591
|
logger25.outro(CLI_COLORS5.success("Done!"));
|
|
11607
11592
|
}
|
|
11608
11593
|
});
|
|
11609
|
-
command("init").description("Initialize Storybook into your project").option("-f --force", "Force add Storybook").option("-s --skip-install", "Skip installing deps").
|
|
11594
|
+
command("init").description("Initialize Storybook into your project").option("-f --force", "Force add Storybook").option("-s --skip-install", "Skip installing deps").option(
|
|
11595
|
+
"--install-typescript",
|
|
11596
|
+
"Add TypeScript, which docgen needs, when the project has none, without asking"
|
|
11597
|
+
).option("--no-install-typescript", "Do not add TypeScript when the project has none").addOption(
|
|
11610
11598
|
new Option("--package-manager <type>", "Force package manager for installing deps").choices(
|
|
11611
11599
|
Object.values(PackageManagerName3)
|
|
11612
11600
|
)
|
|
@@ -11671,7 +11659,7 @@ command("upgrade").description(`Upgrade your Storybook packages to v${versions4.
|
|
|
11671
11659
|
).catch(handleCommandFailure(options.logfile));
|
|
11672
11660
|
});
|
|
11673
11661
|
command("info").description("Prints debugging information about the local environment").action(async () => {
|
|
11674
|
-
logger25.log(
|
|
11662
|
+
logger25.log(import_picocolors23.default.bold(`
|
|
11675
11663
|
Storybook Environment Info:`));
|
|
11676
11664
|
let activePackageManager = JsPackageManagerFactory3.getPackageManager().type.replace(/\d/, ""), output = await import_envinfo.default.run({
|
|
11677
11665
|
System: ["OS", "CPU", "Shell"],
|
|
@@ -11683,7 +11671,7 @@ Storybook Environment Info:`));
|
|
|
11683
11671
|
logger25.log(
|
|
11684
11672
|
output.replace(
|
|
11685
11673
|
activePackageManagerLine,
|
|
11686
|
-
|
|
11674
|
+
import_picocolors23.default.bold(`${activePackageManagerLine} <----- active`)
|
|
11687
11675
|
)
|
|
11688
11676
|
);
|
|
11689
11677
|
});
|
|
@@ -11723,10 +11711,10 @@ command("doctor").description("Check Storybook for known problems and provide su
|
|
|
11723
11711
|
}).catch(handleCommandFailure(options.logfile));
|
|
11724
11712
|
});
|
|
11725
11713
|
program.on("command:*", ([invalidCmd]) => {
|
|
11726
|
-
let errorMessage = ` Invalid command: ${
|
|
11714
|
+
let errorMessage = ` Invalid command: ${import_picocolors23.default.bold(invalidCmd)}.
|
|
11727
11715
|
See --help for a list of available commands.`, suggestion = program.commands.map((cmd) => cmd.name()).find((cmd) => leven(cmd, invalidCmd) < 3);
|
|
11728
11716
|
suggestion && (errorMessage += `
|
|
11729
|
-
Did you mean ${
|
|
11717
|
+
Did you mean ${import_picocolors23.default.yellow(suggestion)}?`), logger25.error(errorMessage), process.exit(1);
|
|
11730
11718
|
});
|
|
11731
11719
|
program.usage("<command> [options]").version(String(version));
|
|
11732
11720
|
var run = (argv = process.argv) => program.parseAsync(argv);
|