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

feat: support configuring link mode across plugins #4990

Merged
merged 14 commits into from
Nov 1, 2022
Merged

feat: support configuring link mode across plugins #4990

merged 14 commits into from
Nov 1, 2022

Conversation

jeff-wishnie
Copy link
Contributor

@jeff-wishnie jeff-wishnie commented Oct 26, 2022

What's the problem this PR addresses?
When creating package and workspace links in node_modules folders the plugin-nm and plugin-pnpm node-linkers use symbolic-links on *nix platforms and Windows Junctions on Windows.

Because Junctions are always absolute paths, this creates potential inconsistencies in behavior across platforms--with realtive-path symlinks created on *nix and absolute-path Junctions on Windows.

This is particularly problematic when mounting local folders into Docker containers as volumes and abolsute-path links will be broken inside the container.

PR #4981 added a configuration setting to use symlinks on WIndows (which may be relative-path) in with nodeLinker: node-modules, supporting container-compatible consistent behavior across *nix and Windows.

This PR, per @merceyz 's request adds the same option for plugin-pnpm and refactors the setting into plugin-pnp

...

How did you fix it?

  • Generalized the setting nmFolderLinkMode by:

    • renaming setting to nodeLinkerFolderLinkMode
    • Moving the setting out of plugin-nm to plugin-pnp
      QUESTION Is this the correct place to place the setting? It is now used by both plugin-nm and plugin-pnpm so it should not be in one or the other of those plugins. I placed it in plugin-pnp because it is related (subservient) to nodeLinker, which is in plugin-pnp
  • Updated plugin-nm to use the renamed setting

  • Updated plugin-pnpm to respect the setting

The PR also generalizes a couple helpers out of the integration tests of the feature from plugin-nm so that they can also be used in integration tests of plugin-pnpm

...

Checklist

  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

@jeff-wishnie jeff-wishnie marked this pull request as draft October 26, 2022 03:45
Remove stay console.log
Changes to be committed:
	modified:   packages/acceptance-tests/pkg-tests-specs/sources/features/pnpm.test.ts
	modified:   packages/plugin-nm/sources/NodeModulesLinker.ts
	modified:   packages/plugin-pnp/sources/index.ts
@jeff-wishnie jeff-wishnie marked this pull request as ready for review October 26, 2022 04:58
@jeff-wishnie
Copy link
Contributor Author

@merceyz @larixer

@merceyz merceyz changed the title Feat(folder link mode)/support configuring link mode accross plugins feat: support configuring link mode across plugins Oct 26, 2022
@jeff-wishnie
Copy link
Contributor Author

@RDIL @larixer @merceyz how do I request reviewers? Looks like I don't have perms to do so directly. Thanks!

@RDIL RDIL requested a review from larixer October 26, 2022 23:26
@RDIL
Copy link
Member

RDIL commented Oct 26, 2022

We'll try to review when we get the chance, no need to rush.

@jeff-wishnie
Copy link
Contributor Author

We'll try to review when we get the chance, no need to rush.

Understood. More asking about the process!

@larixer larixer removed their request for review October 28, 2022 18:59
@larixer
Copy link
Member

larixer commented Oct 31, 2022

The PR looks good to me, I'm not sure about nodeLinkerFolderLinkMode name though, @arcanis how do you feel about the setting name, maybe you should review this PR too?

@jeff-wishnie jeff-wishnie requested review from larixer and arcanis and removed request for larixer October 31, 2022 19:26
larixer
larixer previously approved these changes Nov 1, 2022
@arcanis arcanis merged commit 18e1b9c into yarnpkg:master Nov 1, 2022
@arcanis
Copy link
Member

arcanis commented Nov 1, 2022

Thanks!

@jeff-wishnie jeff-wishnie deleted the feat(folderLinkMode)/support-configuring-link-mode-accross-plugins branch November 1, 2022 16:40
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.

4 participants