Welcome to Odopt! A monorepo of Dopt's open source packages.
The pull requests and commit history for this repository may look a bit odd. The reason is that we are syncing commits to open source packages in our primary/closed-source repository to this repository. While slightly complex to get setup, we love that this approach allows us to easily open source packages we think folks would benefit from while still enjoying the benefits of development in a monorepo. Additionally, we are going to generate quite a few SDKs for working with our APIs - all of which will be open source.
We use pnpm at Dopt. We switched from yarn to pnpm a year into developing because of how many times we'd been bit by phantom depdencies. We ❤️ the strictness and can't complain about the speed gains.
We utilize pnpm workspaces. The pnpm-workspace.yaml defines the root of our workspace and allows us to define/constrain where packages can live in the monorepo. For odopt it looks something like this
packages:
- "packages/**/*"
Our package manager (pnpm) and our build tool (turbo) will scan those directories and look for children package.json
files. Their dependencies are used to define our workspace's topology.
While our private repository is app-centric in structure e.g.
├── apps (apps that live on dopt.com)
├── services (services used by app(s))
└── packages (packages shared by apps)
this repository will be more package-centric i.e.
└── packages (packages open sourced from dopt)
Any children directories of the packages directory correspond to package scopes
└── packages
└── @dopt
and their children correspond to packages themselves
└── packages
├── @dopt
├─────── react
├─────── esbuild-plugins
├─────── please
└─────── ...
- @dopt/react: our React SDK for accessing/manipulating user flow state. README
- @dopt/please: a CLI for developing in monorepos - not building them. README
- @dopt/esbuild-plugins: esbuild plugins we've built in the process of developing dopt. README
- Install make
- Install fnm
- Install husky
https://typicode.github.io/husky/#/
pnpm --filter @dopt/cli exec husky install
- Install pnpm
git clone git@github.com:dopt/odopt.git;
cd odopt;
Node version management
#first time
$ fnm use `cat .nvmrc`
#subsequently
$ fnm use
Install all the dependencies of the monorepo
# install all dependencies in monorepo
$ pnpm i;
# build monorepo
$ make build;
If for any reason you need to start fresh you can run the following
make clean # remove any build artifacts (e.g. dist/ directories)
make uninstall # remove all node_modules directories