Skip to content

Commit

Permalink
Fix initialization of Storybook in Angular 16.1
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinpalkovic committed Jul 25, 2023
1 parent 65d79c4 commit 06e3194
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const angularBuildersMultiproject: Fix<AngularBuildersMultiprojectRunOpti
const frameworkPackageName = getFrameworkPackageName(mainConfig);

if (
(await isNxProject(packageManager)) ||
(await isNxProject()) ||
frameworkPackageName !== '@storybook/angular' ||
!angularVersion ||
semver.lt(angularVersion, '14.0.0')
Expand Down
2 changes: 1 addition & 1 deletion code/lib/cli/src/automigrate/fixes/angular-builders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const angularBuilders: Fix<AngularBuildersRunOptions> = {
// Skip in case of NX
if (
!angularVersion ||
(await isNxProject(packageManager)) ||
(await isNxProject()) ||
framewworkPackageName !== '@storybook/angular'
) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion code/lib/cli/src/detect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export async function detect(
return ProjectType.UNDETECTED;
}

if (await isNxProject(packageManager)) {
if (await isNxProject()) {
return ProjectType.NX;
}

Expand Down
5 changes: 2 additions & 3 deletions code/lib/cli/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
2 changes: 2 additions & 0 deletions code/lib/cli/src/initiate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ async function doInitiate(
}
done();

console.log({ projectType });

const storybookInstantiated = isStorybookInstantiated();

if (options.force === false && storybookInstantiated && projectType !== ProjectType.ANGULAR) {
Expand Down

0 comments on commit 06e3194

Please sign in to comment.