NPM metadata endpoint: add `scripts` / `hasInstallScript` fields
From #330929 (comment 745658476), @christiand.aspedia wrote:
From your testing in #330929 (comment 718139184), it looks like you were using node 14? Which actually worked just fine with both binaries, as well as install scripts as it didn't rely on metadata from the registry unlike node16+.
In testing with node16, there are a few things to note:
- npm install needs to be run with the
--foreground-scripts
flag, as by default npm 7 does not show any output from dependencies when they are installed.- Make sure to clear the package-lock.json before each test, as this actually ends up with a cached flag
hasInstallScript
, when a package has been detected to have an install script (I'm using this as workaround for now by manually patching package-lock.json, not ideal).- I can see from
curl -H Accept:application/vnd.npm.install-v1+json https://registry.npmjs.org/cypress | jq
, that this returns a flag"hasInstallScript": true
. Setting this seems to be enough to have everything just work and seems to be equivalent to setting thescripts
property.I'm aware this issue has now been closed, but I'm not familiar enough with gitlabs policy on how to handle cases like this and am happy to file a new issue if that is what is required.
This is causing postinstall scripts to not be called
Edited by Kate Grechishkina