diff --git a/packages/storybook/src/generators/convert-to-inferred/convert-to-inferred.spec.ts b/packages/storybook/src/generators/convert-to-inferred/convert-to-inferred.spec.ts index 736cda4d6a406..7139d65b88fc8 100644 --- a/packages/storybook/src/generators/convert-to-inferred/convert-to-inferred.spec.ts +++ b/packages/storybook/src/generators/convert-to-inferred/convert-to-inferred.spec.ts @@ -235,7 +235,7 @@ describe('Storybook - Convert To Inferred', () => { "output-dir": "../../dist/storybook/apps/app1", }, "outputs": [ - "{projectRoot}/{options.outputDir}", + "{projectRoot}/{options.output-dir}", "{workspaceRoot}/{projectRoot}/storybook-static", "{options.output-dir}", "{options.outputDir}", @@ -311,7 +311,7 @@ describe('Storybook - Convert To Inferred', () => { "output-dir": "../../dist/storybook/apps/app1", }, "outputs": [ - "{projectRoot}/{options.outputDir}", + "{projectRoot}/{options.output-dir}", "{workspaceRoot}/{projectRoot}/storybook-static", "{options.output-dir}", "{options.outputDir}", @@ -386,7 +386,7 @@ describe('Storybook - Convert To Inferred', () => { "webpack-stats-json": true, }, "outputs": [ - "{projectRoot}/{options.outputDir}", + "{projectRoot}/{options.output-dir}", "{workspaceRoot}/{projectRoot}/storybook-static", "{options.output-dir}", "{options.outputDir}", @@ -445,7 +445,7 @@ describe('Storybook - Convert To Inferred', () => { "output-dir": "../../dist/storybook/apps/app1", }, "outputs": [ - "{projectRoot}/{options.outputDir}", + "{projectRoot}/{options.output-dir}", "{workspaceRoot}/{projectRoot}/storybook-static", "{options.output-dir}", "{options.outputDir}", @@ -564,7 +564,7 @@ describe('Storybook - Convert To Inferred', () => { "output-dir": "../../dist/storybook/apps/app1", }, "outputs": [ - "{projectRoot}/{options.outputDir}", + "{projectRoot}/{options.output-dir}", "{workspaceRoot}/{projectRoot}/storybook-static", "{options.output-dir}", "{options.outputDir}", @@ -596,7 +596,7 @@ describe('Storybook - Convert To Inferred', () => { "output-dir": "../../dist/storybook/apps/project2", }, "outputs": [ - "{projectRoot}/{options.outputDir}", + "{projectRoot}/{options.output-dir}", "{workspaceRoot}/{projectRoot}/storybook-static", "{options.output-dir}", "{options.outputDir}", diff --git a/packages/storybook/src/generators/convert-to-inferred/lib/build-post-target-transformer.spec.ts b/packages/storybook/src/generators/convert-to-inferred/lib/build-post-target-transformer.spec.ts index 86d1e3eb547f5..20e72a8408575 100644 --- a/packages/storybook/src/generators/convert-to-inferred/lib/build-post-target-transformer.spec.ts +++ b/packages/storybook/src/generators/convert-to-inferred/lib/build-post-target-transformer.spec.ts @@ -70,13 +70,17 @@ describe('buildPostTargetTransformer', () => { export default config;" `); expect(target).toMatchInlineSnapshot(` - { - "options": { - "config-dir": ".storybook", - "output-dir": "../../dist/storybook/myapp", - }, - } - `); + { + "options": { + "config-dir": ".storybook", + "output-dir": "../../dist/storybook/myapp", + }, + "outputs": [ + "{projectRoot}/{options.output-dir}", + "{projectRoot}/{options.outputDir}", + ], + } + `); }); it('should handle configurations correctly and migrate docsMode and staticDir to storybook config correctly', () => { @@ -157,19 +161,23 @@ describe('buildPostTargetTransformer', () => { export default config;" `); expect(target).toMatchInlineSnapshot(` - { - "configurations": { - "dev": { - "config-dir": "./dev/.storybook", - "output-dir": "../../dist/storybook/myapp/dev", - }, - }, - "options": { - "config-dir": ".storybook", - "output-dir": "../../dist/storybook/myapp", - }, - } - `); + { + "configurations": { + "dev": { + "config-dir": "./dev/.storybook", + "output-dir": "../../dist/storybook/myapp/dev", + }, + }, + "options": { + "config-dir": ".storybook", + "output-dir": "../../dist/storybook/myapp", + }, + "outputs": [ + "{projectRoot}/{options.output-dir}", + "{projectRoot}/{options.outputDir}", + ], + } + `); const devConfigFile = tree.read( 'apps/myapp/dev/.storybook/main.ts', 'utf-8' @@ -262,13 +270,17 @@ describe('buildPostTargetTransformer', () => { export default config;" `); expect(target).toMatchInlineSnapshot(` - { - "options": { - "config-dir": ".storybook", - "output-dir": "../../dist/storybook/myapp", - }, - } - `); + { + "options": { + "config-dir": ".storybook", + "output-dir": "../../dist/storybook/myapp", + }, + "outputs": [ + "{projectRoot}/{options.output-dir}", + "{projectRoot}/{options.outputDir}", + ], + } + `); }); it('should handle configurations correctly and migrate docsMode and staticDir to storybook config correctly', () => { @@ -349,19 +361,23 @@ describe('buildPostTargetTransformer', () => { export default config;" `); expect(target).toMatchInlineSnapshot(` - { - "configurations": { - "dev": { - "config-dir": "./dev/.storybook", - "output-dir": "../../dist/storybook/myapp/dev", - }, - }, - "options": { - "config-dir": ".storybook", - "output-dir": "../../dist/storybook/myapp", - }, - } - `); + { + "configurations": { + "dev": { + "config-dir": "./dev/.storybook", + "output-dir": "../../dist/storybook/myapp/dev", + }, + }, + "options": { + "config-dir": ".storybook", + "output-dir": "../../dist/storybook/myapp", + }, + "outputs": [ + "{projectRoot}/{options.output-dir}", + "{projectRoot}/{options.outputDir}", + ], + } + `); const devConfigFile = tree.read( 'apps/myapp/dev/.storybook/main.ts', 'utf-8' @@ -454,13 +470,17 @@ describe('buildPostTargetTransformer', () => { export default config;" `); expect(target).toMatchInlineSnapshot(` - { - "options": { - "config-dir": ".storybook", - "output-dir": "../../dist/storybook/myapp", - }, - } - `); + { + "options": { + "config-dir": ".storybook", + "output-dir": "../../dist/storybook/myapp", + }, + "outputs": [ + "{projectRoot}/{options.output-dir}", + "{projectRoot}/{options.outputDir}", + ], + } + `); }); it('should handle configurations correctly and migrate docsMode and staticDir to storybook config correctly', () => { @@ -541,19 +561,23 @@ describe('buildPostTargetTransformer', () => { export default config;" `); expect(target).toMatchInlineSnapshot(` - { - "configurations": { - "dev": { - "config-dir": "./dev/.storybook", - "output-dir": "../../dist/storybook/myapp/dev", - }, - }, - "options": { - "config-dir": ".storybook", - "output-dir": "../../dist/storybook/myapp", - }, - } - `); + { + "configurations": { + "dev": { + "config-dir": "./dev/.storybook", + "output-dir": "../../dist/storybook/myapp/dev", + }, + }, + "options": { + "config-dir": ".storybook", + "output-dir": "../../dist/storybook/myapp", + }, + "outputs": [ + "{projectRoot}/{options.output-dir}", + "{projectRoot}/{options.outputDir}", + ], + } + `); const devConfigFile = tree.read( 'apps/myapp/dev/.storybook/main.ts', 'utf-8' diff --git a/packages/storybook/src/generators/convert-to-inferred/lib/build-post-target-transformer.ts b/packages/storybook/src/generators/convert-to-inferred/lib/build-post-target-transformer.ts index 4802d4be14ba9..05e6e905f4d22 100644 --- a/packages/storybook/src/generators/convert-to-inferred/lib/build-post-target-transformer.ts +++ b/packages/storybook/src/generators/convert-to-inferred/lib/build-post-target-transformer.ts @@ -107,7 +107,7 @@ export function buildPostTargetTransformer(migrationLogs: AggregatedLog) { if (target.outputs) { processTargetOutputs( target, - [{ newName: 'outputDir', oldName: 'outputDir' }], + [{ newName: 'output-dir', oldName: 'outputDir' }], inferredTargetConfiguration, { projectName: projectDetails.projectName,