codeql-action
codeql-action copied to clipboard
Revisit the use of removeNPMAbsolutePaths
It appears that
npm cicreates a huge diff. None of the package.json files in node_modules have a final newline. Is this something that should be done separate from this PR?
Originally posted by @RA80533 in https://github.com/github/codeql-action/issues/487#issuecomment-838000019
- The current package-lock.json file was generated as a v2 lock file by npm 7.x. Major releases of npm prior to 7.x inserted an extra property in package.json files residing in the node_modules folder for which removeNPMAbsolutePaths was used. ~~In other words, removeNPMAbsolutePaths no longer has anything to clean up.~~ EDIT: This might not be true for the CI. This specific detail needs to be investigated.
- removeNPMAbsolutePaths has the unfortunate side effect of stripping the final newline from any file it touches. npm attempts to insert a final newline if it finds that it's missing. The two work against each other to a disastrous effect. VS Code's version control integration has to be reloaded if either of them tries to undo the other because of the enormous amount of changes they make.
This is something to explore. Even though I see minimal benefit for existing developers, I do see how this could help facilitate new contributors.