mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 15:06:27 +00:00
parent
d1bfeaa877
commit
7fcbb47b3a
3 changed files with 22 additions and 5 deletions
|
@ -161,11 +161,15 @@ async function getDependency(name, retries = 5) {
|
||||||
'renovate-config': latestVersion['renovate-config'],
|
'renovate-config': latestVersion['renovate-config'],
|
||||||
};
|
};
|
||||||
Object.keys(dep.versions).forEach(version => {
|
Object.keys(dep.versions).forEach(version => {
|
||||||
// We don't use any of the version payload currently
|
if (dep.versions[version].deprecated) {
|
||||||
dep.versions[version] = {
|
delete dep.versions[version];
|
||||||
// fall back to arbitrary time for old npm servers
|
} else {
|
||||||
time: res.time ? res.time[version] : '2017-01-01T12:00:00.000Z',
|
// We don't use any of the version payload currently
|
||||||
};
|
dep.versions[version] = {
|
||||||
|
// fall back to arbitrary time for old npm servers
|
||||||
|
time: res.time ? res.time[version] : '2017-01-01T12:00:00.000Z',
|
||||||
|
};
|
||||||
|
}
|
||||||
});
|
});
|
||||||
logger.trace({ dep }, 'dep');
|
logger.trace({ dep }, 'dep');
|
||||||
memcache[name] = dep;
|
memcache[name] = dep;
|
||||||
|
|
1
test/_fixtures/npm/verdaccio.json
Normal file
1
test/_fixtures/npm/verdaccio.json
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,7 @@
|
||||||
const npm = require('../../../lib/datasource/npm');
|
const npm = require('../../../lib/datasource/npm');
|
||||||
const registryAuthToken = require('registry-auth-token');
|
const registryAuthToken = require('registry-auth-token');
|
||||||
const nock = require('nock');
|
const nock = require('nock');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
jest.mock('registry-auth-token');
|
jest.mock('registry-auth-token');
|
||||||
jest.mock('delay');
|
jest.mock('delay');
|
||||||
|
@ -48,6 +49,17 @@ describe('api/npm', () => {
|
||||||
const res = await npm.getDependency('foobar');
|
const res = await npm.getDependency('foobar');
|
||||||
expect(res).toMatchSnapshot();
|
expect(res).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
it('ignores deprecated versions', async () => {
|
||||||
|
const verdaccio = fs.readFileSync(
|
||||||
|
'test/_fixtures/npm/verdaccio.json',
|
||||||
|
'utf8'
|
||||||
|
);
|
||||||
|
nock('https://registry.npmjs.org')
|
||||||
|
.get('/verdaccio')
|
||||||
|
.reply(200, verdaccio);
|
||||||
|
const res = await npm.getDependency('verdaccio');
|
||||||
|
expect(res.versions['3.0.0-test.1']).toBeUndefined();
|
||||||
|
});
|
||||||
it('should use homepage', async () => {
|
it('should use homepage', async () => {
|
||||||
const npmResponseHomepage = { ...npmResponse };
|
const npmResponseHomepage = { ...npmResponse };
|
||||||
npmResponseHomepage.repository.url = '';
|
npmResponseHomepage.repository.url = '';
|
||||||
|
|
Loading…
Reference in a new issue