Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to transition local dev setups to the new repo #13

Open
thomasgwatson opened this issue Oct 15, 2024 · 3 comments
Open

How to transition local dev setups to the new repo #13

thomasgwatson opened this issue Oct 15, 2024 · 3 comments
Assignees
Labels
question Further information is requested

Comments

@thomasgwatson
Copy link
Collaborator

thomasgwatson commented Oct 15, 2024

As of 15 OCT 2024:

We are ready to switch to monorepo usage now with the following caveats and instructions:

  • apps/web and apps/mobile do link dynamically (with hot reloading in dev) to packages/shared (@hylo/shared)
  • apps/api is still linked to the legacy npm package hylo-shared so unless we need to still don’t add anything to libs/shared until I get it also linked up #todo
  • Both apps/api and apps/web are currently set to not hoist their dependencies up, which is in efficient but shouldn’t impact the dev workflow at this point #todo
Using it:
  • Checkout https://github.com/Hylozoic/hylo at main branch which reflects the following states for each legacy repo:
  • apps/web is at branch monorepo-setup-shared with some additional monorepo related config
  • apps/api is at branch dev
  • apps/mobile is at branch dev (which does include collective moderation / 5.9 release)
  • packages/shared is the latest from main (so same as hylo-shared 5.2.5 on npm currently)
  • Run yarn install from anywhere in the monorepo from anywhere in the repo to install for everything.
  • Copy your .env files from your local checkouts of the legacy repos to their respective roots in the monorepo (e.g. hylo-evo/,env goes to apps/web/.env, etc)
  • The first time through on mobile you’ll need to run scripts/configure.sh and do a bundle install and pod install
  • To use each app, just do you as you did before but from the appropriate dir (e.g. hylo-evo > ‘cd apps/web, yarn dev’, etc).
There are a few workspace level scripts shortcut scripts there for convienance:
  • yarn web:dev = yarn workspace web dev
  • yarn api:dev = yarn workspace api dev
  • yarn mobile:dev = yarn workspace api start
  • yarn mobile:pod-install = does the pod install thing from the apps/mobile/ios dir
  • yarn mobile:ios does the ios build and attempts to run the sim
  • yarn mobile:android does the android build and attempts to run the sim
Adding code going forward
  • Fetch dev
  • Checkout feature branch
  • edit!
@thomasgwatson thomasgwatson added the question Further information is requested label Oct 15, 2024
@thomasgwatson thomasgwatson mentioned this issue Oct 20, 2024
9 tasks
@thomasgwatson
Copy link
Collaborator Author

Getting tests working on the backend...

ok, so steps so far.

Now running "test": "mocha -r test/setup/core -r @babel/register --exit", as the test command. The test/setup/core file was setting the NODE_ENV to test anyway, so seems redundant to have some reference to NODE_ENV in the command itself.

Maybe its there for a reason but can't see any comments to suggest why

The next problem was .load() was failing on dotenv references... updated the dotenv dependences and .load() is gone now, instead you use .config().

Now the warning that the test database needs to have test in its name; which is great because you don't want running tests to nuke your databases 🙂

Previously we had a .env.test file that defined the test db to point at (amongst other things)

That hadn't been pulled across from my prior node repo, so I pulled that across.

But its still throwing the same error. So the setup isn't picking up the test env file. I assume it did previously, so now I just need to figure out how to get it to grab .env.test instead of .env when its testing

@KevinTriplett
Copy link
Contributor

Thanks Tom! I'll be back home starting this coming week, and will pick up where you are, hopefully. It may be good to schedule a call with you so we can work together. Will let you know if I need that. Ta!

@lorenjohnson
Copy link
Member

lorenjohnson commented Nov 1, 2024

This may be of some help. It is the start and some decent progress on getting CircleCI to "do the right thing" with the monorepo, i.e. it will run tests on a branch for any of the effected projects (web, mobile, or backend). So if there are only changes in the branch for mobile, only mobile tests run.

I THINK I'd gotten the backend tests were running in this setup, but need to confirm. However this worked out, it was at least successful running in Yarn Berry.

#25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants