Skip to content

Conversation

@valentinpalkovic
Copy link
Contributor

@valentinpalkovic valentinpalkovic commented Nov 24, 2025

Closes #

What I did

Running Storybook for Angular hasn't indicated during startup that Compodoc is built, leading to the impression that the CLI got stuck. This got fixed by using a spinner for Compodoc's progress.

Additionally, the Angular builders were refactored to be asynchronous rather than using rxjs.

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 pull request has been released as version 0.0.0-pr-33156-sha-ed50d99f. Try it out in a new sandbox by running npx [email protected] sandbox or in an existing project with npx [email protected] upgrade.

More information
Published version 0.0.0-pr-33156-sha-ed50d99f
Triggered by @valentinpalkovic
Repository storybookjs/storybook
Branch valentin/show-compodoc-progress
Commit ed50d99f
Datetime Tue Nov 25 08:01:35 UTC 2025 (1764057695)
Workflow run 19662405347

To request a new release of this pull request, mention the @storybookjs/core team.

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

Summary by CodeRabbit

  • Refactor
    • Rewrote builder flows to a simpler async/await model for more predictable execution and improved error handling
    • Simplified runtime logic for start/build operations to streamline control flow and results reporting
  • UX
    • Added clearer visual progress indicators and messages during documentation generation
  • Tests
    • Updated tests to align with promise-based execution and simplified mocks

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

@nx-cloud
Copy link

nx-cloud bot commented Nov 24, 2025

View your CI Pipeline Execution ↗ for commit ed50d99

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

☁️ Nx Cloud last updated this comment at 2025-11-25 08:19:16 UTC

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 24, 2025

📝 Walkthrough

Walkthrough

Three Angular Storybook builder modules were converted from RxJS Observable-based flows to async/await Promise-based implementations: builders' entry points and runInstance functions now return Promises, and runCompodoc now returns Promise.

Changes

Cohort / File(s) Summary
Builders: build/start refactor
code/frameworks/angular/src/builders/build-storybook/index.ts, code/frameworks/angular/src/builders/start-storybook/index.ts
commandBuilder changed from an Observable pipeline to an async function returning Promise<BuilderOutput>. runInstance converted from returning Observable<number> to async returning number. RxJS imports/operators and Observable streams removed; control flow replaced with sequential await and try/catch error handling.
Utility: compodoc runner refactor
code/frameworks/angular/src/builders/utils/run-compodoc.ts, code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts
runCompodoc changed from returning Observable<void> to async returning Promise<void>. Observable creation/subscription removed, replaced with await of prompt.executeTaskWithSpinner. Tests updated to await the Promise and mock the spinner helper.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant CLI as CLI Entrypoint
  participant BuilderOld as Builder (Observable)
  participant RxJS as RxJS Pipeline
  participant RunOld as runInstance / runCompodoc (old)
  participant BuilderNew as Builder (async)
  participant RunNew as runInstance / runCompodoc (new)
  participant Result as BuilderOutput

  Note over BuilderOld,RxJS: Old (Observable-based)
  CLI->>BuilderOld: invoke commandBuilder()
  BuilderOld->>RxJS: create Observable pipeline
  RxJS->>RunOld: subscribe -> runInstance / runCompodoc
  RunOld-->>RxJS: emit values / complete / error
  RxJS-->>BuilderOld: map/mapTo results
  BuilderOld-->>CLI: return Observable stream (emits BuilderOutput)

  Note over BuilderNew,RunNew: New (async/await)
  CLI->>BuilderNew: await commandBuilder()
  BuilderNew->>RunNew: await runCompodoc / runInstance()
  RunNew-->>BuilderNew: return value or throw
  BuilderNew-->>CLI: return Promise resolved with BuilderOutput
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Pay extra attention to:
    • code/frameworks/angular/src/builders/build-storybook/index.ts — ensure sequencing and telemetry/error semantics preserved.
    • code/frameworks/angular/src/builders/start-storybook/index.ts — confirm port extraction and lifecycle behavior match previous Observable flow.
    • code/frameworks/angular/src/builders/utils/run-compodoc.ts and its test — verify spinner messages, exit/code propagation, and test mocks reflect new Promise-based behavior.

Possibly related PRs

✨ 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 43bac1c and ed50d99.

📒 Files selected for processing (2)
  • code/frameworks/angular/src/builders/build-storybook/index.ts (2 hunks)
  • code/frameworks/angular/src/builders/start-storybook/index.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx,js,jsx,mjs}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use camelCase for variable and function names

Files:

  • code/frameworks/angular/src/builders/start-storybook/index.ts
  • code/frameworks/angular/src/builders/build-storybook/index.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Enable TypeScript strict mode
Export functions from modules for testing purposes

Files:

  • code/frameworks/angular/src/builders/start-storybook/index.ts
  • code/frameworks/angular/src/builders/build-storybook/index.ts
**/*.{ts,tsx,js,jsx,json,html,mjs}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx,js,jsx,json,html,mjs}: Use ESLint and Prettier for code style enforcement
Run 'yarn prettier --write ' to format code after making changes
Run 'yarn lint:js:cmd ' to check for ESLint issues after making changes

Files:

  • code/frameworks/angular/src/builders/start-storybook/index.ts
  • code/frameworks/angular/src/builders/build-storybook/index.ts
code/**/!(*.test).{ts,tsx,js,mjs}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

code/**/!(*.test).{ts,tsx,js,mjs}: Use 'logger' from 'storybook/internal/node-logger' for server-side (Node.js) logging, not console.log/console.warn/console.error
Use 'logger' from 'storybook/internal/client-logger' for client-side (browser) logging, not console.log/console.warn/console.error
Do not use console.log, console.warn, or console.error directly unless in isolated files where importing loggers would significantly increase bundle size

Files:

  • code/frameworks/angular/src/builders/start-storybook/index.ts
  • code/frameworks/angular/src/builders/build-storybook/index.ts
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.268Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Each mock implementation should return a Promise for async functions in Vitest
📚 Learning: 2025-11-24T17:49:47.649Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T17:49:47.649Z
Learning: The Storybook repository is a TypeScript/React monorepo with main codebase in 'code/' directory and tooling in 'scripts/' directory

Applied to files:

  • code/frameworks/angular/src/builders/build-storybook/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: normal
  • GitHub Check: Core Unit Tests, windows-latest
🔇 Additional comments (4)
code/frameworks/angular/src/builders/build-storybook/index.ts (2)

176-193: LGTM on the async refactor with proper error handling.

The conversion from Observable to async/await is clean. The try/catch pattern correctly wraps the telemetry call and rethrows with a summarized error message.


70-151: Clean async/await migration with proper flow.

The sequential async flow is well-structured: setup → compodoc (conditional) → env config → build → completion log. Using logger from storybook/internal/node-logger is correct per coding guidelines.

code/frameworks/angular/src/builders/start-storybook/index.ts (2)

202-219: LGTM on the async refactor with proper error handling.

The conversion is consistent with the build-storybook builder. The String(summarized) cast is slightly redundant if errorSummary already returns a string, but it's harmless defensive coding.


75-178: Clean async/await migration with proper flow.

The sequential async flow mirrors the build-storybook pattern correctly. The port is properly awaited and returned in the BuilderOutput. Using logger from storybook/internal/node-logger complies with coding guidelines.


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

@valentinpalkovic valentinpalkovic changed the title Angular: Migrate from RxJS to async/await in command builders and run Compodoc utility Angular: Migrate from RxJS to async/await in command builders and run Compodoc utility as spinner Nov 24, 2025
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/frameworks/angular/src/builders/utils/run-compodoc.ts (1)

18-44: Async runCompodoc refactor looks solid; consider aligning package-manager cwd

The async/await flow and prompt.executeTaskWithSpinner wrapper look correct and keep errors propagating via the returned Promise<void>, while satisfying the logging guideline by using storybook/internal/node-logger rather than console. One small robustness improvement would be to align package-manager detection with the execution cwd, e.g.:

const packageManager = JsPackageManagerFactory.getPackageManager(
  undefined,
  context.workspaceRoot ?? process.cwd()
);

so that lockfile detection and runPackageCommand({ cwd: context.workspaceRoot }) operate from the same root, which can matter in multi-workspace or non-standard invocation setups.

code/frameworks/angular/src/builders/start-storybook/index.ts (1)

75-177: Guard against NaN when normalizing options.port

The async builder flow looks good overall, and the compodoc + --silent handling is nicely integrated. One small robustness tweak: options.port = parseInt(\${options.port}`, 10);will produceNaNifoptions.portis everundefined/nullat this stage (e.g., no CLI arg and no env override), which could then be passed through tobuildDevStandalone`. You may want to default or guard here, for example:

const rawPort = options.port ?? 6006; // or whatever default Storybook CLI uses
options.port = parseInt(String(rawPort), 10);

to ensure a valid numeric port is always used.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 74ecbcc and 298effd.

📒 Files selected for processing (3)
  • code/frameworks/angular/src/builders/build-storybook/index.ts (3 hunks)
  • code/frameworks/angular/src/builders/start-storybook/index.ts (3 hunks)
  • code/frameworks/angular/src/builders/utils/run-compodoc.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx,js,jsx,mjs}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use camelCase for variable and function names

Files:

  • code/frameworks/angular/src/builders/utils/run-compodoc.ts
  • code/frameworks/angular/src/builders/start-storybook/index.ts
  • code/frameworks/angular/src/builders/build-storybook/index.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Enable TypeScript strict mode
Export functions from modules for testing purposes

Files:

  • code/frameworks/angular/src/builders/utils/run-compodoc.ts
  • code/frameworks/angular/src/builders/start-storybook/index.ts
  • code/frameworks/angular/src/builders/build-storybook/index.ts
**/*.{ts,tsx,js,jsx,json,html,mjs}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx,js,jsx,json,html,mjs}: Use ESLint and Prettier for code style enforcement
Run 'yarn prettier --write ' to format code after making changes
Run 'yarn lint:js:cmd ' to check for ESLint issues after making changes

Files:

  • code/frameworks/angular/src/builders/utils/run-compodoc.ts
  • code/frameworks/angular/src/builders/start-storybook/index.ts
  • code/frameworks/angular/src/builders/build-storybook/index.ts
code/**/!(*.test).{ts,tsx,js,mjs}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

code/**/!(*.test).{ts,tsx,js,mjs}: Use 'logger' from 'storybook/internal/node-logger' for server-side (Node.js) logging, not console.log/console.warn/console.error
Use 'logger' from 'storybook/internal/client-logger' for client-side (browser) logging, not console.log/console.warn/console.error
Do not use console.log, console.warn, or console.error directly unless in isolated files where importing loggers would significantly increase bundle size

Files:

  • code/frameworks/angular/src/builders/utils/run-compodoc.ts
  • code/frameworks/angular/src/builders/start-storybook/index.ts
  • code/frameworks/angular/src/builders/build-storybook/index.ts
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.268Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Each mock implementation should return a Promise for async functions in Vitest
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T17:49:47.649Z
Learning: The Storybook repository is a TypeScript/React monorepo with main codebase in 'code/' directory and tooling in 'scripts/' directory
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.
📚 Learning: 2025-11-24T17:49:47.649Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T17:49:47.649Z
Learning: Applies to code/**/!(*.test).{ts,tsx,js,mjs} : Use 'logger' from 'storybook/internal/node-logger' for server-side (Node.js) logging, not console.log/console.warn/console.error

Applied to files:

  • code/frameworks/angular/src/builders/utils/run-compodoc.ts
  • code/frameworks/angular/src/builders/start-storybook/index.ts
📚 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/frameworks/angular/src/builders/start-storybook/index.ts
📚 Learning: 2025-11-24T17:49:47.649Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T17:49:47.649Z
Learning: Use 'cd code && yarn storybook:ui' to start the development server for testing UI changes on http://localhost:6006/

Applied to files:

  • code/frameworks/angular/src/builders/start-storybook/index.ts
📚 Learning: 2025-11-24T17:49:47.649Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T17:49:47.649Z
Learning: The Storybook repository is a TypeScript/React monorepo with main codebase in 'code/' directory and tooling in 'scripts/' directory

Applied to files:

  • code/frameworks/angular/src/builders/build-storybook/index.ts
🧬 Code graph analysis (2)
code/frameworks/angular/src/builders/utils/run-compodoc.ts (1)
code/core/src/common/js-package-manager/JsPackageManagerFactory.ts (1)
  • JsPackageManagerFactory (29-201)
code/frameworks/angular/src/builders/build-storybook/index.ts (4)
code/frameworks/angular/src/builders/utils/run-compodoc.ts (1)
  • runCompodoc (18-45)
code/core/src/common/utils/cli.ts (1)
  • getEnvConfig (89-97)
code/core/src/core-server/withTelemetry.ts (1)
  • withTelemetry (147-203)
code/frameworks/angular/src/builders/utils/error-handler.ts (1)
  • errorSummary (23-33)
⏰ 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: normal
  • GitHub Check: Core Unit Tests, windows-latest
🔇 Additional comments (3)
code/frameworks/angular/src/builders/build-storybook/index.ts (2)

70-149: Async commandBuilder flow reads clearly and preserves behavior

The migration to an async commandBuilder that awaits setup, conditionally awaits runCompodoc, applies getEnvConfig, and then builds a single StandaloneBuildOptions object before calling runInstance is straightforward and keeps the previous behavior while making the control flow much easier to follow. No issues spotted in the sequencing or option wiring.


173-193: runInstance telemetry + error summarization looks correct

Wrapping withTelemetry('build', …) in a try/catch and converting failures to new Error(errorSummary(error)) keeps detailed logging/telemetry in withTelemetry while surfacing a concise, user-facing message up to the Angular builder. Ignoring the return value from withTelemetry is fine here since only success/failure matters for build-storybook.

code/frameworks/angular/src/builders/start-storybook/index.ts (1)

200-219: Confirm withTelemetry('dev', …) always yields an object with port

The async runInstance wrapper around withTelemetry('dev', …) and buildDevStandalone is a clean replacement for the previous Observable flow, and the error summarization via errorSummary is consistent with the build builder. The line:

const { port } = await withTelemetry(/* ... */);

assumes that for the 'dev' event type, withTelemetry will always resolve to an object containing port (and never undefined), otherwise destructuring would throw before your own try/catch sees the error. If that invariant is guaranteed elsewhere, this is fine; otherwise consider a minimal guard or assertion to make the assumption explicit.

@valentinpalkovic valentinpalkovic force-pushed the valentin/show-compodoc-progress branch from 298effd to 43bac1c Compare November 24, 2025 20:51
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 (1)
code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts (1)

17-23: Mock implementation correctly aligned with async/await pattern.

The mock for executeTaskWithSpinner properly executes the task function and returns a Promise (as an async function). The implementation correctly supports the test scenarios.

Optional: Consider stricter typing for the mock.

The fn parameter is typed as any. While acceptable for test mocks, you could make it more specific:

executeTaskWithSpinner: async (fn: () => Promise<any>) => {
  await fn();
}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 298effd and 43bac1c.

📒 Files selected for processing (4)
  • code/frameworks/angular/src/builders/build-storybook/index.ts (3 hunks)
  • code/frameworks/angular/src/builders/start-storybook/index.ts (3 hunks)
  • code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts (6 hunks)
  • code/frameworks/angular/src/builders/utils/run-compodoc.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{test,spec}.{ts,tsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{test,spec}.{ts,tsx}: Test files should follow the naming pattern *.test.ts, *.test.tsx, *.spec.ts, or *.spec.tsx
Follow the spy mocking rules defined in .cursor/rules/spy-mocking.mdc for consistent mocking patterns with Vitest

Files:

  • code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts
**/*.{ts,tsx,js,jsx,mjs}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use camelCase for variable and function names

Files:

  • code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts
  • code/frameworks/angular/src/builders/build-storybook/index.ts
  • code/frameworks/angular/src/builders/utils/run-compodoc.ts
  • code/frameworks/angular/src/builders/start-storybook/index.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Enable TypeScript strict mode
Export functions from modules for testing purposes

Files:

  • code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts
  • code/frameworks/angular/src/builders/build-storybook/index.ts
  • code/frameworks/angular/src/builders/utils/run-compodoc.ts
  • code/frameworks/angular/src/builders/start-storybook/index.ts
**/*.{ts,tsx,js,jsx,json,html,mjs}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx,js,jsx,json,html,mjs}: Use ESLint and Prettier for code style enforcement
Run 'yarn prettier --write ' to format code after making changes
Run 'yarn lint:js:cmd ' to check for ESLint issues after making changes

Files:

  • code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts
  • code/frameworks/angular/src/builders/build-storybook/index.ts
  • code/frameworks/angular/src/builders/utils/run-compodoc.ts
  • code/frameworks/angular/src/builders/start-storybook/index.ts
code/**/!(*.test).{ts,tsx,js,mjs}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

code/**/!(*.test).{ts,tsx,js,mjs}: Use 'logger' from 'storybook/internal/node-logger' for server-side (Node.js) logging, not console.log/console.warn/console.error
Use 'logger' from 'storybook/internal/client-logger' for client-side (browser) logging, not console.log/console.warn/console.error
Do not use console.log, console.warn, or console.error directly unless in isolated files where importing loggers would significantly increase bundle size

Files:

  • code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts
  • code/frameworks/angular/src/builders/build-storybook/index.ts
  • code/frameworks/angular/src/builders/utils/run-compodoc.ts
  • code/frameworks/angular/src/builders/start-storybook/index.ts
🧠 Learnings (24)
📓 Common learnings
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.268Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Each mock implementation should return a Promise for async functions in Vitest
📚 Learning: 2025-11-24T17:49:59.268Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.268Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Each mock implementation should return a Promise for async functions in Vitest

Applied to files:

  • code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts
📚 Learning: 2025-11-24T17:49:59.268Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.268Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Document complex mock behaviors in Vitest tests

Applied to files:

  • code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts
📚 Learning: 2025-11-24T17:49:59.268Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.268Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Avoid mocking only a subset of required dependencies in Vitest tests

Applied to files:

  • code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts
📚 Learning: 2025-11-24T17:49:59.268Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.268Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Mock all required dependencies that the test subject uses

Applied to files:

  • code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts
📚 Learning: 2025-11-24T17:49:59.268Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.268Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Avoid mock implementations outside of `beforeEach` blocks in Vitest tests

Applied to files:

  • code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts
📚 Learning: 2025-11-24T17:49:59.268Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.268Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Implement mock behaviors in `beforeEach` blocks in Vitest tests

Applied to files:

  • code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts
📚 Learning: 2025-11-24T17:49:47.649Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T17:49:47.649Z
Learning: Applies to **/*.test.{ts,tsx} : Use 'vi.mock()' to mock external dependencies like file system and loggers in unit tests

Applied to files:

  • code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts
📚 Learning: 2025-11-24T17:49:59.268Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.268Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Mock all required properties and methods that the test subject uses in Vitest tests

Applied to files:

  • code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts
📚 Learning: 2025-11-24T17:49:59.268Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.268Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Avoid inline mock implementations within test cases in Vitest tests

Applied to files:

  • code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts
📚 Learning: 2025-11-24T17:49:59.268Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.268Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Group related mocks together in Vitest tests

Applied to files:

  • code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts
📚 Learning: 2025-11-24T17:49:59.268Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.268Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Mock at the highest level of abstraction needed in Vitest tests

Applied to files:

  • code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts
📚 Learning: 2025-11-24T17:49:59.268Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.268Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Avoid direct function mocking without `vi.mocked()` in Vitest tests

Applied to files:

  • code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts
📚 Learning: 2025-11-24T17:49:59.268Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.268Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Use `vi.mock()` with the `spy: true` option for all package and file mocks in Vitest tests

Applied to files:

  • code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts
📚 Learning: 2025-11-24T17:49:47.649Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T17:49:47.649Z
Learning: Applies to code/**/!(*.test).{ts,tsx,js,mjs} : Use 'logger' from 'storybook/internal/node-logger' for server-side (Node.js) logging, not console.log/console.warn/console.error

Applied to files:

  • code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts
  • code/frameworks/angular/src/builders/utils/run-compodoc.ts
  • code/frameworks/angular/src/builders/start-storybook/index.ts
📚 Learning: 2025-11-24T17:49:59.268Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.268Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Use type-safe mocking with `vi.mocked()` in Vitest tests

Applied to files:

  • code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts
📚 Learning: 2025-11-24T17:49:59.268Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.268Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Use `vi.mocked()` to type and access the mocked functions in Vitest tests

Applied to files:

  • code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts
📚 Learning: 2025-11-24T17:49:47.649Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T17:49:47.649Z
Learning: Applies to code/**/!(*.test).{ts,tsx,js,mjs} : Use 'logger' from 'storybook/internal/client-logger' for client-side (browser) logging, not console.log/console.warn/console.error

Applied to files:

  • code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts
📚 Learning: 2025-11-24T17:49:59.268Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.268Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Avoid mocking without the `spy: true` option in Vitest tests

Applied to files:

  • code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts
📚 Learning: 2025-11-24T17:49:59.268Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.268Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Mock implementations should match the expected return type of the original function

Applied to files:

  • code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts
📚 Learning: 2025-11-24T17:49:59.268Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.268Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Keep mock implementations simple and focused in Vitest tests

Applied to files:

  • code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts
📚 Learning: 2025-11-24T17:49:47.649Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T17:49:47.649Z
Learning: The Storybook repository is a TypeScript/React monorepo with main codebase in 'code/' directory and tooling in 'scripts/' directory

Applied to files:

  • code/frameworks/angular/src/builders/build-storybook/index.ts
📚 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/frameworks/angular/src/builders/start-storybook/index.ts
📚 Learning: 2025-11-24T17:49:47.649Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T17:49:47.649Z
Learning: Use 'cd code && yarn storybook:ui' to start the development server for testing UI changes on http://localhost:6006/

Applied to files:

  • code/frameworks/angular/src/builders/start-storybook/index.ts
🧬 Code graph analysis (4)
code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts (1)
code/frameworks/angular/src/builders/utils/run-compodoc.ts (1)
  • runCompodoc (18-45)
code/frameworks/angular/src/builders/build-storybook/index.ts (5)
code/frameworks/angular/src/builders/start-storybook/index.ts (1)
  • StorybookBuilderOptions (37-71)
code/frameworks/angular/src/builders/utils/run-compodoc.ts (1)
  • runCompodoc (18-45)
code/core/src/common/utils/cli.ts (1)
  • getEnvConfig (89-97)
code/core/src/core-server/withTelemetry.ts (1)
  • withTelemetry (147-203)
code/frameworks/angular/src/builders/utils/error-handler.ts (1)
  • errorSummary (23-33)
code/frameworks/angular/src/builders/utils/run-compodoc.ts (1)
code/core/src/common/js-package-manager/JsPackageManagerFactory.ts (1)
  • JsPackageManagerFactory (29-201)
code/frameworks/angular/src/builders/start-storybook/index.ts (4)
code/frameworks/angular/src/builders/utils/run-compodoc.ts (1)
  • runCompodoc (18-45)
code/core/src/common/utils/cli.ts (1)
  • getEnvConfig (89-97)
code/core/src/core-server/withTelemetry.ts (1)
  • withTelemetry (147-203)
code/frameworks/angular/src/builders/utils/error-handler.ts (1)
  • errorSummary (23-33)
⏰ 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: normal
  • GitHub Check: Core Unit Tests, windows-latest
🔇 Additional comments (6)
code/frameworks/angular/src/builders/utils/run-compodoc.ts (1)

18-44: LGTM! Clean migration from RxJS to async/await with spinner UX.

The conversion from Observable-based flow to Promise-based async/await is well executed. The spinner wrapper (prompt.executeTaskWithSpinner) enhances user experience by providing clear feedback during Compodoc generation.

code/frameworks/angular/src/builders/utils/run-compodoc.spec.ts (1)

46-52: LGTM! Tests correctly updated to await Promise instead of subscribing to Observable.

All test cases properly use await with the Promise-based runCompodoc function, correctly reflecting the migration from RxJS Observables to async/await.

Also applies to: 61-67, 76-82, 91-97, 106-112

code/frameworks/angular/src/builders/build-storybook/index.ts (2)

70-148: LGTM! Successful migration from RxJS pipeline to async/await flow.

The commandBuilder function is cleanly converted to an async function with a clear sequential flow:

  1. Setup (awaited)
  2. Compodoc execution (conditionally awaited)
  3. Environment configuration
  4. Build options preparation
  5. Build execution via runInstance (awaited)

The migration maintains all original functionality while improving code readability and maintainability.


173-192: LGTM! Error handling properly migrated to try/catch pattern.

The runInstance function correctly wraps the build execution in a try/catch block, preserving error handling semantics while using async/await. The error summary is applied before rethrowing, maintaining the original error reporting behavior.

code/frameworks/angular/src/builders/start-storybook/index.ts (2)

75-176: LGTM! Clean migration to async/await with proper port handling.

The commandBuilder function successfully migrates to async/await with a clear sequential flow. The port extraction from runInstance and inclusion in the returned BuilderOutput is correctly implemented. The addition of --silent flag to compodocArgs when options.quiet is true is a nice touch for consistent logging behavior.


200-218: LGTM! Error handling and port extraction correctly implemented.

The runInstance function properly uses async/await with try/catch error handling. The port is correctly extracted from the withTelemetry result and returned to the caller. Error summarization before rethrowing maintains consistent error reporting.

@valentinpalkovic valentinpalkovic merged commit 4ba9f38 into next Nov 25, 2025
67 of 70 checks passed
@valentinpalkovic valentinpalkovic deleted the valentin/show-compodoc-progress branch November 25, 2025 09:43
@github-actions github-actions bot mentioned this pull request Nov 25, 2025
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants