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
Hooks provided in opts are lost in processing by install command #5306
Comments
Pnpm deploy command is providing readPackage in opts and it is being discarded by requireHooks. This change ensures, that hooks provided in opts are merged with those from local and global pnpmfiles. Closes pnpm#5306
Pnpm deploy command is providing readPackage in opts and it is being discarded by requireHooks. This change ensures, that hooks provided in opts are merged with those from local and global pnpmfiles. Closes pnpm#5306
Pnpm deploy command is providing readPackage in opts and it is being discarded by requireHooks. This change ensures, that hooks provided in opts are merged with those from local and global pnpmfiles. Closes pnpm#5306
Actually after working on PR I found out that the hooks provided in opts are not only ignored if there ar no local/ global hooks - they are always ignored. My PR addresses this issue and I would be grateful for some feedback - as I confirmed that changed version resolves my issue with workspace package not being "injected" when using |
I think we should do some refactoring. Probably pnpm/packages/core/src/install/index.ts Lines 614 to 621 in f3fc6b5
|
I will look into this - if I understand You correctly you suggest that
|
Sounds correct. |
What I found out the issue happens only with option |
The line
coupled with
Causes hooks from opts to be discarded in favor of pnpmfile generated hooks before they can reach createReadPackageHook. |
@zkochan one question - I found out that pnpm/packages/config/src/index.ts Line 525 in f3fc6b5
And it is very hard for me to trace places where change in type (to array) could have ripple effects - so I'm worried about changing type of readPackage hook to array in between requireHooks and createReadPackageHook because I'm not sure the flow will always lead to the later.
|
You will get typing errors, just run |
Prevent hook provided in opts from being discarded Closes pnpm#5306
Prevent hook provided in opts from being discarded Closes pnpm#5306
Prevent hook provided in opts from being discarded Closes pnpm#5306
Close #5306 Co-authored-by: Zoltan Kochan <z@kochan.io>
I was trying to get
pnpm deploy
(beta) feature to work and correctly "inject" my workspace modules and I noticed that they are not injected due toreadPackage
hook not being applied.Here
pnpm/packages/pnpmfile/src/requireHooks.ts
Line 55 in b6f788c
empty object is returned if neither globalHooks nor hooks are set.
Simple change to
Would prevent hooks set in opts from being lost.
f the change would be acceptable I will provide PR with tests.
pnpm version:
7.9.5
Code to reproduce the issue:
I can provide it if the description is not enough.
Expected behavior:
When hooks are provided in opts they are returned from
requireHooks
functionActual behavior:
Hooks provided in opts are lost.
Additional information:
node -v
prints: v14.20.0The text was updated successfully, but these errors were encountered: