From db17655facbfbfb20c47f30eab974f8ad4fab376 Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Fri, 8 Sep 2023 10:23:03 +0200 Subject: [PATCH] indexFn -> createIndex, as per https://github.com/storybookjs/storybook/pull/24075 --- docs/api/main-config-indexers.md | 10 +++++----- docs/snippets/common/main-config-indexers.js.mdx | 4 ++-- docs/snippets/common/main-config-indexers.ts.mdx | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/api/main-config-indexers.md b/docs/api/main-config-indexers.md index 8ef48456b96..fb736c5fbe2 100644 --- a/docs/api/main-config-indexers.md +++ b/docs/api/main-config-indexers.md @@ -40,7 +40,7 @@ Type: ```ts { test: RegExp; - indexFn: (fileName: string, options: IndexerOptions) => Promise; + createIndex: (fileName: string, options: IndexerOptions) => Promise; } ``` @@ -54,7 +54,7 @@ Type: `RegExp` A regular expression run against file names included in the [`stories`](./main-config-stories.md) configuration that should match all files to be handled by this indexer. -### `indexFn` +### `createIndex` (Required) @@ -192,7 +192,7 @@ import type { StorybookConfig, Indexer } from '@storybook/your-framework'; const combosIndexer: Indexer = { test: /\.stories\.[tj]sx?$/, - indexFn: async (fileName, { makeTitle }) => { + createIndex: async (fileName, { makeTitle }) => { // 👇 Grab title from fileName const title = fileName.match(/\/(.*)\.stories/)[1]; @@ -330,7 +330,7 @@ import path from 'path'; const jsonFixtureIndexer: Indexer = { test: /jsonstories\.[tj]sx?$/, - indexFn: async (fileName) => { + createIndex: async (fileName) => { // JSON files in the current directory const jsonFiles = (await fs.readdir(path.dirname(fileName))) .filter(f => f.endsWith('.json')) @@ -402,7 +402,7 @@ import { parseCombos } from '../utils'; const combosIndexer: Indexer = { test: /\.combos\.[tj]sx?$/, - indexFn: async (fileName) => { + createIndex: async (fileName) => { const code = await fs.readFile(fileName); const combos = parseCombos(code); diff --git a/docs/snippets/common/main-config-indexers.js.mdx b/docs/snippets/common/main-config-indexers.js.mdx index f8ba8ad6de1..7d2b4dcd03f 100644 --- a/docs/snippets/common/main-config-indexers.js.mdx +++ b/docs/snippets/common/main-config-indexers.js.mdx @@ -13,9 +13,9 @@ export default { experimental_indexers: async (existingIndexers) => { const customIndexer = { test: /\.custom-stories\.[tj]sx?$/, - indexFn: // See API and examples below... + createIndex: // See API and examples below... }; return [...existingIndexers, customIndexer]; }, }; -``` \ No newline at end of file +``` diff --git a/docs/snippets/common/main-config-indexers.ts.mdx b/docs/snippets/common/main-config-indexers.ts.mdx index 0ee0cacb309..3ceccda7776 100644 --- a/docs/snippets/common/main-config-indexers.ts.mdx +++ b/docs/snippets/common/main-config-indexers.ts.mdx @@ -15,11 +15,11 @@ const config: StorybookConfig = { experimental_indexers: async (existingIndexers) => { const customIndexer = { test: /\.custom-stories\.[tj]sx?$/, - indexFn: // See API and examples below... + createIndex: // See API and examples below... }; return [...existingIndexers, customIndexer]; }, }; export default config -``` \ No newline at end of file +```