nix-community / yarn2nix

Generate nix expressions from a yarn.lock file [maintainer=???]
GNU General Public License v3.0
123 stars 61 forks source link

Generated node_modules incompatible with integrity check #107

Open rprije opened 5 years ago

rprije commented 5 years ago

I have a rails app I'm using mkYarnPackage with. mkYarnPackage calls mkYarnModules. mkYarnModules uses workspaceJSON to create a package.json for a workspace to put everything under. This results in a node_modules with a .yarn.integrity file with an added dependency on my project (the project is copied into deps, and the generated project.yaml sets up a workspaces using everything under deps). That project.yaml is discarded during the installPhase so the generated node_modules' .yarn.integrity is for a project.yaml with an added dependency to the project itself and that project.yaml no longer exists. Now when I try to link in the node_modules, yarn check --integrity fails with:

$ yarn check --integrity --ignore-scripts
yarn check v1.16.0
warning Integrity check: Top level patterns don't match
error Integrity check failed
error Found 1 errors.
info Visit https://yarnpkg.com/en/docs/cli/check for documentation about this command.

Comparing the generated .yarn.integrity file with one created by a direct yarn install confirms that the difference is the addition of the project i tself to topLevelPatterns.

It seems node_modules is generated in a way so as to be incompatible with integrity checks. Is there a way to use it in a way compatible with integrity checks?

As an aside, the use of --ignore-scripts also causes the flag to be added to .yarn.integrity and the integrity check to fail unless --ignore-scripts is also added to yarn check as above:

$ yarn check --integrity
yarn check v1.16.0
warning Integrity check: Flags don't match
error Integrity check failed
error Found 1 errors.
info Visit https://yarnpkg.com/en/docs/cli/check for documentation about this command.