Skip to content

Development tips

Atul Varma edited this page Oct 31, 2019 · 4 revisions

This wiki page contains tips for developers that are outside of the scope of the project README.

Using yarn link

Some of tenants2's dependencies are taken from our monorepo, justfix-ts. It may sometimes be preferable to develop those dependencies in concert with tenants2, e.g. so that you can make a change in a dependency and instantly see how it changes the behavior of tenants2, without needing to re-publish anything or update any package.json files.

This can be done via the yarn link command.

Setting up the dependency

First, in a terminal you'll want to get the monorepo up and running; see the justfix-ts README for instructions. For now we'll assume you want to make live changes to @justfixnyc/geosearch-requester for sake of example. Go into that package's directory and run:

yarn link
yarn watch

Setting up tenants2

The next step is to configure tenants2 to use the "live" version of the dependency you're working on. If you're using docker, the easiest way to proceed will actually be to build your front-end code outside of docker, while running everything else inside docker. This means you'll want to install node on your host system and run yarn in the root of the repository to install all its dependencies.

Next you'll want to open a separate terminal, tell yarn to use the live version of the dependency, and start the front-end build process:

yarn link @justfixnyc/geosearch-requester
yarn start

Finally, in a separate terminal, you can use docker to run the rest of the project in containers:

docker-compose up app db

Now you should see that, as you modify code in the dependency, the front-end will automatically re-bundle itself, and the behavior of the tenants2 front-end should change accordingly.

Clone this wiki locally