Skip to content

Commit

Permalink
addon-docs: update story index generator
Browse files Browse the repository at this point in the history
change extract stories condition to positive matcher instead of negative matcher
  • Loading branch information
sheriffMoose authored Jan 18, 2023
1 parent d45b15f commit c425cc8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions code/lib/core-server/src/utils/StoryIndexGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ export class StoryIndexGenerator {
);
}

isDocsMdx(absolutePath: Path) {
return /(?<!\.stories)\.mdx$/i.test(absolutePath);
isStoryFile(absolutePath: Path) {
return /(\.(js|jsx|ts|tsx)|\.stories\.mdx)$/i.test(absolutePath);
}

async ensureExtracted(): Promise<IndexEntry[]> {
Expand All @@ -174,7 +174,7 @@ export class StoryIndexGenerator {
// files may use the `<Meta of={XStories} />` syntax, which requires
// that the story file that contains the meta be processed first.
await this.updateExtracted(async (specifier, absolutePath) =>
this.isDocsMdx(absolutePath) ? false : this.extractStories(specifier, absolutePath)
this.isStoryFile(absolutePath) ? this.extractStories(specifier, absolutePath): false
);

if (!this.options.docs.disable) {
Expand Down

0 comments on commit c425cc8

Please sign in to comment.