1
0
Эх сурвалжийг харах

chore(dashboard): Fix storybook deploy config (#3880)

Michael Bromley 3 сар өмнө
parent
commit
6b21954dd1

+ 4 - 1
packages/dashboard/.storybook/providers.tsx

@@ -107,9 +107,12 @@ export function DemoRouterProvider(props: {
 export function DemoAuthProvider({ children }: PropsWithChildren) {
     const { login, isAuthenticated } = useAuth();
 
+    const username = import.meta.env.VITE_ADMIN_USERNAME ?? 'admin';
+    const password = import.meta.env.VITE_ADMIN_PASSWORD ?? 'admin';
+
     useEffect(() => {
         if (!isAuthenticated) {
-            login('admin', 'admin');
+            login(username, password);
         }
     }, [isAuthenticated]);
     return children;

+ 7 - 6
packages/dashboard/vercel.json

@@ -1,8 +1,9 @@
 {
-    "rewrites": [
-        {
-            "source": "/(.*)",
-            "destination": "/index.html"
-        }
-    ]
+  "$schema": "https://openapi.vercel.sh/vercel.json",
+  "rewrites": [
+    {
+      "source": "/(.*)",
+      "destination": "/index.html"
+    }
+  ]
 }

+ 9 - 1
packages/dashboard/vite/vite-plugin-transform-index.ts

@@ -19,7 +19,15 @@ export function transformIndexHtmlPlugin(): Plugin {
         },
         // Only apply this plugin during the build phase
         apply: 'build',
-        transformIndexHtml(html) {
+        transformIndexHtml(html, ctx) {
+            // Don't transform Storybook HTML files
+            if (
+                ctx.filename &&
+                (ctx.filename.includes('iframe.html') || ctx.filename.includes('storybook'))
+            ) {
+                return html;
+            }
+
             if (config.base && config.base !== '/') {
                 // Remove the base path from hrefs and srcs
                 const basePath = config.base.replace(/\/$/, ''); // Remove trailing slash