From 6bc4e6e45e79bac1348f644993717d1944538bc8 Mon Sep 17 00:00:00 2001 From: Lukas Spirig Date: Tue, 19 Sep 2023 17:04:14 +0200 Subject: [PATCH] chore: update dependencies --- package.json | 7 ++++--- tsconfig.json | 2 +- vite.config.ts | 36 +++++++++++++++++++++++------------- yarn.lock | 13 +++++++++++++ 4 files changed, 41 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 14b42039be..3483fbe140 100644 --- a/package.json +++ b/package.json @@ -72,14 +72,15 @@ "@storybook/testing-library": "0.2.1", "@storybook/web-components": "^7.0.27", "@storybook/web-components-vite": "^7.4.0", + "@types/glob": "^8.1.0", "@types/react": "^18.2.15", "@types/react-dom": "^18.2.7", - "@typescript-eslint/eslint-plugin": "6.7.0", - "@typescript-eslint/parser": "6.7.0", + "@typescript-eslint/eslint-plugin": "6.7.2", + "@typescript-eslint/parser": "6.7.2", "@web/test-runner": "^0.16.1", "@web/test-runner-commands": "^0.7.0", "@web/test-runner-playwright": "^0.10.1", - "chromatic": "7.1.0", + "chromatic": "7.2.0", "eslint": "8.49.0", "eslint-config-prettier": "9.0.0", "eslint-plugin-jest": "27.4.0", diff --git a/tsconfig.json b/tsconfig.json index 2eee8f6161..afd6c7bdc7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -30,5 +30,5 @@ } ] }, - "include": ["./src/**/*.ts", "node_modules/lit-scss-loader/types.d.ts"] + "include": ["./src/**/*.ts", "./src/**/*.tsx", "node_modules/lit-scss-loader/types.d.ts"] } diff --git a/vite.config.ts b/vite.config.ts index c18d01653f..36236b90e6 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,8 +1,8 @@ import { PluginOption, defineConfig } from 'vite'; import postcssLit from 'rollup-plugin-postcss-lit'; -// import dts from 'vite-plugin-dts'; +import dts from 'vite-plugin-dts'; import glob from 'glob'; -import { basename, dirname } from 'path'; +import { basename, dirname, join } from 'path'; import { fileURLToPath } from 'url'; export const plugins: PluginOption[] = [ @@ -11,20 +11,30 @@ export const plugins: PluginOption[] = [ }), ]; +// Include all directories containing an index.ts +const modules = glob + .sync('src/components/*/index.ts', { + cwd: dirname(fileURLToPath(import.meta.url)), + }) + .map(dirname); + export default defineConfig({ - // TODO: Add dts({ rollupTypes: true }) for production - plugins: [...plugins], + plugins: [ + ...plugins, + ...modules.map((p) => + dts({ + entryRoot: p, + include: `${p}/**/*.{ts,tsx}`, + exclude: '**/*.{stories,spec,e2e}.{ts,tsx}', + }), + ), + ], build: { lib: { - // Could also be a dictionary or array of multiple entry points - entry: glob - .sync('src/components/*/index.ts', { - cwd: dirname(fileURLToPath(import.meta.url)), - }) - .reduce( - (current, next) => Object.assign(current, { [basename(dirname(next))]: next }), - {} as Record, - ), + entry: modules.reduce( + (current, next) => Object.assign(current, { [basename(next)]: join(next, 'index.ts') }), + {} as Record, + ), formats: ['es'], }, minify: false, diff --git a/yarn.lock b/yarn.lock index 5c536dfafc..1274824b8a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3136,6 +3136,14 @@ resolved "https://registry.yarnpkg.com/@types/find-cache-dir/-/find-cache-dir-3.2.1.tgz#7b959a4b9643a1e6a1a5fe49032693cc36773501" integrity sha512-frsJrz2t/CeGifcu/6uRo4b+SzAwT4NYCVPu1GN8IB9XTzrpPkGuV0tmh9mN+/L0PklAlsC3u5Fxt0ju00LXIw== +"@types/glob@^8.1.0": + version "8.1.0" + resolved "https://registry.yarnpkg.com/@types/glob/-/glob-8.1.0.tgz#b63e70155391b0584dce44e7ea25190bbc38f2fc" + integrity sha512-IO+MJPVhoqz+28h1qLAcBEH2+xHMK6MTyHJc7MTnnYb6wsoLR29POVGJ7LycmVXIqyy/4/2ShP5sUwTXuOwb/w== + dependencies: + "@types/minimatch" "^5.1.2" + "@types/node" "*" + "@types/graceful-fs@^4.1.3": version "4.1.6" resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.6.tgz#e14b2576a1c25026b7f02ede1de3b84c3a1efeae" @@ -3243,6 +3251,11 @@ resolved "https://registry.yarnpkg.com/@types/mime/-/mime-1.3.2.tgz#93e25bf9ee75fe0fd80b594bc4feb0e862111b5a" integrity sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw== +"@types/minimatch@^5.1.2": + version "5.1.2" + resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca" + integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA== + "@types/minimist@^1.2.0", "@types/minimist@^1.2.2": version "1.2.2" resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.2.tgz#ee771e2ba4b3dc5b372935d549fd9617bf345b8c"