Skip to content

[Bug] CLI scaffold: Storybook fails due to broken @o2s/framework aliases in .storybook/main.ts #836

@michnowak

Description

@michnowak

Describe the bug
After scaffolding a project with create-o2s-app, Storybook fails to start because .storybook/main.ts contains resolve aliases and optimizeDeps entries pointing to local packages/framework/ paths that no longer exist.

The packages/framework directory is always removed during scaffolding (listed in ALWAYS_REMOVE_DIRS in constants.ts), but the Storybook config still references:

  • Resolve aliases (lines 91-92):
    • '@o2s/framework/sdk': path.resolve(__dirname, '../packages/framework/src/sdk.ts')
    • '@o2s/framework/modules': path.resolve(__dirname, '../packages/framework/src/index.ts')
  • optimizeDeps.include (lines 75-76):
    • '@o2s/framework/modules'
    • '@o2s/framework/sdk'

To Reproduce

  1. Run npx create-o2s-app and select the "custom" template (or any template)
  2. Complete the wizard
  3. After scaffolding, try to run Storybook with npm run storybook
  4. Storybook fails because it cannot resolve the framework paths

Expected behavior
Storybook should start correctly after scaffolding. The CLI should include a transform that removes or updates the @o2s/framework references in .storybook/main.ts when the framework package is not present locally.

Proposed solution
Add a new transform (e.g., transform-storybook-config.ts) in packages/cli/create-o2s-app/src/scaffold/ that:

  1. Removes the @o2s/framework/sdk and @o2s/framework/modules entries from resolve.alias
  2. Removes the corresponding entries from optimizeDeps.include
  3. Follows the same regex-based pattern used by existing transforms (e.g., transform-app-module.ts)

This transform should run as part of the scaffold pipeline in scaffold/index.ts.

Additional context
All existing transforms are in packages/cli/create-o2s-app/src/scaffold/ and follow a consistent regex-based line filtering pattern. The new transform should follow the same conventions.


This repo is using Opire - what does it mean? 👇
💵 Everyone can add rewards for this issue commenting /reward 100 (replace 100 with the amount).
🕵️‍♂️ If someone starts working on this issue to earn the rewards, they can comment /try to let everyone know!
🙌 And when they open the PR, they can comment /claim #836 either in the PR description or in a PR's comment.

🪙 Also, everyone can tip any user commenting /tip 20 @michnowak (replace 20 with the amount, and @michnowak with the user to tip).

📖 If you want to learn more, check out our documentation.

Branch: fix/storybook-broken-framework-aliases-836

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions