Repository navigation
CLI: Warn when Yarn 1 is detected on a best-effort basis - #36282
Merged
Merged
Conversation
Shared best-effort warning for Yarn 1 (Classic) projects: emits once per process via once.warn using the pretty package-manager label and links to the install docs. Never throws.
Emit the shared warnOnYarn1 notice beside the existing package-manager notice, strictly after the empty-directory branch returns so the npm fallback path never double-warns. Init continues as before.
getStorybookData emits the shared warnOnYarn1 notice beside existing detection, guarded by a warnOnYarn1 option (default on, suppressed only when explicitly false). The agent-facing project-info skill passes warnOnYarn1: false. Covers upgrade/doctor/automigrate/add flows; tests assert single-warning behavior and silence for supported managers.
Review feedback: the agent-facing project-info path no longer suppresses the warning, so warnOnYarn1 is unconditional in getStorybookData and the warnOnYarn1 option is removed from the options interface. Drop the unit test files that only covered the removed suppression behavior.
AriPerkkio
reviewed
Sep 14, 2026
…streams Address review feedback: - upgrade.test.ts: replace process stdout/stderr interception with a file-level node-logger mock that mirrors logger.warn into a spy while delegating to the real logger, keeping once() dedupe intact and letting assertions observe final emissions through the normal logger seam. - getStorybookData.test.ts: use Vitest's typed vi.mock(import(...)) form for the node-logger mock. Also drops the now-unused once import from upgrade.test.ts.
Contributor
Package BenchmarksCommit: No significant changes detected, all good. 👏 |
AriPerkkio
reviewed
Sep 14, 2026
Converts the upgrade.test.ts node-logger and common mocks to the typed vi.mock(import(...)) form per review feedback, dropping the explicit importOriginal generic and the as typeof sbcc cast. Class-static overrides use Object.assign so the factory satisfies Partial<T> without casts; the versions remap keeps one focused cast since Record<string,string> cannot satisfy the literal-keyed versions type. Fixes the typescript-validation TS2769 introduced by the typed mock conversion in getStorybookData.test.ts.
Contributor
Author
|
Thanks for the report. The @storybook/vue3-vite size delta predates this PR's changes — this branch's seven files (core CLI package-manager warning + tests) do not touch vue3-vite; the delta arrived with the merge from |
AriPerkkio
approved these changes
Sep 14, 2026
This was referenced Sep 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Yarn 1 (Classic) is in maintenance mode, and Storybook's package-manager ecosystem increasingly assumes modern managers (npm, pnpm, Yarn Berry). Users on Yarn 1 currently get no signal that support is best-effort only, so avoidable install/upgrade friction goes unexplained. This adds a single, actionable, docs-linked warning — without ever blocking any CLI operation.
What
A shared
warnOnYarn1helper incode/core/src/common/js-package-manager/that branches onPackageManagerName.YARN1, deduplicates viaonce.warn, usesgetPrettyPackageManagerNamefor the label ("Yarn Classic (v1)"), and emits one line:Two call sites, both beside existing package-manager handling:
PreflightCheckCommand.ts) — placed strictly after the empty-directory branch returns, so the npm-fallback path never double-warns.getStorybookData.ts) — covers upgrade, doctor, automigrate, add, and the agent-facingproject-infoskill in one place. The warning is unconditional — per review feedback, there is no suppression option; every consumer sees it.Deliberately excluded: the upgrade autoblock system, dev/build startup flows, and telemetry — Yarn 1 must never become a hard blocker anywhere.
How to Review
code/core/src/common/js-package-manager/warnOnYarn1.ts— the whole behavior contract (never throws; single line; once-per-process).code/core/src/cli/getStorybookData.ts— the unconditional warning beside package-manager detection.code/lib/create-storybook/src/commands/PreflightCheckCommand.ts— placement after the empty-dir return.warnOnYarn1?: booleansuppression option (and theproject-info.test.ts/warnOnYarn1.test.tsfiles covering it) was removed in 2d9411b — the warning now always logs.stringContainingon plain fragments because picocolors can inject ANSI around colored text; upgrade integration tests capture process streams since the dist CLI runtime resolves its own node-logger instance that object spies can't see.Manual testing
This is backend-only CLI logging work — no rendered UI, so visual/browser evidence is not applicable. To verify manually:
package.jsonusingyarn@^1.22("packageManager": "yarn@1.22.22") and no lockfile changes, run the canary CLI'sstorybook upgrade— expect exactly one "Yarn Classic (v1) is supported on a best-effort basis…" line and a normal, non-blocking completion.storybook initin an empty directory with Yarn 1 available — expect the single npm-fallback notice and no duplicate best-effort warning.Automated coverage: 53 tests across three suites (getStorybookData chokepoint, init preflight, upgrade integration).
Test Evidence
Backend-only CLI logging work — no rendered UI, so visual evidence is not applicable. Verified locally at head
74dc6e967483177d0582339edf88430d2cab9b06: all three suites pass (53/53, includes vitest typecheck), oxlint and oxfmt clean on touched files. Acceptance-criterion evidence (tc-1–tc-6) refreshed at this head in the Obvious project.🔗 Obvious Project · 🧵 Obvious Thread