Working with the source
The DayPicker monorepo contains two workspaces setup with pnpm:
./package/react-day-picker
: this workspace contains the DayPicker source code and the development tools./website
: the Docusaurus app for the documentation website
Getting started
Prerequisites
- Node 18.16 and later. To set the version via nvm run:
$ nvm use
- To enable pnpm, make sure corepack is enabled:
$ corepack enabled
Setup
Clone the monorepo and install the dependencies:
$ git clone git@github.com:gpbl/react-day-picker.git
$ cd react-day-picker
$ pnpm
If you use Visual Studio Code, open the react-day-picker.code-workspace with for the development environment.
Development scripts
While working with the source code you will find useful these scripts:
$ pnpm -F react-day-picker typecheck-watch # start the typecheck in watch mode
$ pnpm -F react-day-picker develop # start the build in watch mode
$ pnpm -F website start # start the website in watch mode
$ pnpm -F website typecheck-watch # start the typecheck in watch mode for website
These are configured to start when opening the vscode project. If they won't, enable Manage Automatic Tasks In Folder from the Cmd+Shift+P menu.
Testing
In DayPicker we run unit tests and integration tests:
$ pnpm -F react-day-picker test # run the unit tests
$ pnpm -F website test # run the integration tests
Run the relative watch script to run the test in watch mode:
$ pnpm -F react-day-picker test-watch # run the unit tests
$ pnpm -F website test-watch # run the integration tests