Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
d5c7e81
feat: add eject button to canvas toolbar
mihkeleidast Dec 5, 2024
19882e9
Merge branch 'next' into add-eject-button-to-canvas-toolbar
shilman Feb 19, 2025
0724aa6
Merge branch 'next' into pr/29825
shilman May 2, 2025
6ef3d36
Fix #32171
steciuk Aug 1, 2025
53547d8
Initial plan
Copilot Aug 27, 2025
cf66c16
Merge branch 'next' into copilot/fix-32338
JReinhold Aug 28, 2025
a1cb143
Create comprehensive GitHub Copilot instructions documentation
Copilot Aug 28, 2025
8d14963
Update copilot instructions based on feedback: add build command, fix…
Copilot Aug 28, 2025
0e5234a
Merge branch 'next' into add-eject-button-to-canvas-toolbar
Sidnioulz Sep 5, 2025
98b24a7
fix: add isLoading wrapper around eject button
mihkeleidast Sep 5, 2025
089fd10
Merge branch 'next' into add-eject-button-to-canvas-toolbar
Sidnioulz Sep 11, 2025
7757b7b
fix: bail out if loading or multi story preview
mihkeleidast Sep 11, 2025
7d125a6
refactor: improve logic for loading states
mihkeleidast Sep 11, 2025
d566a44
Merge branch 'next' into add-eject-button-to-canvas-toolbar
mihkeleidast Sep 11, 2025
8a93e13
fix: prefer aria-label over title attribute
mihkeleidast Sep 15, 2025
5a4c18e
Merge branch 'next' into add-eject-button-to-canvas-toolbar
Sidnioulz Sep 15, 2025
8f10421
Merge branch 'next' into add-eject-button-to-canvas-toolbar
Sidnioulz Sep 15, 2025
d24529b
Use exsolve's resolveModulePath for safeResolveModule
mrginglymus Sep 16, 2025
c94db38
Update yarn pnp to correctly resolve addons
mrginglymus Sep 16, 2025
696eb54
Do not use path.join to create package.json module paths
mrginglymus Sep 17, 2025
bfccde4
remove package exports we agreed we'd remove in 9.1
ndelangen Sep 19, 2025
61ee450
Refactor: Update imports to use 'storybook/theming' instead of 'story…
ndelangen Sep 19, 2025
1c4d061
improve the existing automigration
ndelangen Sep 19, 2025
17f05d0
Enhance Layout stories: Add mock implementation for getCurrentStoryDa…
ndelangen Sep 19, 2025
4251bad
fix: pass an index in handleAddValueAdd
takashi-kasajima Sep 20, 2025
8390da4
add globals back without additional entries in exports.ts
ndelangen Sep 20, 2025
99a9b22
Update runtime.ts: Add 'storybook/internal/preview-api' to globalsNam…
ndelangen Sep 22, 2025
315d015
Merge branch 'next' into add-eject-button-to-canvas-toolbar
Sidnioulz Sep 22, 2025
283161b
Merge branch 'next' into add-eject-button-to-canvas-toolbar
Sidnioulz Sep 22, 2025
eec6c47
Update build-config and package.json: Add './internal/preview-api' to…
ndelangen Sep 23, 2025
4fac215
Merge branch 'next' into norbert/cleanup-entrypoints-core
ndelangen Sep 23, 2025
c950bf9
Merge branch 'next' into 32171-fix-svelte-inherited-attrs-doc
JReinhold Sep 23, 2025
c9be755
Merge branch 'next' into more-win-fix
ndelangen Sep 24, 2025
10c1a03
Refactor preset imports in Angular framework to use fileURLToPath for…
ndelangen Sep 24, 2025
83663e2
let's debug this
ndelangen Sep 24, 2025
7d9bf70
debug more
ndelangen Sep 24, 2025
61d7de7
Remove unused Angular preset file to streamline framework imports
ndelangen Sep 24, 2025
96b20d4
Merge branch 'next' into pr/mrginglymus/32477
ndelangen Sep 24, 2025
7aa2c8d
cleanup debugging
ndelangen Sep 24, 2025
321d812
remove re-throwing error
ndelangen Sep 24, 2025
50afef0
Merge branch 'next' into fix/json-array-add-value
ndelangen Sep 24, 2025
a73cd59
Merge branch 'next' into 32171-fix-svelte-inherited-attrs-doc
JReinhold Sep 24, 2025
a529cbe
Next.js: Remove next/config usage in Next.js >=v16 projects
valentinpalkovic Sep 24, 2025
79373dc
Improve sidebar empty state
ghengeveld Sep 24, 2025
9a12924
Fix missing props
ghengeveld Sep 24, 2025
fa20aff
Merge branch 'next' into improve-empty-sidebar
ghengeveld Sep 24, 2025
2aedd3d
Merge branch 'next' into improve-empty-sidebar
ghengeveld Sep 24, 2025
18a30d8
Apply suggestions from code review
ghengeveld Sep 24, 2025
2e13905
Merge pull request #32512 from takashi-kasajima/fix/json-array-add-value
ndelangen Sep 25, 2025
2a9f873
Add missing import
valentinpalkovic Sep 25, 2025
ca13a96
Apply suggestions from code review
JReinhold Sep 25, 2025
1a31c48
Merge pull request #32477 from mrginglymus/more-win-fix
ndelangen Sep 25, 2025
0f78a19
Re-apply missing changes: add type checking section and update sandbo…
Copilot Sep 25, 2025
24f1e61
Refactor: Update main config handling and restore wrapGetAbsolutePath…
ndelangen Sep 25, 2025
bcca116
Merge pull request #32548 from storybookjs/improve-empty-sidebar
ghengeveld Sep 25, 2025
0bcdc29
Merge pull request #32339 from storybookjs/copilot/fix-32338
JReinhold Sep 25, 2025
4da70a6
add fallback to loadMainConfig by adding migration assistant header
ndelangen Sep 25, 2025
2e9a5c9
Revert "Refactor: Update main config handling and restore wrapGetAbso…
ndelangen Sep 25, 2025
58ca51f
Enhance loadMainConfig: Add temporary fix for ESM validation and impr…
ndelangen Sep 25, 2025
414611f
Add fix for ESM require usage in Storybook configuration
ndelangen Sep 25, 2025
5c96558
Refactor: Simplify ESM usage detection in fix-faux-esm-require
ndelangen Sep 25, 2025
384cbd0
Merge branch 'next' into norbert/sb10-upgrade-with-require-in-main
ndelangen Sep 25, 2025
7835c12
add svelte-ecosystem-ci script
JReinhold Sep 25, 2025
142c7f5
fix path typo
JReinhold Sep 25, 2025
4432d7b
use build mode for test runner instead
JReinhold Sep 25, 2025
f66da1a
try no-link mode
JReinhold Sep 25, 2025
01c9e29
Refactor: Centralize banner comment for ESM require handling
ndelangen Sep 25, 2025
25ab43b
Merge branch 'norbert/sb10-upgrade-with-require-in-main' of https://g…
ndelangen Sep 25, 2025
aadcab7
Refactor: Enhance require usage detection in mainConfigFile
ndelangen Sep 25, 2025
b8c0048
Remove debug logging from fixFauxEsmRequire utility
ndelangen Sep 25, 2025
4733ea2
try building @storybook/svelte separately
JReinhold Sep 25, 2025
31f99af
install deps first 🤦
JReinhold Sep 25, 2025
9dd0cd4
don't run test-runner twice 🤦
JReinhold Sep 25, 2025
c2f498a
Fix requested changes
valentinpalkovic Sep 26, 2025
21bc3d3
Merge branch 'next' into 32171-fix-svelte-inherited-attrs-doc
JReinhold Sep 26, 2025
b21567f
Apply suggestion from @valentinpalkovic
ndelangen Sep 26, 2025
47c04c6
Apply suggestion from @Copilot
ndelangen Sep 26, 2025
0988bbe
Fix: Update log messages for main config loading and migration assist…
ndelangen Sep 26, 2025
b03194d
Merge branch 'norbert/sb10-upgrade-with-require-in-main' of https://g…
ndelangen Sep 26, 2025
0c1fb28
Refactor: Simplify check method in fixFauxEsmRequire utility
ndelangen Sep 26, 2025
e91cd92
Apply suggestion from @Copilot
ndelangen Sep 26, 2025
f635045
Refactor: Update tests for fixFauxEsmRequire utility
ndelangen Sep 26, 2025
756b758
Merge pull request #32173 from steciuk/32171-fix-svelte-inherited-att…
JReinhold Sep 26, 2025
b81780a
Merge pull request #32547 from storybookjs/valentin/drop-support-for-…
ndelangen Sep 26, 2025
e14260f
Merge pull request #32558 from storybookjs/norbert/sb10-upgrade-with-…
ndelangen Sep 26, 2025
dbdd857
Merge pull request #32507 from storybookjs/norbert/cleanup-entrypoint…
ndelangen Sep 26, 2025
c957827
React Native: Fix document reference error in open-in-editor when imp…
dannyhw Sep 26, 2025
3c8cf0c
fix: relative import to fix issue with bundling
dannyhw Sep 27, 2025
fadeabc
Merge pull request #32572 from storybookjs/dannyhw/feat/rn-fix-opened…
shilman Sep 28, 2025
c3f22cf
Merge branch 'next' into add-eject-button-to-canvas-toolbar
shilman Sep 28, 2025
df23220
Merge pull request #29825 from mihkeleidast/add-eject-button-to-canva…
shilman Sep 28, 2025
4f01283
fix layout stories
yannbf Sep 29, 2025
60a567c
skip nx remote cache for compilation
JReinhold Sep 29, 2025
aa29902
Merge pull request #32564 from storybookjs/svelte-ecosystem-ci
JReinhold Sep 29, 2025
93afdba
Merge pull request #32577 from storybookjs/yann/fix-layout-stories
ndelangen Sep 29, 2025
f7e6ce3
Fix `storybook:external-globals-plugin` to handle an `undefined` cach…
walkerburgin Sep 29, 2025
79b35ae
Merge pull request #32579 from walkerburgin/wburgin/external-globals-…
ndelangen Sep 30, 2025
c1002cb
Angular: Enable experimental zoneless detection on Angular v21
yannbf Sep 30, 2025
bef0400
update links and paths in the docs
yannbf Sep 30, 2025
55d57b9
Merge pull request #32580 from storybookjs/yann/enable-zoneless-on-an…
yannbf Sep 30, 2025
9b83c6b
Write changelog for 10.0.0-beta.8 [skip ci]
storybook-bot Sep 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
323 changes: 323 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,323 @@
# GitHub Copilot Instructions for Storybook

This document provides comprehensive instructions for GitHub Copilot when working on the Storybook repository.

## Repository Overview

Storybook is a large monorepo built with TypeScript, React, and various other frameworks. The main codebase is located in the `code/` directory, with additional tooling in `scripts/`.

## System Requirements

- **Node.js**: 22.16.0 (see `.nvmrc`)
- **Package Manager**: Yarn 4.9.1
- **Operating System**: Linux/macOS (CI environment)

## Repository Structure

```
storybook/
├── .github/ # GitHub configurations and workflows
├── code/ # Main monorepo codebase
│ ├── .storybook/ # Configuration for internal UI Storybook
│ ├── core/ # Core Storybook package
│ ├── lib/ # Core supporting libraries
│ ├── addons/ # Core Storybook addons
│ ├── builders/ # Builder integrations
│ ├── renderers/ # Renderer integrations
│ ├── frameworks/ # Framework integrations
│ ├── presets/ # Preset packages for Webpack-based integrations
│ └── sandbox/ # Internal build artifacts (not useful for anything, ignore)
├── sandbox/ # Generated sandbox environments (created by yarn task --task sandbox)
├── scripts/ # Build and development scripts
├── docs/ # Documentation
└── test-storybooks/ # Test configurations
```

## Essential Commands and Build Times

### Installation & Setup
```bash
# Install all dependencies (run from repository root)
yarn i
# Time: ~2.5 minutes
# Timeout: Use 300+ seconds for bash commands
```

### Compilation
```bash
# Compile all packages (run from repository root)
yarn task --task compile
# Time: ~3 minutes (tested: 3m0.729s)
# Timeout: Use 300+ seconds for bash commands
```

### Linting
```bash
# Run all linting checks (run from repository root)
yarn lint
# Time: ~4 minutes
# Timeout: Use 300+ seconds for bash commands
```

### Type Checking
```bash
# Run TypeScript type checking across all packages (run from repository root)
yarn task --task check
# Time: Variable, depends on codebase size
# Timeout: Use 300+ seconds for bash commands
```

### Development Server
```bash
# Start Storybook UI development server (run from code/ directory)
cd code && yarn storybook:ui
# Time: ~2.26 seconds startup time
# Serves on: http://localhost:6006/
# Note: This runs indefinitely - use timeout or async mode
# Note: This requires the repository to be compiled first, see Compilation above

# Build Storybook UI for production (run from code/ directory)
cd code && yarn storybook:ui:build
# Time: ~1m 46s
# Output: code/storybook-static/
# Note: This does NOT run indefinitely
# Note: This requires the repository to be compiled first, see Compilation above
```

### Testing
```bash
# Run all tests (run from code/ directory)
cd code && yarn test
# Time: Variable, depends on test scope
# Watch mode for continuous testing
cd code && yarn test:watch

# Storybook UI specific tests
cd code && yarn storybook:vitest

# Available task-based testing commands
yarn task --task e2e-tests-build # E2E tests for built Storybook
yarn task --task e2e-tests-dev # E2E tests for dev server
yarn task --task test-runner-build # Test runner for built Storybook
yarn task --task test-runner-dev # Test runner for dev server
yarn task --task smoke-test # Basic smoke tests
yarn task --task vitest-test # Vitest integration tests
```

## Important Warnings and Limitations

### Commands to Avoid
- **DO NOT RUN**: `yarn task --task dev` - This starts a permanent development server that runs indefinitely and will cause timeouts
- **DO NOT RUN**: `yarn start` - This also starts a long-running development server

### Available Task Commands
The repository includes 20 task scripts in `scripts/tasks/`:
- `bench` - Performance benchmarking
- `build` - Package building
- `check` - Package validation
- `chromatic` - Visual testing with Chromatic
- `compile` - TypeScript compilation
- `dev` - Development server (AVOID - runs indefinitely)
- `e2e-tests-build` - E2E tests for built Storybook
- `e2e-tests-dev` - E2E tests for dev server
- `generate` - Code generation
- `install` - Dependency installation
- `publish` - Package publishing
- `run-registry` - Local npm registry
- `sandbox` - Sandbox creation (may occasionally fail due to environment issues)
- `serve` - Static serving
- `smoke-test` - Basic functionality tests
- `sync-docs` - Documentation synchronization
- `test-runner-build` - Test runner for built Storybook
- `test-runner-dev` - Test runner for dev server
- `vitest-test` - Vitest integration tests

### Known Issues
1. **Sandbox Generation Dependencies**: Sandbox creation may occasionally fail due to environment-specific issues (like Yarn version conflicts), but the GitHub API rate limiting has been resolved
```bash
# Sandbox generation now works in CI environments
yarn task --task sandbox --template react-vite/default-ts
```

2. **Dependency Warnings**: The build process shows many peer dependency warnings, but these are expected and don't prevent successful builds

3. **Large Build Times**: Most build operations take several minutes - always use appropriate timeouts

4. **Sandbox Generation**: Generally reliable in CI environments, though may occasionally fail due to dependency or environment-specific issues

## Recommended Development Workflow

### For Code Changes
1. Install dependencies: `yarn i` (if needed)
2. Compile packages: `yarn task --task compile`
3. Make your changes
4. Compile packages with `cd code && yarn task --task compile`
5. Test changes with: `cd code && yarn storybook:ui:build`
6. Run relevant tests: `cd code && yarn test`

### For Testing UI Changes
1. Generate a sandbox with: `yarn task --task sandbox --template [framework-template]` (may occasionally fail due to environment issues)
2. If sandbox generation fails, use Storybook UI: `cd code && yarn storybook:ui`
3. Access at http://localhost:6006/

### For Addon/Framework/Renderers Development
1. Navigate to the relevant package in `code/addons/`, `code/frameworks/` or `code/renderers/`
2. Make changes to source files
3. Rebuild with compilation command
4. Generate a sandbox that matches the framework/renderer being worked on
5. Test with the appropriate test tasks

## Bash Command Guidelines

### Timeout Settings
- **Short commands** (< 30s): Default timeout (120s) is sufficient
- **Dependency installation**: Use 300+ seconds timeout
- **Compilation**: Use 300+ seconds timeout
- **Linting**: Use 300+ seconds timeout
- **Development servers**: Use async mode or timeout commands

### Example Bash Commands
```bash
# Safe compilation with proper timeout
bash(command="cd /path/to/storybook && yarn task --task compile", timeout=300, async=false)

# Start development server with timeout to prevent hanging
bash(command="cd /path/to/storybook/code && timeout 30s yarn storybook:ui", timeout=45, async=false)

# Use async for interactive or long-running commands
bash(command="cd /path/to/storybook/code && yarn storybook:ui", async=true)
```

## Sandbox Environments

### Generating New Sandboxes
Sandboxes are test environments that allow you to test Storybook changes with different framework combinations. **Note**: Sandbox creation generally works in CI environments, though may occasionally fail due to dependency or environment-specific issues.

```bash
# Generate a new sandbox (run from repository root)
yarn task --task sandbox --template react-vite/default-ts
# Creates: sandbox/react-vite-default-ts/
# Note: May occasionally fail due to environment-specific issues (e.g., Yarn version conflicts)
```

### Available Framework/Builder Templates
Common templates include:
- `react-vite/default-ts` - React with Vite and TypeScript
- `react-webpack/default-ts` - React with Webpack and TypeScript
- `angular-cli/default-ts` - Angular CLI with TypeScript
- `svelte-vite/default-ts` - Svelte with Vite and TypeScript
- `vue3-vite/default-ts` - Vue 3 with Vite and TypeScript
- `nextjs/default-ts` - Next.js with TypeScript
- And many more...

### Working with Generated Sandboxes
Once a sandbox is successfully generated, you can work with it:
```bash
# Navigate to the generated sandbox (in root sandbox/ directory)
cd sandbox/react-vite-default-ts

# Install dependencies if needed
yarn install

# Start the sandbox Storybook
yarn storybook
```

### Current Limitations
- **Environment-Specific Issues**: Sandbox creation may occasionally fail due to dependency conflicts (e.g., Yarn version management), but the GitHub API rate limiting has been resolved
- **Workaround**: For testing changes when sandbox generation fails, you can work directly with the Storybook UI instead
- The `code/sandbox/` directory contains internal build artifacts and should not be used for testing

### Testing Changes Without Sandboxes
When sandbox generation is not available:
1. Make your changes to the relevant packages in `code/`
2. Compile: `yarn task --task compile`
3. Test with Storybook UI: `cd code && yarn storybook:ui`
4. Access at http://localhost:6006/ to test your changes

## Package Management

### Adding Dependencies
```bash
# Add to specific workspace
cd code/frameworks/react-vite && yarn add <package>

# Add to root workspace
yarn add <package> -W
```

### Building Specific Packages
```bash
# Build specific package (run from code/ directory)
cd code && yarn build <package-name>
```

## Testing Strategy

### Unit Tests
```bash
cd code && yarn test
# Run specific test suites as needed
```

### Visual Testing
- Use Storybook UI for visual regression testing
- Chromatic integration available for visual reviews

### End-to-End Testing
- Playwright tests available (version 1.52.0 configured)
- E2E test tasks: `yarn task --task e2e-tests-build` or `yarn task --task e2e-tests-dev`
- Test runner scenarios: `yarn task --task test-runner-build` or `yarn task --task test-runner-dev`
- Smoke tests: `yarn task --task smoke-test`

### Watch Mode Commands
```bash
# Watch mode for unit tests
cd code && yarn test:watch

# Watch mode for affected tests only
yarn affected:test

# Storybook UI vitest watch mode
cd code && yarn storybook:vitest
```

## Troubleshooting

### Common Issues
1. **Build Failures**: Often resolved by running `yarn i` followed by `yarn task --task compile`
2. **Port Conflicts**: Storybook UI uses port 6006 by default
3. **Memory Issues**: Large compilation tasks may require increased Node.js memory limits
4. **Environment-Specific Issues**: Sandbox generation may occasionally fail due to dependency conflicts - use Storybook UI for testing as fallback
5. **Sandbox Directory Confusion**: Use root `sandbox/` directory for generated sandboxes, not `code/sandbox/`

### Debug Information
- Storybook logs available in generated sandbox directories
- Use `--debug` flag with CLI commands for verbose output
- Check `.cache/` directories for build artifacts

## Performance Tips

1. **Incremental Builds**: Use compilation cache when possible
2. **Selective Building**: Build only changed packages during development
3. **Memory Management**: Monitor memory usage during large operations
4. **Parallel Processing**: Yarn commands use parallel processing by default

## Contributing Guidelines

### Code Style
- ESLint and Prettier configurations are enforced
- TypeScript strict mode is enabled
- Follow existing patterns in the codebase

### Git Workflow
- Work on feature branches
- Ensure all builds and tests pass before submitting PRs
- Include relevant documentation updates

### Documentation
- Update relevant README files for significant changes
- Include code examples in addon/framework documentation
- Update migration guides for breaking changes

This document should be updated as the repository evolves and new build requirements or limitations are discovered.
14 changes: 14 additions & 0 deletions CHANGELOG.prerelease.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## 10.0.0-beta.8

- Addon-docs: Add eject button to canvas toolbar - [#29825](https://github.com/storybookjs/storybook/pull/29825), thanks @mihkeleidast!
- Angular: Enable experimental zoneless detection on Angular v21 - [#32580](https://github.com/storybookjs/storybook/pull/32580), thanks @yannbf!
- AutoMigration: Fix sb10 migration when main config contains `require` - [#32558](https://github.com/storybookjs/storybook/pull/32558), thanks @ndelangen!
- Cleanup: Remove duplicated entrypoints in core - [#32507](https://github.com/storybookjs/storybook/pull/32507), thanks @ndelangen!
- Controls: Fix adding new values to arrays - [#32512](https://github.com/storybookjs/storybook/pull/32512), thanks @takashi-kasajima!
- Core: Fix `external-globals-plugin` handle `undefined` cache dir - [#32579](https://github.com/storybookjs/storybook/pull/32579), thanks @walkerburgin!
- Core: Use `exsolve` `resolveModulePath` for `safeResolveModule` - [#32477](https://github.com/storybookjs/storybook/pull/32477), thanks @mrginglymus!
- Next.js: Remove next/config usage in Next.js >=v16 projects - [#32547](https://github.com/storybookjs/storybook/pull/32547), thanks @valentinpalkovic!
- React Native: Fix document reference error in open-in-editor - [#32572](https://github.com/storybookjs/storybook/pull/32572), thanks @dannyhw!
- Svelte: Ignore inherited `HTMLAttributes` docgen when using utility types - [#32173](https://github.com/storybookjs/storybook/pull/32173), thanks @steciuk!
- UI: Improve sidebar empty state - [#32548](https://github.com/storybookjs/storybook/pull/32548), thanks @ghengeveld!

## 10.0.0-beta.7

- Addon A11y: Prevent setting highlights for old results - [#32178](https://github.com/storybookjs/storybook/pull/32178), thanks @ghengeveld!
Expand Down
4 changes: 2 additions & 2 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -567,10 +567,10 @@ When setting the `core.builder` or `core.builder.name` option in the main config
In a preset:

```diff
import { dirname, join } from 'node:path';
import { dirname } from 'node:path';

const getAbsolutePath = (input) =>
dirname(require.resolve(join(input, 'package.json')));
dirname(require.resolve(`${input}/package.json`));

export const core = {
- builder: getAbsolutePath('@storybook/builder-vite'),
Expand Down
Loading
Loading