fix(cli): remove @o2s/framework references from Storybook config during scaffold#842
fix(cli): remove @o2s/framework references from Storybook config during scaffold#842tranhoangtu-it wants to merge 1 commit intoo2sdev:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughA new helper function Changes
Estimated Code Review Effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR fixes a create-o2s-app scaffolding issue where Storybook fails to start due to stale .storybook/main.ts references to the removed packages/framework workspace.
Changes:
- Add a scaffold cleanup step that removes
@o2s/framework/*entries from StorybookoptimizeDeps.includeandresolve.alias. - Run the Storybook config cleanup automatically as part of
cleanupProject().
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| let content = await fs.readFile(configPath, 'utf-8'); | ||
|
|
||
| // Remove @o2s/framework lines from optimizeDeps.include | ||
| content = content.replace(/\s*'@o2s\/framework\/modules',?\n?/g, ''); | ||
| content = content.replace(/\s*'@o2s\/framework\/sdk',?\n?/g, ''); | ||
|
|
||
| // Remove @o2s/framework alias lines from resolve.alias | ||
| content = content.replace(/\s*'@o2s\/framework\/sdk':.*\n/g, ''); | ||
| content = content.replace(/\s*'@o2s\/framework\/modules':.*\n/g, ''); | ||
|
|
||
| await fs.writeFile(configPath, content, 'utf-8'); | ||
| }; |
There was a problem hiding this comment.
cleanStorybookConfig always rewrites .storybook/main.ts even when none of the patterns match (e.g., templates without the framework aliases). This adds unnecessary I/O and can change file timestamps during scaffolding. Consider only calling writeFile when the transformed content differs from the original read content.
| // Remove @o2s/framework lines from optimizeDeps.include | ||
| content = content.replace(/\s*'@o2s\/framework\/modules',?\n?/g, ''); | ||
| content = content.replace(/\s*'@o2s\/framework\/sdk',?\n?/g, ''); | ||
|
|
||
| // Remove @o2s/framework alias lines from resolve.alias | ||
| content = content.replace(/\s*'@o2s\/framework\/sdk':.*\n/g, ''); | ||
| content = content.replace(/\s*'@o2s\/framework\/modules':.*\n/g, ''); |
There was a problem hiding this comment.
The Storybook cleanup uses several near-identical regex replace calls. This duplication makes it easy to miss future framework entrypoints (or introduce inconsistencies between optimizeDeps and resolve.alias removals). Consider centralizing the list of framework specifiers/aliases and applying the removals in a loop so it stays consistent as the template evolves.
Fixes #836
After scaffolding with
create-o2s-app, Storybook fails because.storybook/main.tscontains resolve aliases andoptimizeDepsentries pointing topackages/framework/paths that no longer exist (removed byALWAYS_REMOVE_DIRS).Changes
Added
cleanStorybookConfig()tocleanup.tsthat strips:@o2s/framework/modulesand@o2s/framework/sdkfromoptimizeDeps.include@o2s/framework/sdkand@o2s/framework/modulesalias entries fromresolve.aliasRuns automatically after directory cleanup, so the Storybook config is consistent with the scaffolded project structure.
Summary by CodeRabbit