Skip to content

build/npm/preinstall.js doesn't enforce required yarn version properly #162609

Description

@mrienstra

Does this issue occur when all extensions are disabled?: n/a

  • VS Code Version: main (currently at 2a07191)
  • OS Version: n/a

Steps to Reproduce:

  1. Take the existing code in build/npm/preinstall.js (L24-L31) and turn it into a function that accepts a yarnVersion parameter:
function checkYarn (yarnVersion) {
	const parsedYarnVersion = /^(\d+)\.(\d+)\./.exec(yarnVersion);
	const majorYarnVersion = parseInt(parsedYarnVersion[1]);
	const minorYarnVersion = parseInt(parsedYarnVersion[2]);

	if (majorYarnVersion < 1 || minorYarnVersion < 10) {
		console.error('\033[1;31m*** Please use yarn >=1.10.1.\033[0;0m');
		err = true;
	}
}
  1. Test that function in node.js, e.g. using node -i.
  2. These should error, but don't:
  • checkYarn('1.10.0')
  • checkYarn('3.2.3')

According to the error on line 29, requires >=1.10.1, but is only enforcing >= 1 or >= x.10. Granted, there is no yarn v3.10 yet, but there may be someday. And if it actually requires >=1.10.1 (and not just >=1.10.0) as the error states, it should enforce that as well.

Metadata

Metadata

Assignees

Labels

engineeringVS Code - Build / issue tracking / etc.insiders-releasedPatch has been released in VS Code Insiders

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions