Skip to content

Commit

Permalink
Merge branch 'main' into renovate/eslint-8.x-lockfile
Browse files Browse the repository at this point in the history
  • Loading branch information
chakAs3 authored Apr 9, 2024
2 parents 527f7c8 + da64531 commit 02d2402
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 27 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Integrate [Storybook](http://storybook.js.org) into your [Nuxt](https://nuxt.com
## Installing

```
pnpm add -D @nuxtjs/storybook
npx nuxi@latest module add storybook
```

Update your `nuxt.config`:
Expand Down
2 changes: 1 addition & 1 deletion docs/content/0.index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ cta:
secondary:
- Star on GitHub →
- https://github.com/nuxt-modules/storybook
snippet: pnpm add -D @nuxtjs/storybook
snippet: npx nuxi@latest module add storybook
---

#title
Expand Down
17 changes: 2 additions & 15 deletions docs/content/1.getting-started/1.setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,10 @@ Using Storybook in your Nuxt project is only one command away ✨
## Installation

1. Install `@nuxtjs/storybook` dependency to your project:

::code-group

```bash [yarn]
yarn add -D @nuxtjs/storybook
```

```bash [npm]
npm install -D @nuxtjs/storybook
```

```sh [pnpm]
pnpm i -D @nuxtjs/storybook
```bash
npx nuxi@latest module add storybook
```

::

2. Add it to your `modules` section in your `nuxt.config`:

::code-group
Expand Down
11 changes: 4 additions & 7 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import { setupStorybook } from './storybook'
export interface ModuleOptions {
/**
* StorybookAPI URL
* @default process.env.STORYBOOK_URL
* @default import.meta.env.STORYBOOK_URL
* @example 'http://localhost:6006'
* @type string
*/
url?: string

/**
* StorybookVersion
* @default 'v7'
* @default 'v8'
* @type string
* @example 'v8'
*/
Expand Down Expand Up @@ -58,7 +58,7 @@ export default defineNuxtModule<ModuleOptions>({
},
},
defaults: {
url: process.env.STORYBOOK_URL || 'http://localhost:6006',
url: import.meta.env.STORYBOOK_URL || 'http://localhost:6006',
storybookRoute: '/__storybook_route',
port: 6006,
version: 'v8',
Expand All @@ -67,13 +67,10 @@ export default defineNuxtModule<ModuleOptions>({
},
async setup(options, nuxt) {

if(process.env.__STORYBOOK__)
if(import.meta.env.__STORYBOOK__)
return

logger.info('🔌 Storybook Module Setup')
// Default runtimeConfig

nuxt.options.ssr = false

setupStorybook(options, nuxt)
},
Expand Down
3 changes: 0 additions & 3 deletions src/storybook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ export async function setupStorybook(options: any, nuxt: Nuxt) {
config.optimizeDeps ??= {}
config.optimizeDeps.include = config.optimizeDeps.include || []

nuxt.options.devtools = { enabled: true}

config.server ??= {}
config.server.proxy ??= {}

Expand Down Expand Up @@ -102,7 +100,6 @@ export async function setupStorybook(options: any, nuxt: Nuxt) {
logger.info(' ')
logger.info('✔ Storybook build done ')
logger.info(' ')
nuxt.options.devtools = {enabled:true}
process.env.__STORYBOOK__ = JSON.stringify( options )
})

Expand Down

0 comments on commit 02d2402

Please sign in to comment.