flowbite-react icon indicating copy to clipboard operation
flowbite-react copied to clipboard

Improve monorepo support, provide configuration path for `.flowbite-react` directory

Open antonio-ivanovski opened this issue 11 months ago • 6 comments

  • [x] I have searched the Issues to see if this bug has already been reported
  • [x] I have tested the latest version

Steps to reproduce

  1. Create repository with Nx
  2. Use @nx/vite
  3. Run the application with @nx/vite

Current behavior

The path of .flowbite-react by the plugin is being resolved into the root directory of the monorepo.

The class-list.json is being generated in the root directory.

Expected behavior

The path of .flowbite-react by the plugin is being resolved to the application directory or to the configured plugin path.

Context

When running scripts via NX the execution path is the root of the repository. This means when one does process.cwd() the root path is being returned.

I had similar issue with Tanstack Router, fortunately it has path configuration

defineViteConfig({
      logLevel: 'info',
      root: import.meta.dirname,
      plugins: [
          react(),
          tailwindcss(),
          flowbiteReact(),
          svgr(),
          TanStackRouterVite({
              routesDirectory: `${import.meta.dirname}/src/routes`,
              generatedRouteTree: `${import.meta.dirname}/src/routeTree.gen.ts`,
          }),
      ],

antonio-ivanovski avatar Apr 02 '25 14:04 antonio-ivanovski

U can solve this by simply running the npx flowbite-react@latest init into the target app directory u want to install it in.

SutuSebastian avatar Apr 02 '25 14:04 SutuSebastian

What is ur project file structure?

SutuSebastian avatar Apr 02 '25 14:04 SutuSebastian

U can solve this by simply running the npx flowbite-react@latest init into the target app directory u want to install it in.

I have already installed everything and have ran this script there. It did some things nice some things not so nice so had to manually move some bits and pieces around. But this is due to my custom setup.

What is ur project file structure?

> packages
>> some_package
> applications
>> web
>>> dashboard
>>>> src
>>>> viteconfig
>>>> .flowbite-react

antonio-ivanovski avatar Apr 02 '25 14:04 antonio-ivanovski

I'll play around with nx monorepo setup and see what I can find.

SutuSebastian avatar Apr 03 '25 08:04 SutuSebastian

Either the Flowbite plugin needs to be smart and be able to detect the actual path it should look for and create the config, or it can just accept variable with the path itself.

Don't think there is anything wrong with the second approach of giving path config as many projects have many different setups.

antonio-ivanovski avatar Apr 03 '25 10:04 antonio-ivanovski

I'll try to make it automatic, with fallback to custom config passed through plugin options.

SutuSebastian avatar Apr 03 '25 10:04 SutuSebastian