-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
fix Yarn 1 erroring on parent npmrc files with undefined vars #6883
Conversation
Npm handles this a bit differently - instead of removing any variables, it only includes in the lines it needs into an .npmrc dependabot-core/npm_and_yarn/lib/dependabot/npm_and_yarn/file_updater/npmrc_builder.rb Lines 25 to 36 in 9404097
and then the content is written out into a temporary directory when performing updates dependabot-core/npm_and_yarn/lib/dependabot/npm_and_yarn/file_updater/npm_lockfile_updater.rb Line 482 in 9404097
And it looks like Yarn v1 does the same thing dependabot-core/npm_and_yarn/lib/dependabot/npm_and_yarn/file_updater/yarn_lockfile_updater.rb Line 345 in 9404097
dependabot-core/npm_and_yarn/lib/dependabot/npm_and_yarn/file_updater/npmrc_builder.rb Lines 181 to 191 in 9404097
You may need to update the way we add these these lockfiles to the temporary directory so that all of the .npmrc files are added and not just the 1 |
@Nishnha Yarn is using |
I created a Yarn 1 smoke test which also tests this issue since it required a clone to have certain files on disk, and I wasn't sure how I'd achieve that in the rspec tests: dependabot/smoke-tests#45 |
If a repo has multiple .npmrc files, Dependabot only rewrites one of them to remove variables. NPM doesn't seem to have an issue with this, I assume it's just expanding undefined vars to
""
, but Yarn 1 is not ok with that and errors.To fix this, I've added some code to rewrite all of the .npmrc files and remove the variables.
Still trying to figure out if there's a way to test this in this project, I have a CLI test that is passing with this change.