To start developing locally, use the following steps:
- In the root directory of the repo, run
yarn dev:setup
.This will link the components package to the docs site.
- Run `yarn dev:components
This will watch the
components/src
directory for changes and run the build. - In another terminal window, run
yarn dev:docs
.This will start the vite dev server for the docs site.
- Visit http://localhost:5173.
⚠️ If this doesn't work on your first time setting up the project, try going to the components directory and running yarn build then following the steps again.
The Long Way
1. In the `components` directory, run `yarn watch`.This will watch the `src` directory for changes and run the build
1. In another terminal window, run `yarn link`.
1. Then change to the `docs` directory, and run `yarn link @adiago/components`.
1. Now run `yarn dev` to start the docs dev server.
1. Visit http://localhost:5173.
We want to mimicking Radix UI file/component structure if we have more complex components and sub-components
Reference: https://github.com/radix-ui/primitives/tree/main/packages/react/accordion/src
- Create a new folder in the
src
directory with the name of your component. - Create a new file by the same name of your component in that folder as well as an
index.ts
file. - Add exports to the
{component-name}/index.ts
and to the top levelindex.ts
file.
- Create a new file in the
docs/src/pages/docs
directory with the file namepage-docs-{component-name}.tsx
. - Name the component
PageDocs{ComponentName}.tsx
and add it to theindex.ts
in the directory. - You can now visit http://localhost:5173/{ComponentName} to see your new page.
This library is built with Parcel. I have tried esbuild, rollup and webpack. Each was either too slow or created files that did not work.
There has been an open bug in @parcel/transformer-typescript-types
package that is interfering with Typescript 4.8.0.
parcel-bundler/parcel#8419
There is another bug prohibiting the use of nested/doubly exported exports. This is the reason for the extra work in the index.ts files. parcel-bundler/parcel#5911