Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem running storyboard as layer app #842

Open
karladler opened this issue Jan 15, 2025 · 1 comment
Open

problem running storyboard as layer app #842

karladler opened this issue Jan 15, 2025 · 1 comment

Comments

@karladler
Copy link

karladler commented Jan 15, 2025

Is it possible to run storybook as a nuxt layer app?

I setup everything like in the guide, except that it's inside a layer app folder.
There are still a few other issues starting storybook from within the layer app folder that are already addressed in other issues here, but storybook starts running "npm run storybook" from the folder.

But when I start my whole app it seems to initialize storyboard all the time on root level.

Symptoms:

  • yields "📚 Storybook is not installed"
  • adds dependencies to root package.json
  • adds .storyboard folder with main.ts and preview.ts

Is there any example how I can use storybook as a nuxt layer app? Any ideas how to fix the problem?

layer package json:

{
  "name": "storybook",
  "version": "1.0.0",
  "type": "module",
  "main": "./nuxt.config.ts",
  "dependencies": {
    "@nuxtjs/storybook": "npm:@nuxtjs/storybook@nightly"
  },
  "devDependencies": {
    "storybook": "^8.5.0-beta.11",
    "@types/node": "^18.17.5",
    "@storybook/vue3": "^8.5.0-beta.11",
    "@storybook-vue/nuxt": "^8.3.3",
    "@storybook/addon-links": "^8.5.0-beta.11",
    "@storybook/builder-vite": "^8.5.0-beta.11",
    "@storybook/addon-essentials": "^8.5.0-beta.11",
    "@storybook/addon-interactions": "^8.5.0-beta.11",
    "@storybook/test": "^8.5.0-beta.11",
    "@storybook/blocks": "^8.5.0-beta.11"
  },
  "scripts": {
    "storybook": "storybook dev",
    "build-storybook": "storybook build"
  }
}

Edit one of the problems seem to be that the config dir is derived only from nuxt root:

configDir: resolve(projectDir, './.storybook'),

@gretchelin
Copy link

gretchelin commented Jan 16, 2025

I'm also facing similar issue when running the app from root with storybook set up to be layer-specific dependecies.

In my project I have other issues though:

  1. the stuff installed by this step --storybook running init on root level dev run-- is outdated as mentioned in this issue: The command "npx storybook-nuxt init" adds not up to date deps to the project #841 (it was recommended in other issues here to update each installed packaged manually to latest because the "init" step - mentioned in the getting started guide - is not updated).

  2. when running npm run dev from root level which doesn't have storybook, storybook seemed to be looping. It would detect no storybook installed and setup the module again and after it's done, to loop again and again. (I have multiple layers in this project and only 1 uses storybook, so I don't know it it's looping the same amount of layer, or just some initialization bug).

As of running storybook from layer itself, I have no issue as I run it directly from layer folder (I'm using npm workspace) using npm run storybook, or by npm run storybook -w storybook-layer (since I'm running from the context of storybook layer, I don't need to explicitly define --config-dir and no additional storybook dep init is happening)

My nuxt3 folder structure is like this:

core-layer
util-layer
layers > feat1, feat2, feat3 
storybook-layer > nuxt.config.ts, package.json
nuxt.config.ts
package.json

Is there an option to turn off / opt-out storybook auto running on "dev" run in root level?

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

No branches or pull requests

2 participants