berry icon indicating copy to clipboard operation
berry copied to clipboard

feat: added home check and --skip-home-check to set version

Open JoshuaKGoldberg opened this issue 3 years ago • 1 comments

What's the problem this PR addresses? Users should be blocked from accidentally running yarn set version from the home directory (~). This adds an error to that case unless a new --skip-home-check is specified.

Resolves #4426.

How did you fix it? Checks this.context.cwd against homedir() at the beginning of the execute() method.

I'm not confident I answered correctly on the version updates. 🤷

Testing: I couldn't find any unit tests for version.ts, and it seems risky to run acceptance tests in the user's home directory. Is there a testing strategy this PR should go with? Help please?

Checklist

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

Co-authored-by: @nikstern [email protected]

JoshuaKGoldberg avatar Jul 25 '22 20:07 JoshuaKGoldberg

until fixed (by perhaps 2023?)

Please learn how to interact professionally on open-source repositories. Being snarky makes me less likely to care about whatever problem you have and I don't have. Don't abuse our will to help.

The problem is also wider than this codebase; the global Yarn is supposed to be Yarn 1.x, so running yarn set version from the home folder will lead to code being evaluated by Yarn 1, ie a different codebase. This PR alone won't fix the root issue.

arcanis avatar Sep 16 '22 09:09 arcanis

I ran into the same issue with even the latest version (3.6.0), any updates on this? I'm using macOS Ventura

withinoneyear avatar Jun 13 '23 00:06 withinoneyear