This project includes a special feature that automatically updates the Utopia storyboard with scenes for all your React components.
To start development with automatic storyboard updating:
npm run dev
This will start the Vite development server and automatically update the storyboard whenever you make changes to files in the src directory.
The system watches for changes in your source files and automatically updates the storyboard to:
- Add scenes for new components
- Remove scenes for deleted components
- Preserve customizations you've made to existing scenes
- Position new scenes logically based on existing layout
For more information on the automatic storyboard updating, see the storyboard documentation.
Every time you make changes to files in the src
directory, the system:
- Scans your
src
directory for all React components - Creates a scene in the storyboard for each component
- Preserves any customizations you've made to existing scenes
- Removes scenes for components that no longer exist in your code
- Adds new scenes to the right of the furthest right existing scene
- Automatically reorganizes scenes to close gaps and maintain consistent spacing
- Updates the
utopia/storyboard.js
file automatically
When creating scenes for the first time, the system places:
- Playground at position 212 (left)
- App at position 992 (right)
- All other components are positioned to the right of the furthest right scene with 816px spacing
When reorganizing scenes (after removing components), the system:
- Keeps Playground and App in their fixed positions
- Shifts other components to close gaps while maintaining consistent spacing
- Preserves each scene's width, height, and other custom properties
Simply develop your React components as usual in the src
directory. The auto-storyboard system will:
- Find components that are exported from
.js
,.jsx
,.ts
, or.tsx
files - Automatically filter out utility files, index files, and other non-component files
- Create a new scene for each component
- Position the scenes in a logical layout
- Preserve your custom scene sizes, positions, and labels when updating
- Remove scenes for components that have been deleted from your code
- Add new scenes to the right of existing ones
# Start development with automatic storyboard updating
npm run dev
# Start development with verbose output
npm run dev:verbose
# Start Vite server without automatic storyboard updating
npm run start
# Manually update the storyboard
npm run update-storyboard
# Build for production (automatically updates storyboard first)
npm run build
# Preview the production build
npm run preview
For more detailed information on the storyboard updating scripts, see the storyboard documentation.
The system is designed to handle multiple scenes for the same component. For example, if you have:
- A main desktop view of your App component
- A mobile view of the same App component with different dimensions
Both scenes will be preserved as long as the App component still exists in your code.
If you want to update the storyboard without starting the dev server, you have several options:
# Standard update (preserves existing scene configurations, prunes removed components)
npm run update-storyboard
# Include ALL components, preserving scene configurations
npm run update-storyboard:all
# Show verbose output with full file paths
npm run update-storyboard:verbose
# Generate completely fresh storyboard (doesn't preserve existing configurations)
npm run update-storyboard:fresh
# Preserve ALL scenes, even for deleted components
npm run update-storyboard:no-prune
# Start the dev server including ALL components
npm run start:all-components
# Start with a completely fresh storyboard
npm run start:fresh
# Start without removing scenes for deleted components
npm run start:no-prune
When running the script directly, you can use these options:
node scripts/updateStoryboard.js [options]
Options:
--include-utils Include utility files in the storyboard
--include-index Include index files in the storyboard
--verbose Show more detailed output
--no-preserve Don't preserve existing scene configurations (create fresh storyboard)
--no-prune Keep scenes for components that no longer exist
--help Show this help message
The storyboard generator script is located at scripts/updateStoryboard.js
. You can customize it to:
The script has built-in patterns to ignore certain types of files. You can modify these settings at the top of the script:
// Files to ignore - can be exact names or patterns (as strings)
const IGNORED_FILES = [
'index', // Ignore files named index.js, index.jsx, etc.
'utils', // Ignore utility files
// ...add more patterns here
];
// File patterns that should be included even if they match ignore patterns
const FORCE_INCLUDE = [
// Add specific files to always include here if needed
// Example: 'SpecialComponent', 'ImportantUtil'
];
By default, the script will:
-
Preserve your custom scene configurations, including:
- Scene positions (left/top)
- Scene dimensions (width/height)
- Custom labels
- Other scene properties
-
Prune scenes for components that no longer exist in your code.
-
Add new scenes to the right of the furthest right existing scene.
You can disable these behaviors with the appropriate flags:
- Use
--no-preserve
to create a fresh storyboard - Use
--no-prune
to keep scenes for deleted components
You can also modify the script to:
- Change how components are detected
- Modify the scene layout
- Adjust scene sizes or spacing
- Filter which components should be included
- Start the development server:
npm start
- Start with all components:
npm run start:all-components
- Start with a fresh storyboard:
npm run start:fresh
- Start without pruning deleted scenes:
npm run start:no-prune
- Build for production:
npm run build
- Preview the production build:
npm run preview