diff --git a/.github/workflows/chromatic.yml b/.github/workflows/chromatic.yml index 3452925..6895c05 100644 --- a/.github/workflows/chromatic.yml +++ b/.github/workflows/chromatic.yml @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 - uses: actions/checkout@v1 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a7fcb25..00c70e7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 18 - uses: actions/checkout@v1 diff --git a/.gitignore b/.gitignore index 697c60c..f6486c5 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,5 @@ yarn-error.log* *.tmp *.bak *.swp + +storybook-static/ diff --git a/storybook/.eslintrc.js b/storybook/.eslintrc.js index a63c0eb..085e30d 100644 --- a/storybook/.eslintrc.js +++ b/storybook/.eslintrc.js @@ -1,9 +1,5 @@ module.exports = { - extends: [ - 'airbnb', - 'airbnb/hooks', - 'plugin:@typescript-eslint/recommended', - ], + extends: ['airbnb', 'airbnb/hooks', 'plugin:@typescript-eslint/recommended', 'plugin:storybook/recommended', 'plugin:storybook/recommended'], env: { browser: true, jest: true, diff --git a/storybook/.storybook/main.js b/storybook/.storybook/main.js deleted file mode 100644 index 06b4b70..0000000 --- a/storybook/.storybook/main.js +++ /dev/null @@ -1,29 +0,0 @@ -const { mergeConfig } = require('vite'); - -module.exports = { - async viteFinal(config) { - return mergeConfig(config, { - css: { - modules: { - localsConvention: 'camelCase', - }, - }, - }); - }, - "stories": [ - "../stories/**/*.stories.mdx", - "../stories/**/*.stories.@(js|jsx|ts|tsx)" - ], - "addons": [ - "@storybook/addon-links", - "@storybook/addon-essentials", - "@storybook/addon-interactions" - ], - "framework": "@storybook/react", - "core": { - "builder": "@storybook/builder-vite" - }, - "features": { - "storyStoreV7": true - } -} diff --git a/storybook/.storybook/main.ts b/storybook/.storybook/main.ts new file mode 100644 index 0000000..0c78f2c --- /dev/null +++ b/storybook/.storybook/main.ts @@ -0,0 +1,31 @@ +import type { StorybookConfig } from "@storybook/react-vite"; + +import { join, dirname } from "path"; + +/** + * This function is used to resolve the absolute path of a package. + * It is needed in projects that use Yarn PnP or are set up within a monorepo. + */ +function getAbsolutePath(value: string): any { + return dirname(require.resolve(join(value, "package.json"))); +} +const config: StorybookConfig = { + stories: [ + "../stories/**/*.mdx", + "../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)", + ], + addons: [ + getAbsolutePath("@storybook/addon-links"), + getAbsolutePath("@storybook/addon-essentials"), + getAbsolutePath("@storybook/addon-onboarding"), + getAbsolutePath("@storybook/addon-interactions"), + ], + framework: { + name: getAbsolutePath("@storybook/react-vite"), + options: {}, + }, + docs: { + autodocs: "tag", + }, +}; +export default config; diff --git a/storybook/.storybook/preview-head.html b/storybook/.storybook/preview-head.html index 424f713..a1e2cbd 100644 --- a/storybook/.storybook/preview-head.html +++ b/storybook/.storybook/preview-head.html @@ -2,7 +2,7 @@ window.global = window;