We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
getAbsoluteDependencyPath
1 parent 334f250 commit 208e430Copy full SHA for 208e430
1 file changed
packages/eui/.storybook/main.ts
@@ -9,6 +9,17 @@
9
import path from 'path';
10
import type { StorybookConfig } from '@storybook/react-webpack5';
11
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
+ */
23
const getAbsoluteDependencyPath = (packageName: string) =>
24
path.dirname(require.resolve(path.join(packageName, 'package.json')));
25
0 commit comments