From 83930dd6dc80298878c55f7160eae924c023f4f7 Mon Sep 17 00:00:00 2001 From: waldronmatt Date: Fri, 31 May 2024 12:57:44 -0400 Subject: [PATCH] fix(readme.md): update readme with live types info, reorganize features list --- packages/ui/README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/ui/README.md b/packages/ui/README.md index a9c63c65..10fdc587 100644 --- a/packages/ui/README.md +++ b/packages/ui/README.md @@ -2,6 +2,8 @@ A demo react component library. Heavily inspired by [this article](https://dev.to/receter/how-to-create-a-react-component-library-using-vites-library-mode-4lma). +This includes many modern best practices for publishing and consuming in monorepos. + ## Features - Fully tree shakeable (`js` and `css`) @@ -9,11 +11,16 @@ A demo react component library. Heavily inspired by [this article](https://dev.t - Outputs: - `esm` and `cjs` source files - source maps for JavaScript files (`.js.map`) - - `esm` and `cjs` declaration files (`.d.ts` and `.c.ts`) + - `esm` and `cjs` declaration files (`.d.ts` and `.d.cts`) - `esm` and `cjs` source maps for declaration files (`.d.ts.map` and `.c.ts.map`) - compiled CSS modules (consuming app is not required to support css modules) - Subpath exports for explicit path referencing. Will auto map to the right module system -- Component updates auto reflect (hmr) in monorepos when referenced via the `lib` subpath export installed via the `workspace:` protocol +- Live monorepo hmr supported: + - sub-packages in this monorepo install this package via the `pnpm` `workspace:` protocol + - sub-packages in this monorepo reference this package's `lib` subpath export (can be `lib/index.js` or any files under `lib`) +- Live monorepo types supported (approach [detailed here](https://colinhacks.com/essays/live-types-typescript-monorepo)): + - top-level `exports` field defines types for source files + - `publishConfig` defines types for production (will override `exports` when publishing to `npm`) - Libraries are externalized for a lighter bundle size (`react`, `react/jsx-runtime`) ## Installation