Skip to content

Re-work monorepo structure#209

Draft
H12 wants to merge 1 commit intodevelopfrom
node-versioning
Draft

Re-work monorepo structure#209
H12 wants to merge 1 commit intodevelopfrom
node-versioning

Conversation

@H12
Copy link
Collaborator

@H12 H12 commented Mar 11, 2021

Goals

  • Simplify and clarify dev setup process
  • Improve support for non-MacOS platforms
  • Enforce specific node/npm versioning
  • Reduce tooling complexity by migrating from lerna to native npm tooling

Describe the problem being solved:

Our monorepo structure has proven confusing to apprentices. Needing to learn different sets of commands for lerna and npm is a bit much, and it's led to some weirdness (dependencies being installed in the root, being one example).

We also have some issues enforcing specific node/npm versions. There was a new version of npm published (version 7) which introduces a number of breaking changes. Some apprentices upgraded to npm@7 while others are still using npm@6. These discrepancies have caused issues with package-lock.json files being added which break our CI testing because we use npm@6 there.

Impacted areas in the application:

This primarily impacts developer tooling and CI/CD. There should be no functional changes to the app itself.

Solution

I'm hoping to address the problems outlined above by leveraging the native workspaces functionality offered in npm@7, as well as updating our package.json file(s) to enforce specific versions of node (the latest lts version) and npm (version 7).

I'll also be updating the README to include platform-agnostic installation instructions for node. I hope that by locking down to a specific version of node, we can avoid forcing apprentices to deal with the complexity of installing a version manager or other package management tools on their current platform, and just direct them to downloading the appropriate LTS Node Executable from nodejs.org.

Concerns

I have two notable concerns with taking this approach:

  1. Interrupting existing apprentice workflows
  2. Somehow breaking CI/CD

That first concern is a biggie, but I hope that any up-front productivity cost will be offset by simplifying and clarifying our developer tooling/setup.

The second one may or may not be significant. I'm just calling it out because I wasn't involved in any part of the CI/CD setup

@H12 H12 requested a review from dkaplan88 March 11, 2021 15:39
@H12
Copy link
Collaborator Author

H12 commented Mar 11, 2021

Quick explanation of this first (very WIP) commit:

I removed lerna in favor of a package.json outlined in the example here. In the root package.json, I established a client and server workspace, which enables multi-workspace dependency management. Lastly, I moved the packages/app and packages/api directors into the client and server directories, respectively, and (after deleting existing node_modules and package-lock.json files, ran npm install from the root of the project.

Copy link
Collaborator

@vhoof vhoof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like where this is going, even if I'm two months late to the party. The Heroku stuff might need some massaging in the process, could help out with that if you're still wanting to do this.

@H12 H12 removed the request for review from dkaplan88 May 17, 2021 23:08
@H12
Copy link
Collaborator Author

H12 commented May 17, 2021

@vhoof I would very much appreciate some help on the CI/CD/Heroku side of this (if it gets to that point).

While this is a project structure that I definitely think makes sense going-forward, I'm not totally sold that it makes sense to rework the existing project to fit this structure. It ultimately depends on how much thrash it would wind up causing, which I hope to have a clearer picture of after experimenting a bit and getting this PR up-to-date with the latest develop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants