Skip to content

Commit

Permalink
fix(core): use existing version when calling "yarn set version" (#18669)
Browse files Browse the repository at this point in the history
  • Loading branch information
meeroslav authored Aug 17, 2023
1 parent 43b802d commit 7d55f49
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
8 changes: 3 additions & 5 deletions packages/create-nx-workspace/src/utils/package-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,15 @@ export function getPackageManagerCommand(
exec: string;
preInstall?: string;
} {
const [pmMajor, pmMinor] =
getPackageManagerVersion(packageManager).split('.');
const pmVersion = getPackageManagerVersion(packageManager);
const [pmMajor, pmMinor] = pmVersion.split('.');

switch (packageManager) {
case 'yarn':
const useBerry = +pmMajor >= 2;
const installCommand = 'yarn install --silent';
return {
preInstall: useBerry
? 'yarn set version stable'
: 'yarn set version classic',
preInstall: `yarn set version ${pmVersion}`,
install: useBerry
? installCommand
: `${installCommand} --ignore-scripts`,
Expand Down
4 changes: 1 addition & 3 deletions packages/nx/src/utils/package-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ export function getPackageManagerCommand(
const useBerry = gte(yarnVersion, '2.0.0');

return {
preInstall: useBerry
? 'yarn set version stable'
: 'yarn set version classic',
preInstall: `yarn set version ${yarnVersion}`,
install: 'yarn',
ciInstall: useBerry
? 'yarn install --immutable'
Expand Down

1 comment on commit 7d55f49

@vercel
Copy link

@vercel vercel bot commented on 7d55f49 Aug 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx.dev
nx-five.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx-dev-nrwl.vercel.app

Please sign in to comment.