@repodog/storybook-config 10.0.7 → 10.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@repodog/storybook-config",
3
3
  "description": "The Repodog Storybook config module.",
4
- "version": "10.0.7",
4
+ "version": "10.0.9",
5
5
  "author": "miami-man",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/badbatch/repodog",
package/src/index.ts CHANGED
@@ -1,9 +1,13 @@
1
1
  import { type StorybookConfig } from '@storybook/react-webpack5';
2
2
  import { globSync } from 'glob';
3
+ import { dirname } from 'node:path';
3
4
  import { fileURLToPath } from 'node:url';
4
5
 
5
6
  const resolvePath = (name: string): string => fileURLToPath(import.meta.resolve(name));
6
7
 
8
+ const resolveAddOnPath = (packageName: string): string =>
9
+ dirname(fileURLToPath(import.meta.resolve(`${packageName}/package.json`)));
10
+
7
11
  export type ConfigParams = {
8
12
  compiler?: string | [name: string, options: object];
9
13
  };
@@ -16,13 +20,13 @@ export const config = ({ compiler }: ConfigParams = {}): StorybookConfig => {
16
20
 
17
21
  return {
18
22
  addons: [
19
- resolvePath('@storybook/addon-docs'),
20
- resolvePath('@storybook/addon-a11y'),
23
+ resolveAddOnPath('@storybook/addon-docs'),
24
+ resolveAddOnPath('@storybook/addon-a11y'),
21
25
  ...(isCompilerBabel
22
26
  ? [
23
- resolvePath('@storybook/addon-webpack5-compiler-babel'),
27
+ resolveAddOnPath('@storybook/addon-webpack5-compiler-babel'),
24
28
  {
25
- name: resolvePath('@storybook/addon-coverage'),
29
+ name: resolveAddOnPath('@storybook/addon-coverage'),
26
30
  options: {
27
31
  istanbul: {
28
32
  exclude: ['.storybook/**', '**/dist/**', '**/node_modules/**'],
@@ -31,9 +35,9 @@ export const config = ({ compiler }: ConfigParams = {}): StorybookConfig => {
31
35
  },
32
36
  ]
33
37
  : []),
34
- ...(isCompilerSwc ? [resolvePath('@storybook/addon-webpack5-compiler-swc')] : []),
38
+ ...(isCompilerSwc ? [resolveAddOnPath('@storybook/addon-webpack5-compiler-swc')] : []),
35
39
  {
36
- name: resolvePath('@storybook/addon-styling-webpack'),
40
+ name: resolveAddOnPath('@storybook/addon-styling-webpack'),
37
41
  options: {
38
42
  rules: [
39
43
  {
@@ -59,7 +63,7 @@ export const config = ({ compiler }: ConfigParams = {}): StorybookConfig => {
59
63
  enableCrashReports: false,
60
64
  },
61
65
  framework: {
62
- name: resolvePath('@storybook/react-webpack5'),
66
+ name: resolveAddOnPath('@storybook/react-webpack5'),
63
67
  options: {},
64
68
  },
65
69
  stories: globSync([`../components/**/*.stories.@(js|jsx|ts|tsx)`, '!../**/node_modules/**/*', '!../**/dist/**/*'], {