Skip to content
Prev Previous commit
Next Next commit
Uses yarnPath by default if Corepack isnt enabled
  • Loading branch information
arcanis committed Mar 25, 2022
commit 7c61c58b91b98e5c97766677a47243fb002afd1c
10 changes: 8 additions & 2 deletions packages/plugin-essentials/sources/commands/set/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default class SetVersionCommand extends BaseCommand {
]],
});

useYarnPath = Option.Boolean(`--yarn-path`, false, {
useYarnPath = Option.Boolean(`--yarn-path`, {
description: `Set the yarnPath setting even if the version can be accessed by Corepack`,
});

Expand Down Expand Up @@ -175,7 +175,13 @@ export async function setVersion(configuration: Configuration, bundleVersion: st
const isTaggedYarnVersion = miscUtils.isTaggedYarnVersion(bundleVersion);

const yarnPath = configuration.get(`yarnPath`);
const updateFile = yarnPath || !isTaggedYarnVersion || useYarnPath;
let updateFile = yarnPath || !isTaggedYarnVersion || yarnPath;

if (typeof yarnPath === `undefined`) {
report.reportWarning(MessageName.UNNAMED, `You don't seem to have ${formatUtils.applyHyperlink(configuration, `Corepack`, `https://nodejs.org/api/corepack.html`)} enabled; we'll have to rely on ${formatUtils.applyHyperlink(configuration, `yarnPath`, `https://yarnpkg.com/configuration/yarnrc#yarnPath`)} instead`);
updateFile = true;
}


if (updateFile) {
const bundleBuffer = await fetchBuffer();
Expand Down