diff --git a/node-src/tasks/build.test.ts b/node-src/tasks/build.test.ts index f161b20e6..24204e26a 100644 --- a/node-src/tasks/build.test.ts +++ b/node-src/tasks/build.test.ts @@ -113,25 +113,6 @@ describe('setBuildCommand', () => { 'Storybook version 6.2.0 or later is required to use the --only-changed flag' ); }); - - it('uses the correct flag for webpack stats for >= 8.0.0', async () => { - getCliCommand.mockReturnValue(Promise.resolve('npm run build:storybook')); - - const ctx = { - sourceDir: './source-dir/', - options: { buildScriptName: 'build:storybook' }, - storybook: { version: '8.0.0' }, - git: { changedFiles: ['./index.js'] }, - } as any; - await setBuildCommand(ctx); - - expect(getCliCommand).toHaveBeenCalledWith( - expect.anything(), - ['build:storybook', '--output-dir=./source-dir/', '--stats-json=./source-dir/'], - { programmatic: true } - ); - expect(ctx.buildCommand).toEqual('npm run build:storybook'); - }); }); describe('buildStorybook', () => { diff --git a/node-src/tasks/build.ts b/node-src/tasks/build.ts index 6e31d1b96..11ae6dc59 100644 --- a/node-src/tasks/build.ts +++ b/node-src/tasks/build.ts @@ -27,11 +27,6 @@ export const setSourceDir = async (ctx: Context) => { } }; -// Storybook 8.0.0 deprecated --webpack-stats-json in favor of --stats-json. -const webpackStatsFlag = (version: string) => { - return semver.gte(semver.coerce(version), '8.0.0') ? '--stats-json' : '--webpack-stats-json'; -}; - export const setBuildCommand = async (ctx: Context) => { const webpackStatsSupported = ctx.storybook && ctx.storybook.version @@ -44,9 +39,7 @@ export const setBuildCommand = async (ctx: Context) => { const buildCommandOptions = [ `--output-dir=${ctx.sourceDir}`, - ctx.git.changedFiles && - webpackStatsSupported && - `${webpackStatsFlag(ctx.storybook.version)}=${ctx.sourceDir}`, + ctx.git.changedFiles && webpackStatsSupported && `--webpack-stats-json=${ctx.sourceDir}`, ].filter(Boolean); ctx.buildCommand = await (isE2EBuild(ctx.options)