From dfad310c1e95f64dc7a88e4d3b2d522288b0f9b1 Mon Sep 17 00:00:00 2001 From: Kelly Selden Date: Sat, 8 Jul 2017 09:19:21 -0700 Subject: [PATCH] add --ignore-engines to yarn default options --- lib/dependency-manager-adapters/npm.js | 11 +++++++++-- test/dependency-manager-adapters/npm-adapter-test.js | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/dependency-manager-adapters/npm.js b/lib/dependency-manager-adapters/npm.js index 75d31a16..39c261d9 100644 --- a/lib/dependency-manager-adapters/npm.js +++ b/lib/dependency-manager-adapters/npm.js @@ -98,8 +98,15 @@ module.exports = CoreObject.extend({ debug('Run npm install with options %s', mgrOptions); var cmd = this.useYarnCommand ? 'yarn' : 'npm'; - if (this.useYarnCommand && mgrOptions.indexOf('--no-lockfile') === -1) { - mgrOptions = mgrOptions.concat(['--no-lockfile']); + if (this.useYarnCommand) { + if (mgrOptions.indexOf('--no-lockfile') === -1) { + mgrOptions = mgrOptions.concat(['--no-lockfile']); + } + // npm warns on incompatible engines + // yarn errors, not a good experience + if (mgrOptions.indexOf('--ignore-engines') === -1) { + mgrOptions = mgrOptions.concat(['--ignore-engines']); + } } return this.run(cmd, [].concat(['install'], mgrOptions), { cwd: this.cwd }).then(function() { diff --git a/test/dependency-manager-adapters/npm-adapter-test.js b/test/dependency-manager-adapters/npm-adapter-test.js index 24209c09..887299c8 100644 --- a/test/dependency-manager-adapters/npm-adapter-test.js +++ b/test/dependency-manager-adapters/npm-adapter-test.js @@ -118,7 +118,7 @@ describe('npmAdapter', function() { writeJSONFile('package.json', fixturePackage); var runCount = 0; var stubbedRun = generateMockRun([{ - command: 'yarn install --no-lockfile', + command: 'yarn install --no-lockfile --ignore-engines', callback: function(command, args, opts) { runCount++; expect(opts).to.have.property('cwd', tmpdir); @@ -139,7 +139,7 @@ describe('npmAdapter', function() { writeJSONFile('package.json', fixturePackage); var runCount = 0; var stubbedRun = generateMockRun([{ - command: 'yarn install --flat --no-lockfile', + command: 'yarn install --flat --no-lockfile --ignore-engines', callback: function() { runCount++; return RSVP.resolve();