Add PR check to remove npm absolute paths #29
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR aims to reduce the chance of us accidentally checking in a bad node_modules directory.
We add another PR check (and renames the workflow file as having four things in the name is a bit unwieldy) that runs
npm ciand alsoremoveNPMAbsolutePaths. Hopefully this will catch places where we modify a npm dependency but fail to update thenode_modulesdirectory, and will catch absolute paths being checked in.The danger is that running npm commands isn't very stable and we could end up with false positives because of differing behaviour between different npm versions or on different operating systems. The actions environment seems consistent with my local environment so I'd propose that we go for it and if this causes problems then we revert it.
The reason why I used
npm ciinstead ofnpm installis that I believe it's intended to be more stable. However the behaviour has changed a few times since it's introduction so it's all very unclear. npm is just not very good if you want reproducible results.The reason I added the
--forceflag toremoveNPMAbsolutePathsis so that it rewrites all files to a canonical form. I was seeing some differences in ordering of properties of json objects when there were otherwise no changes. I hope by lettingremoveNPMAbsolutePathsdecide this aspect we'll avoid any inconsistencies.