mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 11:11:53 +08:00
30 lines
751 B
Plaintext
30 lines
751 B
Plaintext
```js
|
|
// .storybook/main.ts
|
|
|
|
const combosIndexer = {
|
|
test: /\.stories\.[tj]sx?$/,
|
|
createIndex: async (fileName, { makeTitle }) => {
|
|
// 👇 Grab title from fileName
|
|
const title = fileName.match(/\/(.*)\.stories/)[1];
|
|
|
|
// Read file and generate entries ...
|
|
|
|
return entries.map((entry) => ({
|
|
type: 'story',
|
|
// 👇 Use makeTitle to format the title
|
|
title: `${makeTitle(title)} Custom`,
|
|
importPath: fileName,
|
|
exportName: entry.name,
|
|
}));
|
|
},
|
|
};
|
|
|
|
const config = {
|
|
framework: '@storybook/your-framework',
|
|
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
|
|
experimental_indexers: async (existingIndexers) => [...existingIndexers, combosIndexer];
|
|
};
|
|
|
|
export default config;
|
|
```
|