mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-10-27 03:24:12 +00:00 
			
		
		
		
	* test(storybook): add `components/MkC.*` stories * test(storybook): add some tests * test: add sleep * test: comment-out flaky test * test(storybook): add test for `MkChannelFollowButton` * chore(storybook): tweak sleep duration in `MkChannelFollowButton` story test * fix(chromatic): add delay to `MkChannelList` * chore: replace `mswDecorator` with `mswLoader` * fix(storybook): tweak some parameters * chore: serve static files * fix(chromatic): add delay to `MkCwButton` * chore: delete logging for debug * fix: add right click in `MkContextMenu` play * refactor: remove unused imports
		
			
				
	
	
		
			66 lines
		
	
	
	
		
			1.9 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			66 lines
		
	
	
	
		
			1.9 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| /*
 | |
|  * SPDX-FileCopyrightText: syuilo and misskey-project
 | |
|  * SPDX-License-Identifier: AGPL-3.0-only
 | |
|  */
 | |
| 
 | |
| import { createRequire } from 'node:module';
 | |
| import { dirname, join, resolve } from 'node:path';
 | |
| import { fileURLToPath } from 'node:url';
 | |
| import type { StorybookConfig } from '@storybook/vue3-vite';
 | |
| import { type Plugin, mergeConfig } from 'vite';
 | |
| import turbosnap from 'vite-plugin-turbosnap';
 | |
| 
 | |
| const require = createRequire(import.meta.url);
 | |
| const _dirname = fileURLToPath(new URL('.', import.meta.url));
 | |
| 
 | |
| const config = {
 | |
| 	stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
 | |
| 	staticDirs: [{ from: '../assets', to: '/client-assets' }],
 | |
| 	addons: [
 | |
| 		getAbsolutePath('@storybook/addon-essentials'),
 | |
| 		getAbsolutePath('@storybook/addon-interactions'),
 | |
| 		getAbsolutePath('@storybook/addon-links'),
 | |
| 		getAbsolutePath('@storybook/addon-storysource'),
 | |
| 		getAbsolutePath('@storybook/addon-mdx-gfm'),
 | |
| 		resolve(_dirname, '../node_modules/storybook-addon-misskey-theme'),
 | |
| 	],
 | |
| 	framework: {
 | |
| 		name: getAbsolutePath('@storybook/vue3-vite') as '@storybook/vue3-vite',
 | |
| 		options: {},
 | |
| 	},
 | |
| 	docs: {
 | |
| 		autodocs: 'tag',
 | |
| 	},
 | |
| 	core: {
 | |
| 		disableTelemetry: true,
 | |
| 	},
 | |
| 	async viteFinal(config) {
 | |
| 		const replacePluginForIsChromatic = config.plugins?.findIndex((plugin: Plugin) => plugin && plugin.name === 'replace') ?? -1;
 | |
| 		if (~replacePluginForIsChromatic) {
 | |
| 			config.plugins?.splice(replacePluginForIsChromatic, 1);
 | |
| 		}
 | |
| 		return mergeConfig(config, {
 | |
| 			plugins: [
 | |
| 				{
 | |
| 					// XXX: https://github.com/IanVS/vite-plugin-turbosnap/issues/8
 | |
| 					...(turbosnap as any as typeof turbosnap['default'])({
 | |
| 						rootDir: config.root ?? process.cwd(),
 | |
| 					}),
 | |
| 					name: 'fake-turbosnap',
 | |
| 				},
 | |
| 			],
 | |
| 			build: {
 | |
| 				target: [
 | |
| 					'chrome108',
 | |
| 					'firefox109',
 | |
| 					'safari16',
 | |
| 				],
 | |
| 			},
 | |
| 		});
 | |
| 	},
 | |
| } satisfies StorybookConfig;
 | |
| export default config;
 | |
| 
 | |
| function getAbsolutePath(value: string): string {
 | |
| 	return dirname(require.resolve(join(value, 'package.json')));
 | |
| }
 |