Skip to content

Commit 6546159

Browse files
fix: correctly check Yarn version (#2412)
* fix: correctly check Yarn version * fix: apply reviewers comment * Update packages/cli/src/commands/init/init.ts Co-authored-by: Michał Pierzchała <thymikee@gmail.com> --------- Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
1 parent 7fc872d commit 6546159

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

  • packages/cli/src/commands/init

packages/cli/src/commands/init/init.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,10 @@ const bumpYarnVersion = async (silent: boolean, root: string) => {
9393

9494
if (yarnVersion) {
9595
// `yarn set` is unsupported until 1.22, however it's a alias (yarnpkg/yarn/pull/7862) calling `policies set-version`.
96-
const setVersionArgs =
97-
yarnVersion.major > 1 && yarnVersion.minor >= 22
98-
? ['set', 'version', YARN_VERSION]
99-
: ['policies', 'set-version', YARN_VERSION];
100-
96+
let setVersionArgs = ['set', 'version', YARN_VERSION];
97+
if (yarnVersion.major === 1 && yarnVersion.minor < 22) {
98+
setVersionArgs = ['policies', 'set-version', YARN_VERSION];
99+
}
101100
await executeCommand('yarn', setVersionArgs, {
102101
root,
103102
silent,

0 commit comments

Comments
 (0)