From 42352ada1727864f7990dc3d60d50f51e62a1294 Mon Sep 17 00:00:00 2001 From: Valentin Palkovic Date: Tue, 25 Jul 2023 14:09:23 +0200 Subject: [PATCH] Merge pull request #23598 from storybookjs/valentin/fix-initialization-of-storybook-in-angular-16.1 Angular: Fix initialization of Storybook in Angular 16.1 (cherry picked from commit 0aec10100ab6006d859103ac2948a87d33875178) --- .../src/automigrate/fixes/angular-builders-multiproject.ts | 2 +- code/lib/cli/src/automigrate/fixes/angular-builders.ts | 2 +- code/lib/cli/src/detect.ts | 2 +- code/lib/cli/src/helpers.ts | 5 ++--- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/code/lib/cli/src/automigrate/fixes/angular-builders-multiproject.ts b/code/lib/cli/src/automigrate/fixes/angular-builders-multiproject.ts index 1c543f1a5504..229f3aaf9394 100644 --- a/code/lib/cli/src/automigrate/fixes/angular-builders-multiproject.ts +++ b/code/lib/cli/src/automigrate/fixes/angular-builders-multiproject.ts @@ -19,7 +19,7 @@ export const angularBuildersMultiproject: Fix = { // Skip in case of NX if ( !angularVersion || - (await isNxProject(packageManager)) || + (await isNxProject()) || framewworkPackageName !== '@storybook/angular' ) { return null; diff --git a/code/lib/cli/src/detect.ts b/code/lib/cli/src/detect.ts index 4fa86cdc280d..c1b9317bc556 100644 --- a/code/lib/cli/src/detect.ts +++ b/code/lib/cli/src/detect.ts @@ -212,7 +212,7 @@ export async function detect( return ProjectType.UNDETECTED; } - if (await isNxProject(packageManager)) { + if (await isNxProject()) { return ProjectType.NX; } diff --git a/code/lib/cli/src/helpers.ts b/code/lib/cli/src/helpers.ts index b72e625ad716..db5cfb34d1ac 100644 --- a/code/lib/cli/src/helpers.ts +++ b/code/lib/cli/src/helpers.ts @@ -300,7 +300,6 @@ export function getStorybookVersionSpecifier(packageJson: PackageJsonWithDepsAnd return allDeps[storybookPackage]; } -export async function isNxProject(packageManager: JsPackageManager) { - const nxVersion = await packageManager.getPackageVersion('nx'); - return !!nxVersion ?? findUp.sync('nx.json'); +export async function isNxProject() { + return findUp.sync('nx.json'); }