Skip to content

Commit 208e430

Browse files
committed
chore: add jsdoc explaining the need for getAbsoluteDependencyPath
1 parent 334f250 commit 208e430

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

packages/eui/.storybook/main.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@
99
import path from 'path';
1010
import type { StorybookConfig } from '@storybook/react-webpack5';
1111

12+
/**
13+
* Get an absolute path to package's `node_modules` directory. It's compatible
14+
* with yarn hoisting logic.
15+
*
16+
* It works by resolving a path to its `package.json` file since it's the only
17+
* file that must exist in the package's root directory. Resolving the package
18+
* itself would return a path to the entry point that could be anywhere within
19+
* that package's directory.
20+
*
21+
* @see {@link https://github.com/storybookjs/storybook/issues/21710#issuecomment-1604260157}
22+
*/
1223
const getAbsoluteDependencyPath = (packageName: string) =>
1324
path.dirname(require.resolve(path.join(packageName, 'package.json')));
1425

0 commit comments

Comments
 (0)