Socket
Socket
Sign inDemoInstall

storybook-vue-addon

Package Overview
Dependencies
4
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    storybook-vue-addon

Storybook stories in native Vue format


Version published
Weekly downloads
982
decreased by-26.39%
Maintainers
1
Created
Weekly downloads
 

Changelog

Source

0.1.0 (2023-01-09)

🔖 Features

  • add debug logging (8099174)
  • add story template as source code (1c2ddf2)
  • add storybook addon (f767fcd)
  • add support for component option in default export (3cf7fb0)
  • allow comments before main <Stories> tag (cfc2358)
  • combine imports for multiple stories (b9541ff)
  • implement transform of simple cases (3a8fed2)
  • prototype of how vue -> storybook transform can work (b14378c)
  • support script and setup script (db343dc)
  • support special characters in story names (f545607)
  • support vue plugin in pipeline (d4f1b18)

🧹 Miscellaneous

  • add devcontainer (6dd4038)
  • add example vite application (fbe662a)
  • add exception for spelling (946d56c)
  • add missing pnpm install (24fda93)
  • add plugin to storybook vite config (8812b73)
  • change owner in license to Tobias Diez (7997113)
  • deps: update all non-major dependencies (#14) (b7ff47e)
  • deps: update all non-major dependencies (#19) (e1d2504)
  • deps: update all non-major dependencies (#8) (2d90aca)
  • deps: update dependency unplugin to v1 (#15) (eda0d0d)
  • deps: update devdependency @nuxtjs/eslint-config-typescript to v12 (#16) (0b7c484)
  • deps: update devdependency @vitejs/plugin-vue to v4 (#20) (3b0b830)
  • deps: update devdependency babel-loader to v9 (#21) (e08bc26)
  • deps: update devdependency rollup to v3 (#9) (d9a5812)
  • deps: update devdependency vite to v3 (#11) (20fdcbf)
  • deps: update devdependency vite to v4 (#18) (ec756c0)
  • deps: update devdependency vue-tsc to v1 (#22) (73b67ae)
  • enable pnpm in build (638ef3d)
  • fix a few eslint errors (8cd1f25)
  • fix devcontainer build (83b45af)
  • fix storybook start with new node versions (f522d16)
  • fix test command (9cf8b93)
  • fix ts and lint errors (619fe17)
  • ignore missing peer dependencies (66abfcd)
  • include examples in renovate update (9585baa)
  • initial release (a1e937d)
  • reformat everything (802b5c0)
  • remove unnecessary scripts from package.json (6ba7da5)
  • setup eslint and prettier (fe7aaaf)
  • setup funding (baa8e6f)
  • setup playground (75188bf)
  • setup renovate (e785d47)
  • update github action workflows (4a4f2e9)
  • update lock file (b182f1f)
  • update package metadata (89a16bf)

Readme

Source

Storybook Vue Addon

npm version npm downloads Github Actions Codecov

A Storybook addon that allows to write stories in native Vue syntax and compiles it to Storybook's CSF format.

Example: Button.stories.vue

<script setup lang="ts">
import Button from './Button.vue'
</script>
<template>
  <Stories
    title="Stories in Vue format 😍"
    :component="Button"
  >
    <Story title="Primary">
      <Button
        background="#ff0"
        label="Button"
      />
    </Story>
    <Story title="Secondary">
      <Button
        background="#ff0"
        label="😄👍😍💯"
      />
    </Story>
    <Story title="Tertiary">
      <Button
        background="#ff0"
        label="📚📕📈🤓"
      />
    </Story>
  </Stories>
</template>

Features

This package is currently in an early alpha stage and supports only the fundamental Storybook features. Compatibility with more advanced features and addons is work in progress. Please open an issue if you encounter any bugs or missing integrations.

Installation

  1. Add storybook-vue-addon to your dev-dependencies.

    # npm
    npm install --save-dev storybook-vue-addon
    
    # yarn
    yarn add -D storybook-vue-addon
    
    # pnpm
    pnpm add -D storybook-vue-addon
    
  2. In .storybook/main.js, add *.stories.vue to the stories patterns and storybook-vue-addon as an addon.

      "stories": [
        "../src/**/*.stories.mdx",
    -    "../src/**/*.stories.@(js|jsx|ts|tsx)"
    +    "../src/**/*.stories.@(js|jsx|ts|tsx|vue)"
      ],
      ...
      "addons": [
        "@storybook/addon-essentials",
    +   "storybook-vue-addon"
      ],
    
    

Manual usage

If for whatever reason you process Storybook stories in your build pipeline, you probably want to first transpile the Vue stories to classical CSF stories by adding storybook-vue-addon to your build.

Vite
// vite.config.ts
import VueStories from 'storybook-vue-addon/vite'

export default defineConfig({
  plugins: [
    VueStories({
      /* options */
    }),
  ],
})

Example: playground/


Rollup
// rollup.config.js
import VueStories from 'storybook-vue-addon/rollup'

export default {
  plugins: [
    VueStories({
      /* options */
    }),
  ],
}


Webpack
// webpack.config.js
module.exports = {
  /* ... */
  plugins: [
    require('storybook-vue-addon/webpack')({
      /* options */
    }),
  ],
}


Nuxt
// nuxt.config.js
export default {
  buildModules: [
    [
      'storybook-vue-addon/nuxt',
      {
        /* options */
      },
    ],
  ],
}

This module works for both Nuxt 2 and Nuxt Vite


Vue CLI
// vue.config.js
module.exports = {
  configureWebpack: {
    plugins: [
      require('storybook-vue-addon/webpack')({
        /* options */
      }),
    ],
  },
}


esbuild
// esbuild.config.js
import { build } from 'esbuild'
import VueStories from 'storybook-vue-addon/esbuild'

build({
  plugins: [VueStories()],
})


💻 Development

  • Clone this repository
  • Enable Corepack using corepack enable (use npm i -g corepack for Node.js < 16.10).
  • Install dependencies using pnpm install.

Commands:

  • build: Build everything. Output can be found in dist.
  • dev: Build in watch mode.
  • lint: Check for eslint and prettier issues.
  • test: Run the tests.
  • example:vite: Open the example storybook (using vite).
  • play: Run the playground (currently not used).
  • release: Release a new version to npm.

Keywords

FAQs

Last updated on 09 Jan 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc