Skip to content

Commit

Permalink
chore: upgrade storybook to v7 (ory#121)
Browse files Browse the repository at this point in the history
* chore: upgrade storybook to v7

* style: format
  • Loading branch information
Benehiko authored Aug 8, 2023
1 parent 1bd1b9b commit 86fc13f
Show file tree
Hide file tree
Showing 3 changed files with 15,935 additions and 28,647 deletions.
25 changes: 18 additions & 7 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
import { dirname, join } from "path"
// Copyright © 2023 Ory Corp
// SPDX-License-Identifier: Apache-2.0

const { vanillaExtractPlugin } = require("@vanilla-extract/vite-plugin")
const { mergeConfig } = require("vite")

module.exports = {
stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
getAbsolutePath("@storybook/addon-links"),
getAbsolutePath("@storybook/addon-essentials"),
getAbsolutePath("@storybook/addon-interactions"),
],
framework: "@storybook/react",
core: {
builder: "@storybook/builder-vite",
framework: {
name: getAbsolutePath("@storybook/react-vite"),
options: {},
},
typescript: {
reactDocgen: "react-docgen", // 👈 react-docgen configured here.
},

async viteFinal(config) {
return mergeConfig(config, {
plugins: [vanillaExtractPlugin()],
Expand All @@ -26,4 +27,14 @@ module.exports = {
features: {
storyStoreV7: true,
},
docs: {
autodocs: true,
},
}
/**
* This function is used to resolve the absolute path of a package.
* It is needed in projects that use Yarn PnP or are set up within a monorepo.
*/
function getAbsolutePath(value) {
return dirname(require.resolve(join(value, "package.json")))
}
Loading

0 comments on commit 86fc13f

Please sign in to comment.