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

[Feature] Flag to disable builtin package patches #4517

Closed
2 tasks done
Silic0nS0ldier opened this issue Jun 3, 2022 · 2 comments
Closed
2 tasks done

[Feature] Flag to disable builtin package patches #4517

Silic0nS0ldier opened this issue Jun 3, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@Silic0nS0ldier
Copy link

  • I'd be willing to implement this feature (contributing guide)
  • This feature is important to have in this repository; a contrib plugin wouldn't do

Describe the user story

As a developer, I often need to maintain temporary dependency forks, but I am prevented by default patches applied to some packages.

Describe the solution you'd like

A clear and concise description of what you want to happen. Consider that Yarn is used
by many people, and your particular use case might not make sense to implement in the core.

A flag introduced that disables the package patches automatically applied by Yarn. The focus is on patches provided by the builtin @yarnpkg/plugin-compat plugin.

The motivation here is to unblock the migration to Yarn Berry from Yarn Classic at Canva. The patches are problematic as they introduce another constraint for dependency updates and when incompatible they manifest as obscure errors such as the following (likely a bug in error reporting).

➤ YN0001: │ Error: fsevents@patch:fsevents@file%3A../tools/npm-throw%[truncated]:
  ENOENT: no such file or directory, lstat '/node_modules/fsevents/fsevents.js'

For context, the goal is a drop-in replacement for Yarn Classic. Investigations with 3.2.1 have gotten very close, package patches and some node-gyp issues that I'm still looking into appear to be the only holdups.

Describe the drawbacks of your solution

Misuse of the flag could result in PnP users raising reports for apparent bugs that are just misconfigurations, though its more likely these will appear at specific package repos first. I can't see this becoming common issue.

Worth being aware of the flag state in some bug reports, as in some cases it will represent a content difference.

Stability of the feature will depend on how the patches plugin is integrated. Since I've yet to take a look, I can't yet comment.

Describe alternatives you've considered

An attempt was made to disable the patches builtin plugin, however builtin plugins cannot be disabled via the CLI.

There are plans forming around how dependencies are managed and integrated with Bazel (our build system). Upgrading to Yarn Berry is being considered as a short-term improvement to developer experience while longer term efforts are underway. Forking is an option if this feature (or an analogue) isn't desired by maintainers.

@Silic0nS0ldier Silic0nS0ldier added the enhancement New feature or request label Jun 3, 2022
@Silic0nS0ldier Silic0nS0ldier changed the title [Feature] Flag to disable package patches [Feature] Flag to disable builtin package patches Jun 3, 2022
@cspotcode
Copy link

cspotcode commented Jul 17, 2022

This is blocking a switch to yarn from npm for me as well.

My use-case:

I consume the typescript package as a peer dependency and need to support a range of versions. I use @internal APIs. I stay on npm to get simplicity and predictability when doing this testing and development. Yarn's patching has broken things for me in the past, so I don't want to risk the wasted time and the additional variables when I need to diagnose an error.

I understand there are hacks to avoid patches, but if I recall correctly, they require very specific, verbose version specifiers. Right now my tests run npm install typescript@version-to-test-against to mimic what an end-user is likely to do. I don't want to complicate that with yarn-specific details.

I understand that the patches are necessary to support PnP, and I will deliberately use the node-modules linker to avoid the need for patches.


Is it possible to block plugin-compat with my own yarn plugin?

@arcanis
Copy link
Member

arcanis commented Jul 17, 2022

Duplicate of #3275

Yarn's patching has broken things for me in the past, so I don't want to risk the wasted time and the additional variables when I need to diagnose an error.

We would rather fix the problems that occur with the patches than allow disabling them. This is important if we want the upstream changes to ever be merged. At the moment, I'm not aware of issues, so please open some if you find any.

@arcanis arcanis closed this as completed Jul 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants