Skip to content

Conversation

@valentinpalkovic
Copy link
Contributor

@valentinpalkovic valentinpalkovic commented Nov 20, 2025

Closes #

What I did

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>

Summary by CodeRabbit

  • Chores
    • Improved Angular dependency handling and automatic devkit version resolution for Storybook initialization.
    • Broadened supported Angular/devkit version ranges and added a minimum zone.js requirement for Angular support.
    • Updated Angular CLI sandbox templates to include @angular/forms for Prerelease and Latest variants.

✏️ Tip: You can customize this high-level summary in your review settings.

@valentinpalkovic valentinpalkovic self-assigned this Nov 20, 2025
@valentinpalkovic valentinpalkovic added bug angular ci:daily Run the CI jobs that normally run in the daily job. labels Nov 20, 2025
@nx-cloud
Copy link

nx-cloud bot commented Nov 20, 2025

View your CI Pipeline Execution ↗ for commit 0d95f7b

Command Status Duration Result
nx run-many -t build --parallel=3 ✅ Succeeded 55s View ↗

☁️ Nx Cloud last updated this comment at 2025-11-20 08:54:05 UTC

… schema conditionally to make Angular prerelease sandboxes working again
@valentinpalkovic valentinpalkovic force-pushed the valentin/fix-angular-prerelease-sandbox branch from ba8dd57 to 7b6f0fb Compare November 20, 2025 05:15
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 20, 2025

📝 Walkthrough

Walkthrough

Update adds semver-based devkit version resolution in the Angular Storybook generator, adds extra Angular runtime dependencies in sandbox templates, and widens Angular peerDependency ranges while adding zone.js in the Angular framework package manifest.

Changes

Cohort / File(s) Summary
Angular Storybook generator
code/lib/create-storybook/src/generators/ANGULAR/index.ts
Imported semver; added toDevkitVersion helper and extraAngularDeps to derive and build dependency entries for @angular-devkit/build-angular, @angular-devkit/architect, @angular-devkit/core, and @angular/platform-browser-dynamic from the detected Angular range; replaced hard-coded extra packages with ...extraAngularDeps; retained existing Compodoc, scripts, and template-copying behavior.
Sandbox templates (Angular CLI)
code/lib/cli-storybook/src/sandbox-templates.ts
Added modifications.extraDependencies entries: Prerelease template includes @standard-schema/spec@^1 and @angular/forms@next; Latest template includes @angular/forms@latest.
Framework package manifest
code/frameworks/angular/package.json
Broadened peerDependency ranges for many @angular/* and @angular-devkit/* packages to >=18.0.0 <22.0.0 (or similar range semantics) and added a new peerDependency zone.js with >=0.14.0.

Sequence Diagram(s)

Skipped — changes are dependency and configuration updates without control-flow modifications.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Check toDevkitVersion/semver logic for correct parsing of caret and range semantics and correct mapping to devkit versions.
  • Verify generated extraAngularDeps strings match expected package/version formats and don't introduce conflicts.
  • Confirm sandbox extraDependencies entries are applied where intended and that @angular/forms@next/latest choices are deliberate.
  • Review broadened peerDependency ranges and the addition of zone.js for compatibility and policy implications.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fcbd2c7 and 0d95f7b.

⛔ Files ignored due to path filters (1)
  • code/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (3)
  • code/frameworks/angular/package.json (1 hunks)
  • code/lib/cli-storybook/src/sandbox-templates.ts (2 hunks)
  • code/lib/create-storybook/src/generators/ANGULAR/index.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • code/lib/create-storybook/src/generators/ANGULAR/index.ts
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: ndelangen
Repo: storybookjs/storybook PR: 32484
File: code/core/package.json:326-326
Timestamp: 2025-09-17T07:31:04.432Z
Learning: In Storybook's core package, dependencies like `open` are bundled into the final distribution during the build process, so they should remain in devDependencies rather than being moved to dependencies. End users don't need these packages as separate runtime dependencies since they're included in the bundled code.
Learnt from: mrginglymus
Repo: storybookjs/storybook PR: 32556
File: code/core/package.json:309-313
Timestamp: 2025-09-29T13:20:23.346Z
Learning: The `fast-printf` dependency in Storybook's core package is bundled into the final distribution during the build process, so it should remain in devDependencies rather than being moved to dependencies, following the same pattern as other bundled dependencies like `open`.
Learnt from: JReinhold
Repo: storybookjs/storybook PR: 32607
File: code/package.json:243-243
Timestamp: 2025-10-02T09:22:13.215Z
Learning: The Storybook repository uses Yarn v^4 (any 4.x version) as the package manager, configured via .yarnrc.yml and package.json packageManager field. Specific patch versions within v4 can be upgraded as needed.
📚 Learning: 2025-09-17T07:31:04.432Z
Learnt from: ndelangen
Repo: storybookjs/storybook PR: 32484
File: code/core/package.json:326-326
Timestamp: 2025-09-17T07:31:04.432Z
Learning: In Storybook's core package, dependencies like `open` are bundled into the final distribution during the build process, so they should remain in devDependencies rather than being moved to dependencies. End users don't need these packages as separate runtime dependencies since they're included in the bundled code.

Applied to files:

  • code/frameworks/angular/package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: daily
  • GitHub Check: Core Unit Tests, windows-latest
🔇 Additional comments (2)
code/frameworks/angular/package.json (2)

104-104: No changes needed — rxjs specification is correct.

Angular 18, 19 and 20 require RxJS 7 (specifically ^7.4.0) and do not declare support for RxJS 8. Angular 21 does not yet show RxJS 8 support in the official compatibility table. The current peer dependency specification "^6.5.3 || ^7.4.0" is appropriate for Angular 18-21.


93-103: Testing coverage for Angular 18-21 support is limited—verify compatibility across the full range or narrow declared support.

The package.json declares peer dependency support for Angular 18 through 21, but the sandbox test templates only exercise two configurations: angular-cli/prerelease (latest/next) and angular-cli/default-ts (latest). This means intermediate versions (18, 19, 20) are not explicitly tested.

Angular's release notes document significant breaking changes across these majors (SSR bootstrap changes, TestBed.get removal, control-flow template syntax deprecation, ng-reflect attribute removal, TypeScript version bumps). Additionally, the prerelease template includes a note that Angular 21 introduces new peer dependency requirements (standard-schema via @angular/forms), indicating version-specific concerns already exist in the codebase.

Recommendation: Either:

  • Add a CI matrix testing Angular 18, 19, 20, and 21 explicitly, or
  • Narrow the peerDependencies to only versions explicitly tested (e.g., >=20.0.0), or
  • Document which versions are actively maintained vs. best-effort supported

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
code/lib/create-storybook/src/generators/ANGULAR/index.ts (2)

8-8: Semver import & robustness of minVersion usage

Using a default import for semver plus semver.minVersion(angularVersion) looks fine assuming the repo is compiled with esModuleInterop/allowSyntheticDefaultImports and packageManager.getDependencyVersion always returns a semver-compatible range.

To make this more robust and avoid surprises with non-standard specs (e.g. aliases or tags), consider:

  • Guarding the call with semver.validRange before minVersion, and
  • Optionally falling back to false (no @standard-schema/spec) if the range is not valid instead of risking a runtime error.

For example:

const needsStandardSchema = (() => {
  if (!angularVersion || !semver.validRange(angularVersion)) {
    return false;
  }
  const min = semver.minVersion(angularVersion);
  return !!min && min.major >= 21;
})();

Also worth quickly checking how semver is imported elsewhere in the repo to keep the style consistent (default vs namespace import).

Also applies to: 100-108


62-62: Check assumptions about tying devkit/platform-browser-dynamic versions to @angular/core

Deriving @angular-devkit/* and @angular/platform-browser-dynamic versions directly from the detected @angular/core version is a reasonable heuristic and should help prerelease sandboxes, but it does bake in an assumption that these packages track the same version range as @angular/core.

Two follow-ups you may want to consider:

  • If the workspace already has @angular-devkit/build-angular (or the others) installed with a different but compatible range, you might prefer to read that version first and only fall back to @angular/core when no devkit dependency is present.
  • If angularVersion is a very loose range (e.g. ^21.0.0-0), you may want to keep these extra deps unpinned (no @${angularVersion} suffix) to avoid inadvertently forcing upgrades/downgrades when Storybook is added.

If your testing against typical Angular 17–21 CLI workspaces shows this mapping behaves well, it’s fine as-is, but documenting this assumption in the code comment would help future maintainers.

Also applies to: 89-98

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 86ee663 and ba8dd57.

📒 Files selected for processing (1)
  • code/lib/create-storybook/src/generators/ANGULAR/index.ts (2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: JReinhold
Repo: storybookjs/storybook PR: 32607
File: code/package.json:243-243
Timestamp: 2025-10-02T09:22:13.215Z
Learning: The Storybook repository uses Yarn v^4 (any 4.x version) as the package manager, configured via .yarnrc.yml and package.json packageManager field. Specific patch versions within v4 can be upgraded as needed.
Learnt from: Sidnioulz
Repo: storybookjs/storybook PR: 32458
File: code/core/src/components/components/Select/Select.tsx:200-204
Timestamp: 2025-11-05T09:38:47.712Z
Learning: Repo: storybookjs/storybook — Guidance: Until Storybook 11 is released, do not suggest using React.useId anywhere (e.g., in code/core/src/components/components/Select/Select.tsx) to maintain compatibility with React 17 runtimes. Prefer advising: accept a caller-provided props.id and, if needed, generate a client-only fallback id to minimize SSR hydration issues — but avoid useId. Resume prompting for useId after Storybook 11.
Learnt from: ndelangen
Repo: storybookjs/storybook PR: 32484
File: code/core/package.json:326-326
Timestamp: 2025-09-17T07:31:04.432Z
Learning: In Storybook's core package, dependencies like `open` are bundled into the final distribution during the build process, so they should remain in devDependencies rather than being moved to dependencies. End users don't need these packages as separate runtime dependencies since they're included in the bundled code.
📚 Learning: 2025-11-05T09:38:47.712Z
Learnt from: Sidnioulz
Repo: storybookjs/storybook PR: 32458
File: code/core/src/components/components/Select/Select.tsx:200-204
Timestamp: 2025-11-05T09:38:47.712Z
Learning: Repo: storybookjs/storybook — Guidance: Until Storybook 11 is released, do not suggest using React.useId anywhere (e.g., in code/core/src/components/components/Select/Select.tsx) to maintain compatibility with React 17 runtimes. Prefer advising: accept a caller-provided props.id and, if needed, generate a client-only fallback id to minimize SSR hydration issues — but avoid useId. Resume prompting for useId after Storybook 11.

Applied to files:

  • code/lib/create-storybook/src/generators/ANGULAR/index.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: daily
  • GitHub Check: Core Unit Tests, windows-latest
🔇 Additional comments (1)
code/lib/create-storybook/src/generators/ANGULAR/index.ts (1)

110-115: Conditional @standard-schema/spec for Angular ≥21 looks good; just confirm the peer range

The needsStandardSchema gate combined with:

...(needsStandardSchema ? ['@standard-schema/spec@^1'] : []),

is a clean way to ensure Angular 21+ projects get the required peer without impacting older workspaces. Assuming @angular/forms@21’s peer really is @standard-schema/spec@^1, this should resolve the prerelease sandbox issue.

I’d just suggest:

  • Double-checking the exact peer range in the Angular 21 forms package, and
  • (Optionally) adding a brief comment including that peer range so future updates (e.g. if Angular 22 moves to ^2) are easier to spot.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ba8dd57 and 7b6f0fb.

📒 Files selected for processing (2)
  • code/lib/cli-storybook/src/sandbox-templates.ts (1 hunks)
  • code/lib/create-storybook/src/generators/ANGULAR/index.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • code/lib/create-storybook/src/generators/ANGULAR/index.ts
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: mrginglymus
Repo: storybookjs/storybook PR: 32556
File: code/core/package.json:309-313
Timestamp: 2025-09-29T13:20:23.346Z
Learning: The `fast-printf` dependency in Storybook's core package is bundled into the final distribution during the build process, so it should remain in devDependencies rather than being moved to dependencies, following the same pattern as other bundled dependencies like `open`.
Learnt from: ndelangen
Repo: storybookjs/storybook PR: 32484
File: code/core/package.json:326-326
Timestamp: 2025-09-17T07:31:04.432Z
Learning: In Storybook's core package, dependencies like `open` are bundled into the final distribution during the build process, so they should remain in devDependencies rather than being moved to dependencies. End users don't need these packages as separate runtime dependencies since they're included in the bundled code.
Learnt from: JReinhold
Repo: storybookjs/storybook PR: 32607
File: code/package.json:243-243
Timestamp: 2025-10-02T09:22:13.215Z
Learning: The Storybook repository uses Yarn v^4 (any 4.x version) as the package manager, configured via .yarnrc.yml and package.json packageManager field. Specific patch versions within v4 can be upgraded as needed.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: daily
  • GitHub Check: Core Unit Tests, windows-latest
🔇 Additional comments (1)
code/lib/cli-storybook/src/sandbox-templates.ts (1)

589-589: Package name and version specifier verified as correct.

The web query confirms that Angular 21's @angular/forms package expects @standard-schema/spec@^1.0.0 as a peer dependency. The code specifies @standard-schema/spec@^1, which is equivalent in npm semver (both allow any 1.x version) and aligns with Angular's requirements. No changes needed.

@valentinpalkovic valentinpalkovic force-pushed the valentin/fix-angular-prerelease-sandbox branch from 472cab9 to fcbd2c7 Compare November 20, 2025 05:23
@storybook-app-bot
Copy link

Package Benchmarks

Commit: 0d95f7b, ran on 20 November 2025 at 06:21:27 UTC

The following packages have significant changes to their size or dependencies:

@storybook/angular

Before After Difference
Dependency count 191 191 0
Self size 118 KB 118 KB 🎉 -43 B 🎉
Dependency size 30.22 MB 30.31 MB 🚨 +93 KB 🚨
Bundle Size Analyzer Link Link

Copy link
Member

@yannbf yannbf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you <3

@valentinpalkovic valentinpalkovic changed the title Angular: Add support for additional Angular dependencies and standard… Angular: Add support for v21 Nov 20, 2025
@valentinpalkovic valentinpalkovic merged commit f624a4d into next Nov 20, 2025
114 of 116 checks passed
@valentinpalkovic valentinpalkovic deleted the valentin/fix-angular-prerelease-sandbox branch November 20, 2025 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

angular bug ci:daily Run the CI jobs that normally run in the daily job.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants