-
-
Notifications
You must be signed in to change notification settings - Fork 428
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
packages(ui): build step using rollup + tsc (#1344)
* refactor: packages(ui) - use `rollup` to build and transpile + tsc for dts files [WIP] * chore: packages(ui) - remove `rollup-plugin-delete` replace with local plugin using `rimraf` * fix: packages(ui) - build step generateDts overriding the rest * fix: packages(ui) - rework tsconfig files chore: apps(web) - update `tailwind.config` to use `.mjs` * feat: packages(ui) - create tailwind plugin for easier management of the `content` and `plugins` values for `tailwind.config.js` - change build output folder from `lib` to `dist` - chore: apps(web): use new plugi in `tailwind.config` * feat: packages(ui) - remove tailwind plugin and replace it with `tailwind` file which exports getters for `content` and `plugin` chore: apps(web): use new `flowbite-react/tailwind` in `tailwind.config` * chore: remove comments * chore: remove unused package * chore: remove rollup external leftover path * chore: add `trustedDependencies` for `postinstall` script to work in CI env * chore: get rid of `postinstall` lifecycle script and configure turborepo to handle the sequence of `apps/web` build and dev scripts * fix: turborepo `packages/ui` script dependencies * chore: rollup config - remove redundant array structure * chore: simplify turbo configs + fix `packages/ui` outputs path * chore: update docs introduction and installation guides to new config * fix: docs redwood guide tailwind config path * chore: remove comment * fix: docs redwood guide tailwind config path typo * chore: add changeset * Update .changeset/hungry-toys-care.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update .changeset/hungry-toys-care.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update .changeset/hungry-toys-care.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update .changeset/hungry-toys-care.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * chore: bump version minor --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
- Loading branch information
1 parent
65e7c89
commit bf1bdb0
Showing
23 changed files
with
319 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
--- | ||
"flowbite-react": minor | ||
--- | ||
|
||
## Rework build process using `rollup` and `tsc` | ||
|
||
### Summary | ||
|
||
In order to bring more performance to the build process of `flowbite-react` package, we have to consider transpiling the files using other tools rather than `tsc`, which is very slow. | ||
|
||
After evaluating various tools including `tsup`, `tshy`, and `bun build`, we chose `rollup` with the `esbuild` plugin for transpiling due to its performance and flexibility. We continue to use `tsc` solely for generating `*.d.ts` declaration files. | ||
|
||
### Changes | ||
|
||
- added `rollup` + `esbuild` for transpiling files | ||
- all files in the `cjs` directory now have `.cjs` extension | ||
- all files in the `esm` directory now have `.mjs` extension | ||
- declaration file types (`*.d.ts`) have been moved from `dist/esm` to `dist/types` | ||
- changed the build output dir from `lib` to `dist` | ||
- created a facade layer for easier management of the `content` path as well as the `plugin` | ||
- fixed turbo repo dependency tree configs in order for `apps/web` to properly pipe and require the build output of `packages/ui` in certain script steps such as `build` and `dev` | ||
|
||
### Breaking changes | ||
|
||
`tailwind.config.js` `content` path: | ||
|
||
old: `"node_modules/flowbite-react/lib/esm/**/*.js"` | ||
|
||
new: `"node_modules/flowbite-react/dist/esm/**/*.mjs"` - (`flowbite.content()` returns it) | ||
|
||
Before | ||
|
||
```js {5,9} | ||
/** @type {import('tailwindcss').Config} */ | ||
module.exports = { | ||
content: [ | ||
// ... | ||
"node_modules/flowbite-react/lib/esm/**/*.js", | ||
], | ||
plugins: [ | ||
// ... | ||
require("flowbite/plugin"), | ||
], | ||
}; | ||
``` | ||
|
||
After | ||
|
||
```js {1,7,11} | ||
const flowbite = require("flowbite-react/tailwind"); | ||
|
||
/** @type {import('tailwindcss').Config} */ | ||
module.exports = { | ||
content: [ | ||
// ... | ||
flowbite.content(), | ||
], | ||
plugins: [ | ||
// ... | ||
flowbite.plugin(), | ||
], | ||
}; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.