refactor!: update hooks to accept objects#4524
Draft
jdanil wants to merge 5 commits intoyarnpkg:masterfrom
Draft
refactor!: update hooks to accept objects#4524jdanil wants to merge 5 commits intoyarnpkg:masterfrom
jdanil wants to merge 5 commits intoyarnpkg:masterfrom
Conversation
jdanil
commented
Jun 5, 2022
packages/plugin-npm/sources/index.ts
Outdated
Comment on lines
+22
to
+27
| getNpmAuthenticationHeader?: ({ currentHeader, registry, configuration, ident }: { | ||
| currentHeader?: string, | ||
| registry: string, | ||
| configuration: Configuration, | ||
| ident?: Ident, | ||
| }) => Promise<string | undefined>; |
Contributor
Author
There was a problem hiding this comment.
As the 3rd parameter was already an object, I just merged the first two parameters into it rather than nesting them further.
jdanil
commented
Jun 5, 2022
Comment on lines
+46
to
50
| async downloadHosted(locator: Locator, options: FetchOptions) { | ||
| return options.project.configuration.reduceHook((hooks: Hooks) => { | ||
| return hooks.fetchHostedRepository; | ||
| }, null as FetchResult | null, locator, opts); | ||
| }, {current: null as FetchResult | null, locator, options}); | ||
| } |
Contributor
Author
There was a problem hiding this comment.
Renamed opt to options so that the interface is clearer for anyone using the hook.
8462bb2 to
a0f5b80
Compare
Contributor
Author
|
I believe there is one remaining issue, and that is with |
c9d3e4c to
799130b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What's the problem this PR addresses?
Addresses one of the checklist items listed for Yarn 4 in #3591.
How did you fix it?
Updated all hooks and their interfaces to replace positional parameters with an object.
Updated all the hooks in 1815afd.
Removed unused attributes in 56703af.
Checklist