Skip to content

Commit

Permalink
fix(frontend): fix storybook build (#11203)
Browse files Browse the repository at this point in the history
  • Loading branch information
saschanaz authored Jul 8, 2023
1 parent 60366a4 commit 74a05ec
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions packages/frontend/.storybook/generate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ declare global {
}
}

function toStories(component: string): string {
function toStories(component: string): Promise<string> {
const msw = `${component.slice(0, -'.vue'.length)}.msw`;
const implStories = `${component.slice(0, -'.vue'.length)}.stories.impl`;
const metaStories = `${component.slice(0, -'.vue'.length)}.stories.meta`;
Expand Down Expand Up @@ -394,18 +394,20 @@ function toStories(component: string): string {
}

// glob('src/{components,pages,ui,widgets}/**/*.vue')
Promise.all([
glob('src/components/global/*.vue'),
glob('src/components/Mk{A,B}*.vue'),
glob('src/components/MkDigitalClock.vue'),
glob('src/components/MkGalleryPostPreview.vue'),
glob('src/components/MkSignupServerRules.vue'),
glob('src/components/MkUserSetupDialog.vue'),
glob('src/components/MkUserSetupDialog.*.vue'),
glob('src/pages/user/home.vue'),
])
.then((globs) => globs.flat())
.then((components) => Promise.all(components.map((component) => {
(async () => {
const globs = await Promise.all([
glob('src/components/global/*.vue'),
glob('src/components/Mk{A,B}*.vue'),
glob('src/components/MkDigitalClock.vue'),
glob('src/components/MkGalleryPostPreview.vue'),
glob('src/components/MkSignupServerRules.vue'),
glob('src/components/MkUserSetupDialog.vue'),
glob('src/components/MkUserSetupDialog.*.vue'),
glob('src/pages/user/home.vue'),
]);
const components = globs.flat();
await Promise.all(components.map(async (component) => {
const stories = component.replace(/\.vue$/, '.stories.ts');
return writeFile(stories, toStories(component));
})));
await writeFile(stories, await toStories(component));
}))
})();

0 comments on commit 74a05ec

Please sign in to comment.