Skip to content

Commit

Permalink
Merge pull request #110 from owowagency/fix/storybook-build
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjoertjuh authored Dec 1, 2023
2 parents ce653a1 + c956dfc commit 0973ff0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
14 changes: 8 additions & 6 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import type { StorybookConfig } from "@storybook/vue3-vite";
import { mergeConfig } from "vite";
import { viteStaticCopy as Copy } from 'vite-plugin-static-copy';

const config: StorybookConfig = {
stories: [
Expand All @@ -22,13 +24,13 @@ const config: StorybookConfig = {
options: {},
},
viteFinal: (config, options) => {
config.plugins = config.plugins?.filter(async (plugin) => {
plugin = await plugin;

return typeof plugin === 'boolean' || Array.isArray(plugin) || plugin?.name !== 'vite-plugin-static-copy:build';
return mergeConfig(config, {
// This is needed because the copy plugin can't copy files outside of the root directory
// The files are copied back to the root by the post script
build: {
outDir: 'storybook-static/dist'
}
});

return config;
},
};

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
"lint": "eslint src --ext .ts,.vue",
"generate-docs": "vue-docgen -c docgen.config.cjs",
"postversion": "cp package.json ..",
"predeploy": "storybook build",
"predeploy": "yarn storybook:build",
"storybook": "storybook dev -p 6006",
"storybook:build": "NODE_OPTIONS=--openssl-legacy-provider storybook build",
"poststorybook:build": "cp -r ./storybook-static/dist/** ./storybook-static && rm -rf ./storybook-static/dist",
"storybook:deploy": "gh-pages -d storybook-static"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import Vue from '@vitejs/plugin-vue'
import DTS from "vite-plugin-dts";
import { viteStaticCopy as Copy } from 'vite-plugin-static-copy'
import { viteStaticCopy as Copy } from 'vite-plugin-static-copy';
import VueDocgen from './vite/plugin-docgen';
import Delete from './vite/plugin-delete';

Expand Down

0 comments on commit 0973ff0

Please sign in to comment.