-
Notifications
You must be signed in to change notification settings - Fork 48
chore: use npm workspaces to manage locking dependencies #3275
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
chore: use npm workspaces to manage locking dependencies #3275
Conversation
https://docs.npmjs.com/cli/v7/using-npm/workspaces locking for all packages within the project is now handled by the root lockfile
|
used |
| - name: Run tests | ||
| working-directory: oeq-ts-rest-api | ||
| run: | | ||
| npm cit | ||
| npm t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be changed to
- name: Run tests
run: |
npm t --workspace=oeq-ts-rest-api
if preferred
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer leave as it is.
|
If this is a direction the team wants to go, code build may need to be updated to run install once at the top level. |
PenghaiZhang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ChristianMurphy !!! I like this idea.
|
Have some errors complaining |
I think this is RunType related: https://github.com/openequella/openEQUELLA/pull/3275/checks?check_run_id=3305552177#step:10:72 🤔 |
|
The error in the storybook build https://github.com/openequella/openEQUELLA/pull/3275/checks?check_run_id=3305552249#step:6:72 Line 20 in 0ca9e2b
is still running even though the root install is not run, will have to see if there's a way to skip the script |
|
Thanks for taking this for a spin @ChristianMurphy 🙇 Long term we still hope to break out the REST Module (oeq-ts-rest-api) and possibly even the Front End (react-front-end) and so I'm trying to understand if this kind of move will make that harder. Thoughts? Also, some of these are completely independent - such as Lastly, although maybe just a personal perception, doesn't it seems odd to manage this with workspaces and in a monorepo kind of way when first and foremost it's really a Java/Scala project being built via SBT. Could this confuse things? (That said, due to our root I wonder if we're at the point where we do need to push out at least the REST Module. It seems that'd significantly solve the issues we're having. 🤔 (And as for runtypes, gah! I wonder why that is now raising it's head - something else must be slightly odd with the setup....) |
I think not. It mainly impacts package-lock.json, the packages and scripts themselves are mostly unchanged.
That is a really good question, which I don't have a good answer for.
Maybe? Wanting them managed by a single build tool is a perfectly fine goal. uPortal is a similarly eclectic project, which also went for unifying under one build tool. Maybe SBT has similar integrations, that could be pulled in? or similar integrations could be built out for oEQ? |
|
Heya @ChristianMurphy Thank you for your considered response as always. I think at the end of the day we need to do something here as we're starting to have all manner of things going pear shaped in CI land since upgrading Node/NPM. Yesterday we had a number of odd NPM related build failures on GHA for renovate updates. I like your assessment that in theory moving to workspaces shouldn't make it any harder to split later, so for now maybe it is the easiest path forward. (And hey, it'll also kind of provide us a catalogue of all the nested JS projects.) And yes, I still dream and hope for the day when time permits a migration to gradle. Although we do have some custom tasks for SBT to do some of our JS building, it's so slow and heavy that we obviously still run a lot of things independently rather than having any smooth unification of build tooling. (And you definitely wouldn't do any commit hooks reliant on SBT launching first.) One day.... I see we've caused a number of conflicts here - due to |
other sub-projects also need to be installed
| "react-router-hash-link": "2.4.3", | ||
| "react-visibility-sensor": "3.14.0", | ||
| "runtypes": "6.3.1", | ||
| "runtypes": "6.3.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
runtypes issues appear to have come from a duplicated version.
oeq-ts-rest-api uses a version range
openEQUELLA/oeq-ts-rest-api/package.json
Line 35 in ecf6494
| "runtypes": "^6.0.0", |
this doesn't.
When those get out of sync RunTypes errors start popping up.
Long term, the version range (or lack of version range) should be synced.
Short term, I'm locking them to the same version.
|
|
||
| Compile / resourceGenerators += Def.task { | ||
| val baseSwagger = baseDirectory.value / "swaggerui" | ||
| Common.nodeInstall(baseSwagger) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alternatively this could cd to the top level and run the install again there.
| - (npm ci) | ||
| - (cd Source/Plugins/Kaltura/com.tle.web.wizard.controls.kaltura/js && npm run build) | ||
| - (npm run check:ts && npm run check:ts-types-source && npm run check:license) | ||
| - (cd react-front-end && npm test) | ||
| - (cd Source/Plugins/Core/com.equella.core/test/javascript && npm cit) | ||
| - (cd Source/Plugins/Core/com.equella.core/test/javascript && npm test) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is my best guess at the changes, I can't see the CodeBuild logs to confirm
add todo for running install once at top level
| // TODO: call once at top level to install all dependencies | ||
| // Common.nodeInstall(dir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
long term, calling this once at the top level of SBT or Gradle could give the more unified feel.
npm would still be there, but be managed by the Java/Scala build tool.
Checklist
Description of change
https://docs.npmjs.com/cli/v7/using-npm/workspaces
locking for all packages within the project is now handled by the root
lockfile
resolves #3262 and #3265