diff --git a/packages/storybook/src/executors/utils.ts b/packages/storybook/src/executors/utils.ts index 67d8673df16866..74e3f87b12bc11 100644 --- a/packages/storybook/src/executors/utils.ts +++ b/packages/storybook/src/executors/utils.ts @@ -5,7 +5,10 @@ import { parseTargetString, readTargetOptions, } from '@nrwl/devkit'; -import { Workspaces } from '@nrwl/tao/src/shared/workspace'; +import { + TargetConfiguration, + Workspaces, +} from '@nrwl/tao/src/shared/workspace'; import { checkAndCleanWithSemver } from '@nrwl/workspace/src/utilities/version-utils'; import 'dotenv/config'; import { existsSync, readFileSync } from 'fs'; @@ -205,49 +208,13 @@ export function resolveCommonStorybookOptionMapper( storybookOptions.angularBrowserTarget = targetString; } else { - const buildable = - !!context?.workspace?.projects?.[context.projectName]?.targets?.build; - - const storybookBuildTarget = - !!context?.workspace?.projects?.[context.projectName]?.targets?.[ - 'build-storybook' - ]; - - // to preserve the backwards compatibility for our users Nx resolves the - // default project just as Storybook used to before - - const ws = new Workspaces(context.root); - const defaultProjectName = ws.calculateDefaultProjectName( - context.cwd, - context.workspace - ); - - buildProjectName = defaultProjectName; - - if (defaultProjectName) { - logger.warn( - ` - No projectBuildConfig was provided. Nx will use the defaultProject as set in your workspace configuration - to build Storybook. This can lead to compilation errors for Storybook. - - If you want to change this, you can run the command by providing the projectBuildConfig flag as follows: - - nx ${context.targetName ? context.targetName : 'storybook'} ${ - context.projectName - } --projectBuildConfig=${context.projectName}${ - !buildable && storybookBuildTarget ? ':build-storybook' : '' - } - - Alternatively, in your project configuration, under the "${ - context.targetName ? context.targetName : 'storybook' - }" target options, you can - set the "projectBuildConfig" property to the name of the project of which you want to use - the build configuration for Storybook. - ` + const { storybookBuildTarget, storybookTarget, buildTarget } = + findStorybookAndBuildTargets( + context?.workspace?.projects?.[context.projectName]?.targets ); - } else { - logger.warn( - ` + + logger.warn( + ` No projectBuildConfig was provided and Nx could not find a defaultProject in your workspace configuration. To fix this, you can try one of the following options: @@ -255,41 +222,27 @@ export function resolveCommonStorybookOptionMapper( 1. Specify a defaultProject in your nx.json 2. You can run the ${ - context.targetName ? context.targetName : 'storybook' + context.targetName ? context.targetName : storybookTarget } executor by providing the projectBuildConfig flag as follows: - nx ${context.targetName ? context.targetName : 'storybook'} ${ - context.projectName - } --projectBuildConfig=${context.projectName}${ - !buildable && storybookBuildTarget ? ':build-storybook' : '' - } + nx ${context.targetName ? context.targetName : storybookTarget} ${ + context.projectName + } --projectBuildConfig=${context.projectName}${ + !buildTarget && storybookBuildTarget ? `:${storybookBuildTarget}` : '' + } 3. In your project configuration, under the "${ - context.targetName ? context.targetName : 'storybook' + context.targetName ? context.targetName : storybookTarget }" target options, you can set the "projectBuildConfig" property to the name of the project of which you want to use the build configuration for Storybook. ` - ); - throw new Error( - 'No default project was found in your workspace configuration.' - ); - } - - targetOptions = readTargetOptions( - { - project: defaultProjectName, - target: targetName, - configuration: '', - }, - context ); - - storybookOptions.angularBrowserTarget = normalizeTargetString( - defaultProjectName, - targetName + throw new Error( + 'No default project was found in your workspace configuration.' ); } + const project = context.workspace.projects[buildProjectName]; const angularDevkitCompatibleLogger = { @@ -340,3 +293,32 @@ function isStorybookGTE6_4() { '6.4.0-rc.1' ); } + +export function findStorybookAndBuildTargets(targets: { + [targetName: string]: TargetConfiguration; +}): { + storybookBuildTarget?: string; + storybookTarget?: string; + buildTarget?: string; +} { + const returnObject: { + storybookBuildTarget?: string; + storybookTarget?: string; + buildTarget?: string; + } = {}; + Object.entries(targets).forEach(([target, targetConfig]) => { + if (targetConfig.executor === '@nrwl/storybook:storybook') { + returnObject.storybookTarget = target; + } + if (targetConfig.executor === '@nrwl/storybook:build') { + returnObject.storybookBuildTarget = target; + } + if ( + targetConfig.executor === '@angular-devkit/build-angular:browser' || + targetConfig.executor === '@nrwl/angular:ng-packagr-lite' + ) { + returnObject.buildTarget = target; + } + }); + return returnObject; +} diff --git a/packages/storybook/src/migrations/update-13-4-5/__snapshots__/set-project-build-config.spec.ts.snap b/packages/storybook/src/migrations/update-13-4-5/__snapshots__/set-project-build-config.spec.ts.snap index 9540ae4263e3a9..e25d901fa41dd1 100644 --- a/packages/storybook/src/migrations/update-13-4-5/__snapshots__/set-project-build-config.spec.ts.snap +++ b/packages/storybook/src/migrations/update-13-4-5/__snapshots__/set-project-build-config.spec.ts.snap @@ -168,6 +168,174 @@ Object { } `; +exports[`Set the projectBuildConfig option in the Storybook configuration for Angular projects for all types of angular projects - non-buildable and buildable libs/apps should still set the projectBuildConfig even if target names are not the default 1`] = ` +Object { + "projects": Object { + "main-app": Object { + "prefix": "katst", + "projectType": "application", + "root": "apps/main-app", + "sourceRoot": "apps/main-app/src", + "targets": Object { + "lmfkcn": Object { + "configurations": Object { + "ci": Object { + "quiet": true, + }, + }, + "executor": "@nrwl/storybook:storybook", + "options": Object { + "config": Object { + "configFolder": "apps/main-app/.storybook", + }, + "port": 4400, + "projectBuildConfig": "main-app", + "uiFramework": "@storybook/angular", + }, + }, + "njdfvndfjnv": Object { + "executor": "@angular-devkit/build-angular:browser", + "outputs": Array [ + "{options.outputPath}", + ], + }, + "odmwjbc": Object { + "configurations": Object { + "ci": Object { + "quiet": true, + }, + }, + "executor": "@nrwl/storybook:build", + "options": Object { + "config": Object { + "configFolder": "apps/main-app/.storybook", + }, + "outputPath": "dist/storybook/main-app", + "projectBuildConfig": "main-app", + "uiFramework": "@storybook/angular", + }, + "outputs": Array [ + "{options.outputPath}", + ], + }, + }, + }, + "ui-one": Object { + "projectType": "library", + "root": "libs/ui/one", + "sourceRoot": "libs/ui/one/src", + "targets": Object { + "asdgsdfg": Object { + "configurations": Object { + "ci": Object { + "quiet": true, + }, + }, + "executor": "@nrwl/storybook:build", + "options": Object { + "config": Object { + "configFolder": "libs/ui/one/.storybook", + }, + "outputPath": "dist/storybook/ui/one", + "projectBuildConfig": "ui-one:asdgsdfg", + "uiFramework": "@storybook/angular", + }, + "outputs": Array [ + "{options.outputPath}", + ], + }, + "trthrngb": Object { + "executor": "@nrwl/storybook:storybook", + "options": Object { + "config": Object { + "configFolder": "libs/ui/one/.storybook", + }, + "port": 4400, + "projectBuildConfig": "ui-one:asdgsdfg", + "uiFramework": "@storybook/angular", + }, + }, + }, + }, + "ui-three": Object { + "projectType": "library", + "root": "libs/ui/three", + "sourceRoot": "libs/ui/three/src", + "targets": Object { + "aaaa": Object { + "configurations": Object { + "ci": Object { + "quiet": true, + }, + }, + "executor": "@nrwl/storybook:build", + "options": Object { + "config": Object { + "configFolder": "libs/ui/three/.storybook", + }, + "outputPath": "dist/storybook/ui/three", + "projectBuildConfig": "ui-three:aaaa", + "uiFramework": "@storybook/angular", + }, + "outputs": Array [ + "{options.outputPath}", + ], + }, + "nmkgd": Object { + "executor": "@nrwl/storybook:storybook", + "options": Object { + "config": Object { + "configFolder": "libs/ui/three/.storybook", + }, + "port": 4400, + "projectBuildConfig": "ui-three:aaaa", + "uiFramework": "@storybook/angular", + }, + }, + }, + }, + "ui-two": Object { + "projectType": "library", + "root": "libs/ui/two", + "sourceRoot": "libs/ui/two/src", + "targets": Object { + "sdft": Object { + "executor": "@nrwl/storybook:storybook", + "options": Object { + "config": Object { + "configFolder": "libs/ui/two/.storybook", + }, + "port": 4400, + "projectBuildConfig": "ui-two:thjkkb", + "uiFramework": "@storybook/angular", + }, + }, + "thjkkb": Object { + "configurations": Object { + "ci": Object { + "quiet": true, + }, + }, + "executor": "@nrwl/storybook:build", + "options": Object { + "config": Object { + "configFolder": "libs/ui/two/.storybook", + }, + "outputPath": "dist/storybook/ui/two", + "projectBuildConfig": "ui-two:thjkkb", + "uiFramework": "@storybook/angular", + }, + "outputs": Array [ + "{options.outputPath}", + ], + }, + }, + }, + }, + "version": 1, +} +`; + exports[`Set the projectBuildConfig option in the Storybook configuration for Angular projects for non-angular projects should not change their Storybook configuration 1`] = ` Object { "projects": Object { diff --git a/packages/storybook/src/migrations/update-13-4-5/set-project-build-config.spec.ts b/packages/storybook/src/migrations/update-13-4-5/set-project-build-config.spec.ts index 748e2055383a26..35aeeaeed15183 100644 --- a/packages/storybook/src/migrations/update-13-4-5/set-project-build-config.spec.ts +++ b/packages/storybook/src/migrations/update-13-4-5/set-project-build-config.spec.ts @@ -2,6 +2,9 @@ import { Tree, writeJson } from '@nrwl/devkit'; import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing'; import { readWorkspace } from 'packages/devkit/src/generators/project-configuration'; import setProjectBuildConfig from './set-project-build-config'; +import * as defaultConfig from './test-configs/default-config.json'; +import * as customNames from './test-configs/custom-names-config.json'; +import * as nonAngular from './test-configs/non-angular.json'; describe('Set the projectBuildConfig option in the Storybook configuration for Angular projects', () => { let tree: Tree; @@ -9,156 +12,16 @@ describe('Set the projectBuildConfig option in the Storybook configuration for A describe('for all types of angular projects - non-buildable and buildable libs/apps', () => { beforeEach(async () => { tree = createTreeWithEmptyWorkspace(); - - writeJson(tree, 'workspace.json', { - projects: { - ['ui-one']: { - projectType: 'library', - root: 'libs/ui/one', - sourceRoot: 'libs/ui/one/src', - targets: { - storybook: { - builder: '@nrwl/storybook:storybook', - options: { - uiFramework: '@storybook/angular', - port: 4400, - config: { - configFolder: 'libs/ui/one/.storybook', - }, - }, - }, - 'build-storybook': { - executor: '@nrwl/storybook:build', - outputs: ['{options.outputPath}'], - options: { - uiFramework: '@storybook/angular', - outputPath: 'dist/storybook/ui/one', - config: { - configFolder: 'libs/ui/one/.storybook', - }, - }, - configurations: { - ci: { - quiet: true, - }, - }, - }, - }, - }, - ['ui-two']: { - projectType: 'library', - root: 'libs/ui/two', - sourceRoot: 'libs/ui/two/src', - targets: { - storybook: { - builder: '@nrwl/storybook:storybook', - options: { - uiFramework: '@storybook/angular', - port: 4400, - config: { - configFolder: 'libs/ui/two/.storybook', - }, - }, - }, - 'build-storybook': { - executor: '@nrwl/storybook:build', - outputs: ['{options.outputPath}'], - options: { - uiFramework: '@storybook/angular', - outputPath: 'dist/storybook/ui/two', - config: { - configFolder: 'libs/ui/two/.storybook', - }, - }, - configurations: { - ci: { - quiet: true, - }, - }, - }, - }, - }, - ['ui-three']: { - projectType: 'library', - root: 'libs/ui/three', - sourceRoot: 'libs/ui/three/src', - targets: { - storybook: { - builder: '@nrwl/storybook:storybook', - options: { - uiFramework: '@storybook/angular', - port: 4400, - config: { - configFolder: 'libs/ui/three/.storybook', - }, - }, - }, - 'build-storybook': { - executor: '@nrwl/storybook:build', - outputs: ['{options.outputPath}'], - options: { - uiFramework: '@storybook/angular', - outputPath: 'dist/storybook/ui/three', - config: { - configFolder: 'libs/ui/three/.storybook', - }, - }, - configurations: { - ci: { - quiet: true, - }, - }, - }, - }, - }, - 'main-app': { - projectType: 'application', - root: 'apps/main-app', - sourceRoot: 'apps/main-app/src', - prefix: 'katst', - architect: { - build: { - builder: '@angular-devkit/build-angular:browser', - outputs: ['{options.outputPath}'], - }, - storybook: { - builder: '@nrwl/storybook:storybook', - options: { - uiFramework: '@storybook/angular', - port: 4400, - config: { - configFolder: 'apps/main-app/.storybook', - }, - }, - configurations: { - ci: { - quiet: true, - }, - }, - }, - 'build-storybook': { - builder: '@nrwl/storybook:build', - outputs: ['{options.outputPath}'], - options: { - uiFramework: '@storybook/angular', - outputPath: 'dist/storybook/main-app', - config: { - configFolder: 'apps/main-app/.storybook', - }, - }, - configurations: { - ci: { - quiet: true, - }, - }, - }, - }, - }, - }, - }); }); it(`should set the projectBuildConfig in the Storybook config according to the type of project`, async () => { + writeJson(tree, 'workspace.json', defaultConfig); + await setProjectBuildConfig(tree); + expect(readWorkspace(tree)).toMatchSnapshot(); + }); + + it(`should still set the projectBuildConfig even if target names are not the default`, async () => { + writeJson(tree, 'workspace.json', customNames); await setProjectBuildConfig(tree); expect(readWorkspace(tree)).toMatchSnapshot(); }); @@ -167,67 +30,7 @@ describe('Set the projectBuildConfig option in the Storybook configuration for A describe('for non-angular projects', () => { beforeEach(async () => { tree = createTreeWithEmptyWorkspace(); - - writeJson(tree, 'workspace.json', { - projects: { - ['ui-one']: { - projectType: 'library', - root: 'libs/ui/one', - sourceRoot: 'libs/ui/one/src', - targets: { - storybook: { - builder: '@nrwl/storybook:storybook', - options: { - uiFramework: '@storybook/react', - port: 4400, - config: { - configFolder: 'libs/ui/one/.storybook', - }, - }, - }, - 'build-storybook': { - executor: '@nrwl/storybook:build', - outputs: ['{options.outputPath}'], - options: { - uiFramework: '@storybook/angular', - outputPath: 'dist/storybook/ui/one', - config: { - configFolder: 'libs/ui/one/.storybook', - }, - }, - configurations: { - ci: { - quiet: true, - }, - }, - }, - }, - }, - 'main-app': { - projectType: 'application', - root: 'apps/main-app', - sourceRoot: 'apps/main-app/src', - prefix: 'katst', - architect: { - storybook: { - builder: '@nrwl/storybook:storybook', - options: { - uiFramework: '@storybook/react', - port: 4400, - config: { - configFolder: 'apps/main-app/.storybook', - }, - }, - configurations: { - ci: { - quiet: true, - }, - }, - }, - }, - }, - }, - }); + writeJson(tree, 'workspace.json', nonAngular); }); it(`should not change their Storybook configuration`, async () => { diff --git a/packages/storybook/src/migrations/update-13-4-5/set-project-build-config.ts b/packages/storybook/src/migrations/update-13-4-5/set-project-build-config.ts index 2439a96e8cfd8c..eb437792be0f10 100644 --- a/packages/storybook/src/migrations/update-13-4-5/set-project-build-config.ts +++ b/packages/storybook/src/migrations/update-13-4-5/set-project-build-config.ts @@ -5,48 +5,68 @@ import { updateProjectConfiguration, getProjects, } from '@nrwl/devkit'; +import { findStorybookAndBuildTargets } from '../../executors/utils'; export default async function setProjectBuildConfig(tree: Tree) { let changesMade = false; const projects = getProjects(tree); [...projects.entries()].forEach(([projectName, projectConfiguration]) => { + const { storybookBuildTarget, storybookTarget, buildTarget } = + findStorybookAndBuildTargets(projectConfiguration.targets); if ( - projectConfiguration?.targets?.storybook?.options?.uiFramework === - '@storybook/angular' && - projectName + projectName && + storybookTarget && + projectConfiguration?.targets?.[storybookTarget]?.options?.uiFramework === + '@storybook/angular' ) { - if (!projectConfiguration.targets.storybook.options.projectBuildConfig) { - if (projectConfiguration.targets.build) { - projectConfiguration.targets.storybook.options.projectBuildConfig = - projectName; - if (projectConfiguration.targets['build-storybook']) { + if (buildTarget) { + if ( + !projectConfiguration.targets[storybookTarget].options + .projectBuildConfig + ) { + projectConfiguration.targets[ + storybookTarget + ].options.projectBuildConfig = projectName; + changesMade = true; + } + if ( + storybookBuildTarget && + !projectConfiguration.targets[storybookBuildTarget].options + .projectBuildConfig + ) { + projectConfiguration.targets[ + storybookBuildTarget + ].options.projectBuildConfig = projectName; + changesMade = true; + } + } else { + if (storybookBuildTarget) { + if ( + !projectConfiguration.targets[storybookTarget].options + .projectBuildConfig + ) { projectConfiguration.targets[ - 'build-storybook' - ].options.projectBuildConfig = projectName; + storybookTarget + ].options.projectBuildConfig = `${projectName}:${storybookBuildTarget}`; + changesMade = true; } - } else { - if (projectConfiguration.targets['build-storybook']) { - projectConfiguration.targets.storybook.options.projectBuildConfig = `${projectName}:build-storybook`; + if ( + !projectConfiguration.targets[storybookBuildTarget].options + .projectBuildConfig + ) { projectConfiguration.targets[ - 'build-storybook' - ].options.projectBuildConfig = `${projectName}:build-storybook`; - } else { - Object.entries(projectConfiguration.targets).forEach( - ([target, targetConfig]) => { - if (targetConfig.executor === '@nrwl/storybook:build') { - projectConfiguration.targets.storybook.options.projectBuildConfig = `${projectName}:${target}`; - } - } - ); + storybookBuildTarget + ].options.projectBuildConfig = `${projectName}:${storybookBuildTarget}`; + changesMade = true; } - } - if (projectConfiguration.targets.storybook.options.projectBuildConfig) { - updateProjectConfiguration(tree, projectName, projectConfiguration); - changesMade = true; } else { logger.warn(`Could not find a build target for ${projectName}.`); } } + + if (changesMade) { + updateProjectConfiguration(tree, projectName, projectConfiguration); + } } }); diff --git a/packages/storybook/src/migrations/update-13-4-5/test-configs/custom-names-config.json b/packages/storybook/src/migrations/update-13-4-5/test-configs/custom-names-config.json new file mode 100644 index 00000000000000..492fb8d1cd54fe --- /dev/null +++ b/packages/storybook/src/migrations/update-13-4-5/test-configs/custom-names-config.json @@ -0,0 +1,146 @@ +{ + "projects": { + "ui-one": { + "projectType": "library", + "root": "libs/ui/one", + "sourceRoot": "libs/ui/one/src", + "targets": { + "trthrngb": { + "builder": "@nrwl/storybook:storybook", + "options": { + "uiFramework": "@storybook/angular", + "port": 4400, + "config": { + "configFolder": "libs/ui/one/.storybook" + } + } + }, + "asdgsdfg": { + "executor": "@nrwl/storybook:build", + "outputs": ["{options.outputPath}"], + "options": { + "uiFramework": "@storybook/angular", + "outputPath": "dist/storybook/ui/one", + "config": { + "configFolder": "libs/ui/one/.storybook" + } + }, + "configurations": { + "ci": { + "quiet": true + } + } + } + } + }, + "ui-two": { + "projectType": "library", + "root": "libs/ui/two", + "sourceRoot": "libs/ui/two/src", + "targets": { + "sdft": { + "builder": "@nrwl/storybook:storybook", + "options": { + "uiFramework": "@storybook/angular", + "port": 4400, + "config": { + "configFolder": "libs/ui/two/.storybook" + } + } + }, + "thjkkb": { + "executor": "@nrwl/storybook:build", + "outputs": ["{options.outputPath}"], + "options": { + "uiFramework": "@storybook/angular", + "outputPath": "dist/storybook/ui/two", + "config": { + "configFolder": "libs/ui/two/.storybook" + } + }, + "configurations": { + "ci": { + "quiet": true + } + } + } + } + }, + "ui-three": { + "projectType": "library", + "root": "libs/ui/three", + "sourceRoot": "libs/ui/three/src", + "targets": { + "nmkgd": { + "builder": "@nrwl/storybook:storybook", + "options": { + "uiFramework": "@storybook/angular", + "port": 4400, + "config": { + "configFolder": "libs/ui/three/.storybook" + } + } + }, + "aaaa": { + "executor": "@nrwl/storybook:build", + "outputs": ["{options.outputPath}"], + "options": { + "uiFramework": "@storybook/angular", + "outputPath": "dist/storybook/ui/three", + "config": { + "configFolder": "libs/ui/three/.storybook" + } + }, + "configurations": { + "ci": { + "quiet": true + } + } + } + } + }, + "main-app": { + "projectType": "application", + "root": "apps/main-app", + "sourceRoot": "apps/main-app/src", + "prefix": "katst", + "architect": { + "njdfvndfjnv": { + "builder": "@angular-devkit/build-angular:browser", + "outputs": ["{options.outputPath}"] + }, + "lmfkcn": { + "builder": "@nrwl/storybook:storybook", + "options": { + "uiFramework": "@storybook/angular", + "port": 4400, + "config": { + "configFolder": "apps/main-app/.storybook" + } + }, + "configurations": { + "ci": { + "quiet": true + } + } + }, + "odmwjbc": { + "builder": "@nrwl/storybook:build", + "outputs": ["{options.outputPath}"], + "options": { + "uiFramework": "@storybook/angular", + "outputPath": "dist/storybook/main-app", + "config": { + "configFolder": "apps/main-app/.storybook" + } + }, + "configurations": { + "ci": { + "quiet": true + } + } + } + } + } + } +} diff --git a/packages/storybook/src/migrations/update-13-4-5/test-configs/default-config.json b/packages/storybook/src/migrations/update-13-4-5/test-configs/default-config.json new file mode 100644 index 00000000000000..439d649ab46048 --- /dev/null +++ b/packages/storybook/src/migrations/update-13-4-5/test-configs/default-config.json @@ -0,0 +1,146 @@ +{ + "projects": { + "ui-one": { + "projectType": "library", + "root": "libs/ui/one", + "sourceRoot": "libs/ui/one/src", + "targets": { + "storybook": { + "builder": "@nrwl/storybook:storybook", + "options": { + "uiFramework": "@storybook/angular", + "port": 4400, + "config": { + "configFolder": "libs/ui/one/.storybook" + } + } + }, + "build-storybook": { + "executor": "@nrwl/storybook:build", + "outputs": ["{options.outputPath}"], + "options": { + "uiFramework": "@storybook/angular", + "outputPath": "dist/storybook/ui/one", + "config": { + "configFolder": "libs/ui/one/.storybook" + } + }, + "configurations": { + "ci": { + "quiet": true + } + } + } + } + }, + "ui-two": { + "projectType": "library", + "root": "libs/ui/two", + "sourceRoot": "libs/ui/two/src", + "targets": { + "storybook": { + "builder": "@nrwl/storybook:storybook", + "options": { + "uiFramework": "@storybook/angular", + "port": 4400, + "config": { + "configFolder": "libs/ui/two/.storybook" + } + } + }, + "build-storybook": { + "executor": "@nrwl/storybook:build", + "outputs": ["{options.outputPath}"], + "options": { + "uiFramework": "@storybook/angular", + "outputPath": "dist/storybook/ui/two", + "config": { + "configFolder": "libs/ui/two/.storybook" + } + }, + "configurations": { + "ci": { + "quiet": true + } + } + } + } + }, + "ui-three": { + "projectType": "library", + "root": "libs/ui/three", + "sourceRoot": "libs/ui/three/src", + "targets": { + "storybook": { + "builder": "@nrwl/storybook:storybook", + "options": { + "uiFramework": "@storybook/angular", + "port": 4400, + "config": { + "configFolder": "libs/ui/three/.storybook" + } + } + }, + "build-storybook": { + "executor": "@nrwl/storybook:build", + "outputs": ["{options.outputPath}"], + "options": { + "uiFramework": "@storybook/angular", + "outputPath": "dist/storybook/ui/three", + "config": { + "configFolder": "libs/ui/three/.storybook" + } + }, + "configurations": { + "ci": { + "quiet": true + } + } + } + } + }, + "main-app": { + "projectType": "application", + "root": "apps/main-app", + "sourceRoot": "apps/main-app/src", + "prefix": "katst", + "architect": { + "build": { + "builder": "@angular-devkit/build-angular:browser", + "outputs": ["{options.outputPath}"] + }, + "storybook": { + "builder": "@nrwl/storybook:storybook", + "options": { + "uiFramework": "@storybook/angular", + "port": 4400, + "config": { + "configFolder": "apps/main-app/.storybook" + } + }, + "configurations": { + "ci": { + "quiet": true + } + } + }, + "build-storybook": { + "builder": "@nrwl/storybook:build", + "outputs": ["{options.outputPath}"], + "options": { + "uiFramework": "@storybook/angular", + "outputPath": "dist/storybook/main-app", + "config": { + "configFolder": "apps/main-app/.storybook" + } + }, + "configurations": { + "ci": { + "quiet": true + } + } + } + } + } + } +} diff --git a/packages/storybook/src/migrations/update-13-4-5/test-configs/non-angular.json b/packages/storybook/src/migrations/update-13-4-5/test-configs/non-angular.json new file mode 100644 index 00000000000000..db81e6f3015269 --- /dev/null +++ b/packages/storybook/src/migrations/update-13-4-5/test-configs/non-angular.json @@ -0,0 +1,60 @@ +{ + "projects": { + "ui-one": { + "projectType": "library", + "root": "libs/ui/one", + "sourceRoot": "libs/ui/one/src", + "targets": { + "storybook": { + "builder": "@nrwl/storybook:storybook", + "options": { + "uiFramework": "@storybook/react", + "port": 4400, + "config": { + "configFolder": "libs/ui/one/.storybook" + } + } + }, + "build-storybook": { + "executor": "@nrwl/storybook:build", + "outputs": ["{options.outputPath}"], + "options": { + "uiFramework": "@storybook/angular", + "outputPath": "dist/storybook/ui/one", + "config": { + "configFolder": "libs/ui/one/.storybook" + } + }, + "configurations": { + "ci": { + "quiet": true + } + } + } + } + }, + "main-app": { + "projectType": "application", + "root": "apps/main-app", + "sourceRoot": "apps/main-app/src", + "prefix": "katst", + "architect": { + "storybook": { + "builder": "@nrwl/storybook:storybook", + "options": { + "uiFramework": "@storybook/react", + "port": 4400, + "config": { + "configFolder": "apps/main-app/.storybook" + } + }, + "configurations": { + "ci": { + "quiet": true + } + } + } + } + } + } +}