-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
refactor!: update hooks to accept objects #4524
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
base: master
Are you sure you want to change the base?
Conversation
packages/plugin-npm/sources/index.ts
Outdated
getNpmAuthenticationHeader?: ({ currentHeader, registry, configuration, ident }: { | ||
currentHeader?: string, | ||
registry: string, | ||
configuration: Configuration, | ||
ident?: Ident, | ||
}) => Promise<string | undefined>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the 3rd parameter was already an object, I just merged the first two parameters into it rather than nesting them further.
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}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed opt
to options
so that the interface is clearer for anyone using the hook.
8462bb2
to
a0f5b80
Compare
I believe there is one remaining issue, and that is with |
c9d3e4c
to
799130b
Compare
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