Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions code/core/src/common/utils/get-storybook-refs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { logger } from 'storybook/internal/node-logger';
import type { Options, Ref } from 'storybook/internal/types';

import * as pkg from 'empathic/package';
import * as resolve from 'empathic/resolve';

import { getProjectRoot } from './paths.ts';

Expand All @@ -23,7 +22,7 @@ export const getAutoRefs = async (options: Options): Promise<Record<string, Ref>
const list = await Promise.all(
deps.map(async (d) => {
try {
const l = resolve.from(directory, join(d, 'package.json'));
const l = join(directory, 'node_modules', d, 'package.json');

const { storybook, name, version } =
JSON.parse(await readFile(l, { encoding: 'utf8' })) || {};
Expand All @@ -32,9 +31,7 @@ export const getAutoRefs = async (options: Options): Promise<Record<string, Ref>
return { id: name, ...storybook, version };
}
} catch (error) {
if ((error as any).code === 'ERR_PACKAGE_PATH_NOT_EXPORTED') {
// silent warning because user can't do anything about it
// "package.json" is not part of the package's "exports" field in its package.json
if ((error as NodeJS.ErrnoException).code === 'ENOENT') {
return undefined;
}
logger.warn(`unable to find package.json for ${d}`);
Expand Down
Loading