Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"frontend/src/gql/**",
"frontend/src/routeTree.gen.ts",
"frontend/.storybook/locales.ts",
"frontend/.storybook/mockServiceWorker.js",
"frontend/locales/*.json",
"frontend/stories/static/**",
"**/coverage/**",
"**/dist/**"
]
Expand Down
9 changes: 7 additions & 2 deletions frontend/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import type { StorybookConfig } from "@storybook/react-vite";
const config: StorybookConfig = {
stories: ["../{src,stories}/**/*.stories.@(js|jsx|ts|tsx)"],

staticDirs: ["../stories/static"],

addons: [
// Automatic docs pages
"@storybook/addon-docs",
Expand Down Expand Up @@ -57,6 +55,13 @@ const config: StorybookConfig = {
env: {
STORYBOOK: "true",
},

viteFinal: async (config) => {
// Host all the assets in the root directory,
// so that the service worker is correctly scoped to the root
config.build.assetsDir = "";
return config;
},
};

export default config;
6 changes: 4 additions & 2 deletions frontend/.storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@ import type {
import { TooltipProvider } from "@vector-im/compound-web";
import { initialize, mswLoader } from "msw-storybook-addon";
import { useLayoutEffect } from "react";

import "../src/shared.css";
import i18n, { setupI18n } from "../src/i18n";

import { DummyRouter } from "../src/test-utils/router";
import { handlers } from "../tests/mocks/handlers";
import localazyMetadata from "./locales";
import swUrl from "./mockServiceWorker.js?url";

initialize(
{
onUnhandledRequest: "bypass",
serviceWorker: {
url: swUrl,
},
},
handlers,
);
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@
"vitest": "^2.1.2"
},
"msw": {
"workerDirectory": ["stories/static"]
"workerDirectory": [".storybook"]
}
}
2 changes: 0 additions & 2 deletions misc/build-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,4 @@ mv target/doc target/book/rustdoc
cd frontend
npm ci
npx storybook build -o ../target/book/storybook
# Copy the mock service worker to the root of the domain, else it won't load
cp ../target/book/storybook/mockServiceWorker.js ../target/book/mockServiceWorker.js
cd ..
Loading