Skip to content
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: honor never/only-built-dependencies in workspace setup #7141

Conversation

alvis
Copy link
Contributor

@alvis alvis commented Sep 27, 2023

Fix #7135 #5407

In the current implementation there are 2 bugs that prevent pnpm.neverBuiltDependencies and pnpm.onlyBuiltDependencies to work under a workspace that doesn't share a single lockfile

  1. The argument passed to some getOptionsFromRootManifest calls are wrong. They were incorrectly passed the project manifest instead of the intended root project manifest.
  2. Both neverBuiltDependencies and onlyBuiltDependencies settings are not implemented in the recursive logic.

This PR provides a fix to the bugs above.

@welcome
Copy link

welcome bot commented Sep 27, 2023

💖 Thanks for opening this pull request! 💖
Please be patient and we will get back to you as soon as we can.

@zkochan
Copy link
Member

zkochan commented Sep 27, 2023

Thanks, I'll review it later.

@alvis
Copy link
Contributor Author

alvis commented Sep 27, 2023

@zkochan any idea about the patching errors in the CI tests? Not sure where do they come from

@zkochan
Copy link
Member

zkochan commented Sep 27, 2023

That is a new error for sure. I haven't seen it in the past.

@alvis alvis force-pushed the fix/honor-never-only-built-dependencies-in-workspace-setup branch from b3363b8 to ace3bab Compare September 27, 2023 22:09
@alvis
Copy link
Contributor Author

alvis commented Sep 27, 2023

@zkochan Seems like the error is caused by the recent 8.8.0 release while the code was based on 8.7.6. I've rebased the branch and please approve the CI test again

Update:
There is another separate issue related to the 8.8.0 release that causes the ERR_PNPM_SOME_CODE  some error error in the test (which also happen in other recent commits) but it is red herring because it won't fail the test (which is another separate issue)

The reason of the test failure is due to the change in the argument supplied to getOptionsFromRootManifest as explained below

@@ -363,7 +364,7 @@ export async function recursive (
{
...installOpts,
...localConfig,
...getOptionsFromRootManifest(manifest),
...getOptionsFromRootManifest(opts.rootProjectManifest ?? manifest),
Copy link
Contributor Author

@alvis alvis Sep 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zkochan so the patching error is due to the earlier proposed change (opts.rootProjectManifest ?? {} instead of opts.rootProjectManifest ?? manifest in the latest update).

In the latest update, I uses the project manifest as a fallback instead of an empty object.
Now the tests will pass as you can see those in mine:
https://github.com/alvis/pnpm/actions/runs/6338054374

The change is harmless but I guess there is a bug in the test because the earlier proposed logic is identical to the usage in other places in the codebase, and it makes more sense than using the project manifest e.g.

...getOptionsFromRootManifest(config.rootProjectManifest ?? {}),

...getOptionsFromRootManifest(opts.rootProjectManifest ?? {}),

Regardless, I'm looking forward to your review and get it merged.

@alvis alvis force-pushed the fix/honor-never-only-built-dependencies-in-workspace-setup branch from a5b214b to a78b202 Compare September 29, 2023 19:58
zkochan added a commit to pnpm/components that referenced this pull request Sep 30, 2023
@zkochan zkochan merged commit 12f45a8 into pnpm:main Oct 3, 2023
8 checks passed
@welcome
Copy link

welcome bot commented Oct 3, 2023

Congrats on merging your first pull request! 🎉🎉🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

neverBuiltDependencies isn't honored in workspace projects when shared-workspace-lockfile=false
2 participants