fix(SW-3691): Setup one prettier config for whole repo * Setup prettierrc in root and remove other configs Approved-by: Joakim Jäderberg Approved-by: Linus Flood
54 lines
1.3 KiB
TypeScript
54 lines
1.3 KiB
TypeScript
import type { StorybookConfig } from "@storybook/nextjs-vite"
|
|
import { mergeConfig } from "vite"
|
|
|
|
const config: StorybookConfig = {
|
|
framework: "@storybook/nextjs-vite",
|
|
stories: [
|
|
"../lib/**/*.mdx",
|
|
"../lib/**/*.stories.@(js|jsx|mjs|ts|tsx)",
|
|
"./content/**/*.mdx",
|
|
],
|
|
addons: [
|
|
"@storybook/addon-links",
|
|
"@storybook/addon-themes",
|
|
"@storybook/addon-vitest",
|
|
"@storybook/addon-docs",
|
|
"@storybook/addon-a11y",
|
|
"storybook-react-intl",
|
|
],
|
|
core: {
|
|
disableTelemetry: true,
|
|
},
|
|
async viteFinal(config) {
|
|
return mergeConfig(config, {
|
|
plugins: [
|
|
// Add babel plugin for react-intl transformation
|
|
{
|
|
name: "formatjs-transform",
|
|
async transform(code, id) {
|
|
if (id.includes("node_modules")) return
|
|
if (!/\.(jsx?|tsx?)$/.test(id)) return
|
|
|
|
const babel = await import("@babel/core")
|
|
const result = babel.transformSync(code, {
|
|
plugins: [
|
|
[
|
|
"formatjs",
|
|
{
|
|
idInterpolationPattern: "[sha512:contenthash:base64:6]",
|
|
ast: true,
|
|
},
|
|
],
|
|
],
|
|
filename: id,
|
|
})
|
|
|
|
return result?.code
|
|
},
|
|
},
|
|
],
|
|
})
|
|
},
|
|
}
|
|
export default config
|