one rather annoying thing about the developer loop...
# dev
z
one rather annoying thing about the developer loops while working on these examples, and maybe I just picked the wrong part of the codebase to fiddle on... I can't get these examples working from inside the monorepo. But that shouldn't matter anyway, because you tell people to "fork and clone" their chosen example repo from the solo-repo version. ok, already a bit confusing but cool. So I work off of that repo, but then I need to submit the actual PR to the...monorepo...which often has upstream code changes and package bumps and all other kinds of drift. And then I'm trying to reconcile the two and test on the right one and move back and forth and it gets really tedious. All I want to do is create a clean PR for this 13 month old Next example PR, and it's so annoyingly hard. I'm looking at a repo that was forked as a template that is now somehow a downstream mirror of a canonical example inside the `./examples`dir of another repo. all while the example application behaves differently when I clone it directly vs when I work from inside the monorepo. woof.
r
@zuchka_ I'm sorry you're having a poor experience with the monorepo. It's definitely our intent that you should be able to get the examples working from within the monorepo, without needing to deal with the downstream mirrors
I'm happy to work with you on getting the nextJS example working. Admittedly, this one is pretty old
The "fork and clone" workflow is really more for when you're starting your own build and are "ejecting" from the example. Not so much for contirbuting
This is the script that we use to create the mirrors (https://github.com/medplum/medplum/blob/9e9a302f79ae35444ac66feb26e35ac5c6a2a76b/scripts/update-example-changes.sh#L1). There's definitely a lot of improvements we can make: - Inject text to the README to make it clear this should be readonly, and encourage contributors to clone the monorepo - Change the git settings to lock down issues and PRs to avoid stale PRs
z
the next template works just fine from the monorepo. I'm just thrashing about trying to make a change. the chart-demo does NOT work from the monorepo, nor the standalone. the standalone will work when my PR is merged and the changes propogate to the mirror, but there are still some that don't work from the monorepo. maybe the ones with the bots
at least for me. i'd love for it to be a config thing on my side but I don't see it yet
r
For the chart demo, there are the steps on my side from a clean clone:
Copy code
bash
cd <monorepo root>
# Install from package-lock.json
npm ci
# Build the `core` `server` `app` `react` and `mock` packages
npm run build:fast
# step into the chart demo
cd examples/medplum-chart-demo
# build bots into an intermediate state. This is to make things work out of the box
npm run build:bots
# Run the example
npm run dev
z
oh ok. totally did not understand how this monorepo works. I guess i didn't understand that the root directory was basically a dependency for the examples to work. Just to step through what I went through to get this working: 1) I land on your main repo page on GH, clone it, and open the readme in my editor. there are no instructions to setup local dev. This means there are no instructions in my editor. I click the link to read the instructions in your docs, in a browser. I click to the second page of the docs. I run the steps. but now a question: do I need to run the rest of the steps? Will these local examples work if I don't fully set up and run the postgres and redis locally? Lets just assume I don't. 2) Now in my editor I see the examples repo and I move in there and I see a new set of instructions. unfortunately I pick a legitimately broken one and I give up. Then a few days later I decide to try again and I accidentally end up on the solo repo version. It also doesn't work. Now I think it's a package thing and start removing the medplum repo and recloning it to get a clean start. Then I'm convinced that I should follow the instructions inside the example sudirectory. so I try and run npm i from there. but that doesn't work. So eventually I see the monorepo pattern and I start install from root directory but now I'm forgetting to build--because it totally doesn't occur to me that the scripts in examples' package.jsons aren't doing that for me. And I've long forgotten about that one command on that one page of docs. AND I don't understand that the monorepo is like a dependency for the examples. so I thrash about more and eventually give up. - I guess I'm just too js-dumb to grok this, but I feel like: for me to have divined that working sequence of commands that you just shared, I would either have needed to see all the build patterns myself perfectly (and the mirroring pattern), or take several commands from the second page of installation docs on the web and then chain those to two of the three commands (not that first command!) from a super nested readme inside the repo. i got beat up a bit but im glad im unblocked 😎
165 Views