Skip to content

Add distinct exit code for Storybook build timeouts - #1512

Open
rahul05ranjan wants to merge 1 commit into
chromaui:mainfrom
rahul05ranjan:feat/storybook-build-timeout-exit-code
Open

rahul05ranjan wants to merge 1 commit into
chromaui:mainfrom
rahul05ranjan:feat/storybook-build-timeout-exit-code

Conversation

@rahul05ranjan

Copy link
Copy Markdown

What

Adds a dedicated exit code for Storybook build timeouts, resolving #864.

Currently, when a build exceeds STORYBOOK_BUILD_TIMEOUT, the CLI exits with the generic NPM_BUILD_STORYBOOK_FAILED (105), which is indistinguishable from an actual build failure. This makes it hard to tell "the build timed out" from "the build broke".

Changes

  • node-src/lib/setExitCode.ts: add STORYBOOK_BUILD_TIMEOUT: 106.
  • node-src/lib/shell/shell.ts: tag the timeout error with isTimeout: true so callers can distinguish it from other failures.
  • node-src/tasks/build/buildStorybook.ts: map a timeout error to STORYBOOK_BUILD_TIMEOUT instead of NPM_BUILD_STORYBOOK_FAILED.
  • Tests: assert the new exit code on timeout, and that runCommand tags the error.

Verification

  • tsc --noEmit passes.
  • vitest run node-src/tasks/build/buildStorybook.test.ts → 18 passed.

Note: the exit-code docs live in the separate chromatic-docs repo (see the comment in setExitCode.ts), so no doc change is included here.

Introduce STORYBOOK_BUILD_TIMEOUT (106) so a build that exceeds
STORYBOOK_BUILD_TIMEOUT exits with a dedicated code instead of the
generic NPM_BUILD_STORYBOOK_FAILED (105). runCommand() now tags its
timeout error with isTimeout, and buildStorybook() maps that to the
new exit code.

Fixes chromaui#864

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant