Skip to content

Commit

Permalink
Merge pull request #1138 from chromaui/cody/cap-2627-turbosnap-doesnt…
Browse files Browse the repository at this point in the history
…-work-with-the-latest-version-of-storybook

Add rsbuild v0.1.7 support
  • Loading branch information
codykaup authored Jan 9, 2025
2 parents adc14e5 + a2bbb87 commit b802467
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
12 changes: 7 additions & 5 deletions node-src/lib/getDependentStoryFiles.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,11 @@ describe('getDependentStoryFiles', () => {
});
});

it('detects direct changes to CSF files, rspack', async () => {
it.each([
[`./node_modules/.cache/storybook/default/dev-server/storybook-stories.js`],
[`./node_modules/.cache/storybook/storybook-rsbuild-builder/storybook-config-entry.js`],
[`./node_modules/.cache/storybook-rsbuild-builder/storybook-config-entry.js`],
])('detects direct changes to CSF files, rspack (%s)', async (resolvedModule) => {
const changedFiles = ['src/foo.stories.js'];
const modules = [
{
Expand All @@ -179,10 +183,8 @@ describe('getDependentStoryFiles', () => {
id: String.raw`./src lazy recursive ^\.\/.*$`,
reasons: [
{
resolvedModule:
'./node_modules/.cache/storybook/default/dev-server/storybook-stories.js',
moduleName:
'./node_modules/.cache/storybook/default/dev-server/storybook-stories.js + 2 modules',
resolvedModule,
moduleName: `${resolvedModule} + 2 modules`,
},
],
},
Expand Down
1 change: 1 addition & 0 deletions node-src/lib/getDependentStoryFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ export async function getDependentStoryFiles(
// rspack builder
`./node_modules/.cache/storybook/default/dev-server/storybook-stories.js`,
`./node_modules/.cache/storybook/storybook-rsbuild-builder/storybook-config-entry.js`,
`./node_modules/.cache/storybook-rsbuild-builder/storybook-config-entry.js`,
].map((file) => normalize(file))
);

Expand Down
4 changes: 2 additions & 2 deletions node-src/lib/getStorybookMetadata.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { readConfig } from '@storybook/csf-tools';
import { printConfig, readConfig } from '@storybook/csf-tools';
import { readdir } from 'fs/promises';
import { readJson } from 'fs-extra';
import meow from 'meow';
Expand Down Expand Up @@ -227,7 +227,7 @@ export const getStorybookMetadata = async (ctx: Context) => {
}

mainConfig = await readConfig(storybookConfig);
ctx.log.debug({ configDirectory, mainConfig });
ctx.log.debug({ configDirectory, mainConfig: printConfig(mainConfig) });
v7 = true;
} catch (err) {
ctx.log.debug({ storybookV7error: err });
Expand Down

0 comments on commit b802467

Please sign in to comment.