Skip to content

Commit

Permalink
Rename to isBerry
Browse files Browse the repository at this point in the history
  • Loading branch information
jagonzalr committed Oct 13, 2022
1 parent 8d76b02 commit 74658ca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions lib/packagers/yarn.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Yarn {
return false;
}

static isModernVersion(version) {
static isBerryVersion(version) {
const versionNumber = version.charAt(0);
const mainVersion = parseInt(versionNumber);
return mainVersion > 1;
Expand Down Expand Up @@ -139,16 +139,16 @@ class Yarn {
if (packagerOptions.noInstall) {
return BbPromise.resolve();
}
const isModern = Yarn.isModernVersion(version);
const isBerry = Yarn.isBerryVersion(version);

const command = /^win/.test(process.platform) ? 'yarn.cmd' : 'yarn';
const args = ['install'];
// Convert supported packagerOptions
if (!packagerOptions.noNonInteractive && !isModern) {
if (!packagerOptions.noNonInteractive && !isBerry) {
args.push('--non-interactive');
}
if (!packagerOptions.noFrozenLockfile) {
if (isModern) {
if (isBerry) {
args.push('--immutable');
} else {
args.push('--frozen-lockfile');
Expand Down
6 changes: 3 additions & 3 deletions tests/packagers/yarn.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ describe('yarn', () => {
expect(yarnModule.mustCopyModules).toBe(false);
});

describe('isModernVersion', () => {
describe('isBerryVersion', () => {
it('Yarn version 1.22.19', () => {
const yarnVersion = '1.22.19';
expect(yarnModule.isModernVersion(yarnVersion)).toBe(false);
expect(yarnModule.isBerryVersion(yarnVersion)).toBe(false);
});

it('Yarn version 3.2.3', () => {
const yarnVersion = '3.2.3';
expect(yarnModule.isModernVersion(yarnVersion)).toBe(true);
expect(yarnModule.isBerryVersion(yarnVersion)).toBe(true);
});
});

Expand Down

0 comments on commit 74658ca

Please sign in to comment.