Skip to content

Commit

Permalink
Monorepo conversion (using bun) (#1264)
Browse files Browse the repository at this point in the history
* monorepo init:
- bun [runtime, package manager, task runner, test runner]
- biome [format, lint]
- removed `cypress` (to be replaced with `playwright`)
- removed codecov
- split into multiple packages and apps [web(docs), ui(library), storybook, cli]

UNSTABLE

* (web): remove unused packages

* remove eslint disable rules comments

* fix some linting errors

* (web): link library to monorepo `ui` package

* fix(web): build
fix(ui): exports
fix(root): sort `package.json`

* package upgrade

* fix(storybook):
- replace `@vitejs/plugin-react-sw` -> `@vitejs/plugin-react`
- fix build
- add `.gitignore`
- update stories path

* move git related files in `.git`

* cleanup:
- remove `biome` and drop `bun:test` until stable
- add `prettier`
- imporve `.vscode` files and add extentions suggestions

* - restore prettier config + add tailwind formatting support
- remove more biome leftover
- add package json sorter

* upgrade all packages

* refactor:
- prettier config: add import sorting
- format files

* packages: up

* packages: up storybook

* fix: prettier plugin order

* chore(ui): add `vitest`; add missing `Accordion.spec` import

* chore(root): add turbo test commands and format `package.json`

* fix: intellisense and tailwind support; add `eslint`

* fix(lib): lint errors

* feat(ui): add `createTheme` tailwindcss intellisense function

* refactor(ui): use new tailwindcss shorthands

* fix(storybook/banner): remove invalid tailwind classes

* chore: add `.editorconfig`

* refactor(ui): wrap all components `theme` with `createTheme` to gain class sorting, linting and apply fixes

* fix: prettier config for root and for apps and packages; format code

* refactor: move common eslint packages to root `package.json`;
- add `eslint` to `web`
- optimise onboarding flow
- fix tailwind lint errors here and there

* chore: up packages

* refactor: (web) lint rules + fix examples

* refactor: CI/CD improvements:
- refactor github actions
- setup github actions using `bun`
- remove storybook github action (redo later)

* fix: CI/CD setup action, add missing required property

* fix(web): typecheck

* fix(lib): type module for failing tests

* fix(lib): `package.json` meta and npm tags; update peerDeps

* fix(lib: tsconfig exclude

* fix(lib): rename eslint config to cjs since `"type": "module"`

* fix(web): eslint nextjs rule; supposably fixed flicker on reload

* fix(lib): merge-deep test

* chore(lib): eslint config updates

* fix(lib): bypass `datepicker` test (unfinished)

* refactor(lib): remove `toggleSwitchTheme` empty space

* chore: up packages

* fix(lib): failing tests due to concurrency

* fix(lib): test coverage + format files

* refactor(global): switch from `singleQuote` to double

* refactor(lib): more tailwind shorthands

* chore: up packages

* chore: up packages

* packages(cli): add first version
general: update packages

* packages(cli): fix typecheck

* packages(cli): refactor
- add [dir] argument
- add [options] argument
  - `--template <name>`
  - `-h, --help`

* packages(cli): add `-v, --version` in [options]

* packages(cli): add `README.md`

* fix: package.json repository.url

* packages(cli): add `--git` option

* packages(cli): up package version

* packages(cli): update `README.md`

* packages(cli): bump package version patch

* config: sort and tidy up .vscode settings.json

* fix(docs): navbar package version

* fix(docs): mdx heading color

* feat(docs): code demo:
- add screen size controls (desktop/tablet/mobile)
- add RTL control

* feat(docs): code demo:
- add tooltip to copy-to-clipboard
- fix icon sizes

* feat(docs): create `CLI` page

* feat(docs): integratoin guides - add `CLI` and `Templates` sections

* fix(web): homepage - components section hover styles; sidebar - more spacing (synced with @robert)

* packages(cli): update `README.md`
apps(web): update CLI page

* packages(cli): bump package version patch

* apps(web): update `README.md`, `CONTRIBUTING` files; change integration guides order based on popularity/category; remove redundant `typescript` page

packages(cli): change integration guides order based on popularity/category; bump version (patch)

* apps(web): fix, rewrite and simplify `introduction` and `quickstart` pages

* apps(web): fix narrow context

* apps(web): small style fixes

* chore: up packages + format

* apps(web): add `Editor Setup` page

* apps(web): remix guide: add dark mode section

* apps(web): refactor `Dark mode` page

* fix: color flicker on reload + move background and text color to root layout

* packages(ui): fix alert them blue color

* apps(web): code demo: isolate dark/light mode

* apps(web): inline code: add background

* feat: add `changeset`

* chore: move `CHANGELOG` to packages/ui

* chore: add self to `FUNDING`

* chore: add `@changesets/changelog-github`

* chore: up packages

* core improvements:
- add `rimraf` for windows support
- add `clean-package` for cleaner `package.json` file (used for `flowbite-react` and `create-flowbite-react` packages)

* packages(cli): change intro color from `blue` to `cyan` + bump version (patch)

* packages(cli): update package.json - add [homepage, bugs] links

* chore: move root `README.md` to `packages/ui` + create symlink from it to root

* core(ci): test build sync times

* core(ci): test build async times

* chore: format

* fix: turbo.json configs and isolate using turbo workspaces

* chore: CLI commands to use @latest for `pnpm` and `bun`

* chore: version `packages/cli`

* chore: remove random code example

* chore: spacing

* chore: up `packageManager` version

* fix: storybook next dependency examples

* chore: up packages, see if it fixes storybook build failure

* fix: storybook types

* fix: storybook warning

* packages(ui): fix version

* chore: up `packageManager` version

* chore: up packages, see if it fixes storybook build failure

* chore: rebuild lock file, check if storybook fails

* chore: CI cache clear before install

* chore: undo CI cache clear before install

* chore: downgrade `packageManager` from `[email protected]` to stable `[email protected]` due to storybook failing; update some packages

* chore: bump storybook packages

* fix(ui): polymorphic component return type -> type casting

* chore: simplify types

* chore: bump package from merge conflict

---------

Co-authored-by: SutuSebastian <[email protected]>
  • Loading branch information
SutuSebastian and SutuSebastian authored Mar 24, 2024
1 parent c32728b commit b19a92e
Show file tree
Hide file tree
Showing 1,273 changed files with 28,288 additions and 42,666 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": ["@changesets/changelog-github", { "repo": "themesberg/flowbite-react" }],
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["storybook", "web"]
}
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# editorconfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

File renamed without changes.
48 changes: 13 additions & 35 deletions CONTRIBUTING.md → .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,6 @@ And if you like the project, but just don't have time to contribute, that's fine
- Refer this project in your project's readme
- Mention the project at local meetups and tell your friends/colleagues

## Table of Contents

- [Code of Conduct](#code-of-conduct)
- [I Have a Question](#i-have-a-question)
- [I Want To Contribute](#i-want-to-contribute)
- [Reporting Bugs](#reporting-bugs)
- [Suggesting Enhancements](#suggesting-enhancements)
- [Your First Code Contribution](#your-first-code-contribution)
- [Improving The Documentation](#improving-the-documentation)
- [Styleguides](#styleguides)
- [Commit Messages](#commit-messages)

## Code of Conduct

This project has adopted the [Contributor Covenant](https://www.contributor-covenant.org/) as its Code of Conduct. Everyone is expected to adhere to these rules, so please read the [full text](https://www.contributor-covenant.org/version/2/1/code_of_conduct/). Thank you.
Expand Down Expand Up @@ -108,11 +96,11 @@ Don't forget to:

#### Prerequisites

- You need to understand how to use a terminal, Git, Node.js, and Yarn
- You should be able to write Markdown and React TypeScript
- You should be familiar with Tailwind CSS, ESLint, and Prettier
- You need to understand how to use a terminal, `Git`, `Node.js`, and `Bun`
- You should be able to write `Markdown` and `React TypeScript`
- You should be familiar with `Tailwind` `CSS`, `ESLint`, and `Prettier`
- You should understand what [vitest](https://vitest.dev/) is, and be able to write tests if your contribution changes the behavior of the library in some way
- You should strongly consider using [Visual Studio Code](https://code.visualstudio.com/) as your editor, as it has plugins for Tailwind CSS, ESLint, and Prettier which will automatically fix most style issues for you, and offer suggestions for how to fix the rest
- You should strongly consider using [Visual Studio Code](https://code.visualstudio.com/) as your editor, as it has plugins for `Tailwind CSS`, `ESLint`, and `Prettier` which will automatically fix most style issues for you, and offer suggestions for how to fix the rest

#### Creating a Pull Request

Expand All @@ -131,39 +119,33 @@ git remote add upstream https://github.com/themesberg/flowbite-react.git
git checkout -b fix/accordion-alwaysopen
```

4. Install dependencies with [`yarn`](https://classic.yarnpkg.com/en/docs/install#debian-stable):
4. Install dependencies with [`bun`](https://bun.sh/):

```bash
yarn install
bun install
```

5. Start a development server on your machine:

```bash
yarn dev
bun run dev
```

6. Commit changes with `yarn commit` to follow the required [commitizen](https://github.com/commitizen/cz-cli) format:
6. Make sure your changes work and don't break anything else:

```bash
yarn commit
bun run format && bun run lint:fix && bun run test && bun run build
```

7. Make sure your changes work and don't break anything else:

```bash
yarn prettier:fix && yarn lint && yarn test && yarn build
```

8. Push to your forked repository
7. Push to your forked repository

```bash
git push -u origin fix/accordion-alwaysopen
```

9. Go to [the repository](https://github.com/themesberg/flowbite-react) and [create a Pull Request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request)
8. Go to [the repository](https://github.com/themesberg/flowbite-react) and [create a Pull Request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request)

10. Fill out the Pull Request template, which will be available automatically
9. Fill out the Pull Request template, which will be available automatically

#### What Happens Next?

Expand All @@ -179,14 +161,10 @@ The [documentation at flowbite-react.com](https://flowbite-react.com/docs/gettin

### Files

We use [Prettier](https://prettier.io/) to format all of our code. Please make sure to run `yarn format` before committing any changes. You can also use VS Code as your editor, and install the Prettier and Tailwind CSS IntelliSense plugins to automatically format your code each time you save.
We use [Prettier](https://prettier.io/) to format all of our code. Please make sure to run `bun run format` before committing any changes. You can also use VS Code as your editor, and install the Prettier and Tailwind CSS IntelliSense plugins to automatically format your code each time you save.

Please refer to the code written already in the project to see how we format our code, what naming conventions we use, and so on. The more consistent your code is with the rest of the project, the easier it will be to review and merge your Pull Request.

### Commits

We use [commitizen](https://github.com/commitizen/cz-cli) to format commit messages. Please use `yarn commit` instead of `git commit` when committing changes.

### Branches &amp; Pull Requests

Please follow the same guidelines published by [commitizen](https://github.com/commitizen/cz-cli) when you name a branch that will be used for a Pull Request. The branch name should be prefixed with the most significant change that will be introduced in the Pull Request.
Expand Down
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# These are supported funding model platforms

github: [rluders, tulup-conner]
github: [rluders, tulup-conner, SutuSebastian]
19 changes: 19 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Setup
description: Setup Bun, Node and install packages

runs:
using: composite
steps:
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: 1.0.31

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install packages
shell: bash
run: bun install
106 changes: 61 additions & 45 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,52 +5,68 @@ on:
branches:
- main

concurrency: ${{ github.ref }}

jobs:
format:
name: 💅 Format
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

- name: Run format
run: bun run format:check

lint:
name: 🕵 Lint
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

- name: Run lint
run: bun run lint

typecheck:
name: ✅ Typecheck
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

- name: Run typecheck
run: bun run typecheck

test:
name: 🔬 Test
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

- name: Run unit tests
run: bun run test:coverage

build:
name: 🧰 Build
runs-on: ubuntu-latest
steps:
- name: 📥 Check out the code
uses: actions/checkout@v3
with:
fetch-depth: 2

- name: 💿 Setup NodeJS 20
uses: actions/setup-node@v3
with:
node-version: 20

- name: ⏳ Setup Cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-modules-
- name: 🏭 Install packages
run: yarn install

- name: 🕵 Lint the code
run: yarn lint

- name: 💅 Run Prettier
run: yarn prettier

- name: 🔬 Run unit tests
run: yarn test:coverage

- name: 📊 Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
files: coverage/coverage-final.json
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true

- name: 🧰 Build Library
run: yarn build:lib

- name: 🧰 Build NextJS
run: yarn build
- name: Checkout branch
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

- name: Run build
run: bun run build
21 changes: 0 additions & 21 deletions .github/workflows/storybook.yml

This file was deleted.

22 changes: 9 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
.next
.vercel
build
coverage
cypress/screenshots
cypress/videos
lib
# dependencies
node_modules
storybook-static

# misc
.DS_Store
npm-debug.log*
*.pem

# typescript
tsconfig.tsbuildinfo
yarn-debug.log*
yarn-error.log*
dist
.contentlayer

# turbo
.turbo
8 changes: 0 additions & 8 deletions .idea/.gitignore

This file was deleted.

22 changes: 0 additions & 22 deletions .npmignore

This file was deleted.

19 changes: 0 additions & 19 deletions .prettierignore

This file was deleted.

6 changes: 0 additions & 6 deletions .prettierrc

This file was deleted.

Loading

0 comments on commit b19a92e

Please sign in to comment.