Skip to content

Commit

Permalink
Drop support for npm v4
Browse files Browse the repository at this point in the history
  • Loading branch information
bertdeblock committed Sep 5, 2023
1 parent 017e7fb commit d0e1e17
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 73 deletions.
11 changes: 0 additions & 11 deletions lib/dependency-manager-adapters/npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,6 @@ module.exports = CoreObject.extend({
debug('Run npm/yarn install with options %s', mgrOptions);

await this.run(cmd, [].concat(['install'], mgrOptions), { cwd: this.cwd });

if (!this.useYarnCommand) {
let res = await this.run('npm', ['--version'], { cwd: this.cwd, stdio: 'pipe' });
let version = res.stdout;
if (version.match(/^4./)) {
debug('Running npm prune because version is %s', version);
return await this.run(this.configKey, ['prune'], { cwd: this.cwd });
}

debug('Not running npm prune because version is %s', version);
}
},

applyDependencySet(depSet) {
Expand Down
62 changes: 0 additions & 62 deletions test/dependency-manager-adapters/npm-adapter-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,6 @@ describe('npmAdapter', () => {
return RSVP.resolve();
},
},
{
command: 'npm --version',
callback() {
runCount++;
return RSVP.resolve({ stdout: '5.7.1' });
},
},
],
{ allowPassthrough: false }
);
Expand All @@ -100,47 +93,6 @@ describe('npmAdapter', () => {
expect(runCount).to.equal(2);
});

it('runs npm prune and npm install with npm 4', async () => {
writeJSONFile('package.json', fixturePackage);
let runCount = 0;
let stubbedRun = generateMockRun(
[
{
command: 'npm install --no-shrinkwrap',
callback(command, args, opts) {
runCount++;
expect(opts).to.have.property('cwd', tmpdir);
return RSVP.resolve();
},
},
{
command: 'npm prune',
callback(command, args, opts) {
runCount++;
expect(opts).to.have.property('cwd', tmpdir);
return RSVP.resolve();
},
},
{
command: 'npm --version',
callback() {
runCount++;
return RSVP.resolve({ stdout: '4.7.1' });
},
},
],
{ allowPassthrough: false }
);

let adapter = new NpmAdapter({
cwd: tmpdir,
run: stubbedRun,
});

await adapter._install();
expect(runCount).to.equal(3, 'All three commands should run');
});

it('uses managerOptions for npm commands', async () => {
writeJSONFile('package.json', fixturePackage);
let runCount = 0;
Expand All @@ -153,13 +105,6 @@ describe('npmAdapter', () => {
return RSVP.resolve();
},
},
{
command: 'npm --version',
callback() {
runCount++;
return RSVP.resolve({ stdout: '5.7.1' });
},
},
],
{ allowPassthrough: false }
);
Expand All @@ -186,13 +131,6 @@ describe('npmAdapter', () => {
return RSVP.resolve();
},
},
{
command: 'npm --version',
callback() {
runCount++;
return RSVP.resolve({ stdout: '5.7.1' });
},
},
],
{ allowPassthrough: false }
);
Expand Down

0 comments on commit d0e1e17

Please sign in to comment.