diff --git a/lib/config/presets.js b/lib/config/presets.js index d5ca02ab2a4443ce9914d606302681ba4c0470ca..2cdf18139a49f669dae2c8f36467c72ea4be189d 100644 --- a/lib/config/presets.js +++ b/lib/config/presets.js @@ -161,7 +161,7 @@ async function getPreset(preset) { logger.trace(`getPreset(${preset})`); const { packageName, presetName, params } = parsePreset(preset); let presetConfig; - const dep = await npm.getDependency(packageName); + const dep = await npm.getPkgReleases(packageName); if (!dep) { throw Error('dep not found'); } diff --git a/lib/datasource/docker.js b/lib/datasource/docker.js index 1c4f7cf6118404b2e31883e3ec63175de6778e53..2eff7e8841f46ff24b3f35e709ad229e35bcc1fe 100644 --- a/lib/datasource/docker.js +++ b/lib/datasource/docker.js @@ -5,7 +5,7 @@ const { isVersion, sortVersions } = require('../versioning/docker'); module.exports = { getDigest, - getDependency, + getPkgReleases, }; function massageRegistry(input) { @@ -145,7 +145,7 @@ async function getDigest(config, newValue) { } } -async function getDependency(purl) { +async function getPkgReleases(purl) { const { fullname, qualifiers } = purl; const { registry, suffix } = qualifiers; logger.debug({ fullname, registry, suffix }, 'docker.getDependencies()'); diff --git a/lib/datasource/github.js b/lib/datasource/github.js index 365470b61f2463976400d3c417ce733fff8bcc09..30563b1d413afd81f82b8b2460face27d3fb5791 100644 --- a/lib/datasource/github.js +++ b/lib/datasource/github.js @@ -2,10 +2,10 @@ const ghGot = require('../platform/github/gh-got-wrapper'); const versioning = require('../versioning'); module.exports = { - getDependency, + getPkgReleases, }; -async function getDependency(purl, config) { +async function getPkgReleases(purl, config) { const { versionScheme } = config || {}; const { fullname: repo, qualifiers: options } = purl; let versions; diff --git a/lib/datasource/index.js b/lib/datasource/index.js index 46a29840dd7c02b03d25c7bd4d45b4c57f1b879a..48d1ce3a52bbdc71b6a957c3d7f4a7f45def1101 100644 --- a/lib/datasource/index.js +++ b/lib/datasource/index.js @@ -16,7 +16,7 @@ const datasources = { pypi, }; -function getDependency(purlStr, config) { +function getPkgReleases(purlStr, config) { const purl = parse(purlStr); if (!purl) { return null; @@ -25,12 +25,12 @@ function getDependency(purlStr, config) { logger.warn('Unknown purl type: ' + purl.type); return null; } - return datasources[purl.type].getDependency(purl, config); + return datasources[purl.type].getPkgReleases(purl, config); } function supportsDigests(purlStr) { const purl = parse(purlStr); - return !!datasources[purl.type].getDependency; + return !!datasources[purl.type].getPkgReleases; } function getDigest(config, value) { @@ -39,7 +39,7 @@ function getDigest(config, value) { } module.exports = { - getDependency, + getPkgReleases, supportsDigests, getDigest, }; diff --git a/lib/datasource/npm.js b/lib/datasource/npm.js index cc187272fc2341bde54849f3409db648981845f6..6ebe65a815b2f4ffac1b1d337c847b703f7d448f 100644 --- a/lib/datasource/npm.js +++ b/lib/datasource/npm.js @@ -14,7 +14,7 @@ const endpoints = require('../util/endpoints'); module.exports = { maskToken, setNpmrc, - getDependency, + getPkgReleases, resetMemCache, resetCache, }; @@ -96,7 +96,7 @@ function envReplace(value, env = process.env) { }); } -function getDependency(input, config) { +function getPkgReleases(input, config) { const retries = config ? config.retries : undefined; if (is.string(input)) { const depName = input; @@ -111,7 +111,7 @@ function getDependency(input, config) { } async function getDependencyInner(name, retries = 5) { - logger.trace(`getDependency(${name})`); + logger.trace(`getPkgReleases(${name})`); if (memcache[name]) { logger.trace('Returning cached result'); return memcache[name]; diff --git a/lib/datasource/nuget.js b/lib/datasource/nuget.js index 837ddecc069d4581e2fbf816bc31aee89c359e27..913b7c8aac2667be3ca97f1578caa25461f09876 100644 --- a/lib/datasource/nuget.js +++ b/lib/datasource/nuget.js @@ -4,12 +4,12 @@ const xmlParser = require('fast-xml-parser'); const { isVersion, sortVersions } = require('../versioning/semver'); module.exports = { - getDependency, + getPkgReleases, }; -async function getDependency(purl) { +async function getPkgReleases(purl) { const { fullname: name } = purl; - logger.trace(`nuget.getDependency(${name})`); + logger.trace(`nuget.getPkgReleases(${name})`); const pkgUrl = `https://api.nuget.org/v3-flatcontainer/${name.toLowerCase()}/index.json`; try { const res = (await got(pkgUrl, { diff --git a/lib/datasource/packagist.js b/lib/datasource/packagist.js index 1f451989dc58405ecaecdb96d89c5fe51d332302..8dbd28873efdd5e99b4b1ec887028f76999f43e2 100644 --- a/lib/datasource/packagist.js +++ b/lib/datasource/packagist.js @@ -4,12 +4,12 @@ const parse = require('github-url-from-git'); const { isVersion, sortVersions } = require('../versioning')('semverComposer'); module.exports = { - getDependency, + getPkgReleases, }; -async function getDependency(purl) { +async function getPkgReleases(purl) { const { fullname: name } = purl; - logger.trace(`getDependency(${name})`); + logger.trace(`getPkgReleases(${name})`); const regUrl = 'https://packagist.org'; diff --git a/lib/datasource/pypi.js b/lib/datasource/pypi.js index 24c30ef10ed0ed71b3fe85753d7ad1781fefff3d..afed0bbb7e7db457f9dafbcf0a67e2ab81c97c71 100644 --- a/lib/datasource/pypi.js +++ b/lib/datasource/pypi.js @@ -4,14 +4,14 @@ const is = require('@sindresorhus/is'); const { isVersion, sortVersions } = require('../versioning')('pep440'); module.exports = { - getDependency, + getPkgReleases, }; function normalizeName(input) { return input.toLowerCase().replace(/-/g, '_'); } -async function getDependency(purl, config = {}) { +async function getPkgReleases(purl, config = {}) { const { fullname: depName } = purl; let hostUrl = 'https://pypi.org/pypi/'; if (!is.empty(config.registryUrls)) { diff --git a/lib/manager/travis/package.js b/lib/manager/travis/package.js index fbd758798db1108e71ba444c75e58028ea7a09f5..abb698250968c32b8e92a6a631187a4d8e94dc08 100644 --- a/lib/manager/travis/package.js +++ b/lib/manager/travis/package.js @@ -1,6 +1,6 @@ const is = require('@sindresorhus/is'); const { isEqual } = require('lodash'); -const { getDependency } = require('../../datasource'); +const { getPkgReleases } = require('../../datasource'); const versioning = require('../../versioning'); const { isVersion, maxSatisfyingVersion } = versioning('semver'); @@ -37,7 +37,7 @@ async function getPackageUpdates(config) { .sort((a, b) => a - b); const newMajor = newValue[newValue.length - 1]; if (config.rangeStrategy === 'pin' || isVersion(config.currentValue[0])) { - const versions = (await getDependency( + const versions = (await getPkgReleases( 'pkg:github/nodejs/node?sanitize=true', config )).releases.map(release => release.version); diff --git a/lib/workers/repository/process/lookup/index.js b/lib/workers/repository/process/lookup/index.js index 32ce512ff5fcd82963f8fde2835d4b9e8887f7f5..888a3dbe0d99a51be59ed66bf165fd9dbf818c7d 100644 --- a/lib/workers/repository/process/lookup/index.js +++ b/lib/workers/repository/process/lookup/index.js @@ -3,7 +3,7 @@ const { getRollbackUpdate } = require('./rollback'); const { getRangeStrategy } = require('../../../../manager'); const { filterVersions } = require('./filter'); const { - getDependency, + getPkgReleases, supportsDigests, getDigest, } = require('../../../../datasource'); @@ -28,7 +28,7 @@ async function lookupUpdates(config) { } = versioning(config.versionScheme); const res = { updates: [], warnings: [] }; if (isValid(currentValue)) { - const dependency = await getDependency(config.purl, config); + const dependency = await getPkgReleases(config.purl, config); if (!dependency) { // If dependency lookup fails then warn and return const result = { diff --git a/test/config/index.spec.js b/test/config/index.spec.js index 24b2d7b5605ecca32bcd90e5b5ae37ad7cf4de1e..82298bff2574e5deddf2673152e595f428e953b6 100644 --- a/test/config/index.spec.js +++ b/test/config/index.spec.js @@ -3,7 +3,7 @@ const defaultConfig = require('../../lib/config/defaults').getConfig(); const npm = require('../../lib/datasource/npm'); const presetDefaults = require('../_fixtures/npm/renovate-config-default'); -npm.getDependency = jest.fn(() => ({ +npm.getPkgReleases = jest.fn(() => ({ 'renovate-config': presetDefaults.versions[presetDefaults['dist-tags'].latest][ 'renovate-config' diff --git a/test/config/presets.spec.js b/test/config/presets.spec.js index e4b8727840d63f365e3b2ec04195b82fcec0b361..d368f6475c721323a5fea033aef2b7c6d2821884 100644 --- a/test/config/presets.spec.js +++ b/test/config/presets.spec.js @@ -6,7 +6,7 @@ const presetGroup = require('../_fixtures/npm/renovate-config-group'); const presetMonorepo = require('../_fixtures/npm/renovate-config-monorepo'); const presetIkatyang = require('../_fixtures/npm/renovate-config-ikatyang'); -npm.getDependency = jest.fn(dep => { +npm.getPkgReleases = jest.fn(dep => { if (dep === 'renovate-config-default') { return { 'renovate-config': diff --git a/test/datasource/__snapshots__/docker.spec.js.snap b/test/datasource/__snapshots__/docker.spec.js.snap index 25c50f87f11ac43a83a8b650d50d41ea71361225..0b4728c9d040cd3b157bc77227384dbb0ef5902f 100644 --- a/test/datasource/__snapshots__/docker.spec.js.snap +++ b/test/datasource/__snapshots__/docker.spec.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`api/docker getDependency returns tags with no suffix 1`] = ` +exports[`api/docker getPkgReleases returns tags with no suffix 1`] = ` Object { "releases": Array [ Object { @@ -16,7 +16,7 @@ Object { } `; -exports[`api/docker getDependency returns tags with suffix 1`] = ` +exports[`api/docker getPkgReleases returns tags with suffix 1`] = ` Object { "releases": Array [ Object { diff --git a/test/datasource/__snapshots__/github.spec.js.snap b/test/datasource/__snapshots__/github.spec.js.snap index 982b8589b03afb35d03ec4bacf6e26aa03a634bf..f3591d40bfb6380e329c0f362fa2d7c76a125136 100644 --- a/test/datasource/__snapshots__/github.spec.js.snap +++ b/test/datasource/__snapshots__/github.spec.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`datasource/github getDependency returns cleaned tags 1`] = ` +exports[`datasource/github getPkgReleases returns cleaned tags 1`] = ` Object { "releases": Array [ Object { @@ -16,7 +16,7 @@ Object { } `; -exports[`datasource/github getDependency returns releases 1`] = ` +exports[`datasource/github getPkgReleases returns releases 1`] = ` Object { "releases": Array [ Object { diff --git a/test/datasource/__snapshots__/nuget.spec.js.snap b/test/datasource/__snapshots__/nuget.spec.js.snap index 1424a692a3a357a8e897c43d8596539184466d00..b55175873afbfae1cab3d7ea131ae816e5eb6501 100644 --- a/test/datasource/__snapshots__/nuget.spec.js.snap +++ b/test/datasource/__snapshots__/nuget.spec.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`datasource/nuget getDependency processes real data 1`] = ` +exports[`datasource/nuget getPkgReleases processes real data 1`] = ` Object { "name": "nunit", "releases": Array [ diff --git a/test/datasource/__snapshots__/packagist.spec.js.snap b/test/datasource/__snapshots__/packagist.spec.js.snap index a7e7d4270b6211257d51763165022c9ab30626d2..c6b97b0caf2f461dee20a245e5d6c8c217675a4f 100644 --- a/test/datasource/__snapshots__/packagist.spec.js.snap +++ b/test/datasource/__snapshots__/packagist.spec.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`datasource/packagist getDependency processes real data 1`] = ` +exports[`datasource/packagist getPkgReleases processes real data 1`] = ` Object { "homepage": "https://github.com/cristianvuolo/uploader", "name": "cristianvuolo/uploader", @@ -51,7 +51,7 @@ Object { } `; -exports[`datasource/packagist getDependency processes real versioned data 1`] = ` +exports[`datasource/packagist getPkgReleases processes real versioned data 1`] = ` Object { "homepage": "https://github.com/drewm/mailchimp-api", "name": "drewm/mailchimp-api", diff --git a/test/datasource/__snapshots__/pypi.spec.js.snap b/test/datasource/__snapshots__/pypi.spec.js.snap index f627631db7c7aa5c2f7a02f321c05c94ea5af829..e28076c97e89dffa7eda1cc429af78b7a6304a47 100644 --- a/test/datasource/__snapshots__/pypi.spec.js.snap +++ b/test/datasource/__snapshots__/pypi.spec.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`datasource/pypi getDependency processes real data 1`] = ` +exports[`datasource/pypi getPkgReleases processes real data 1`] = ` Object { "releases": Array [ Object { @@ -96,14 +96,14 @@ Object { } `; -exports[`datasource/pypi getDependency returns non-github home_page 1`] = ` +exports[`datasource/pypi getPkgReleases returns non-github home_page 1`] = ` Object { "homepage": "https://microsoft.com", "releases": Array [], } `; -exports[`datasource/pypi getDependency supports custom datasource url 1`] = ` +exports[`datasource/pypi getPkgReleases supports custom datasource url 1`] = ` Array [ Array [ "https://custom.pypi.net/azure-cli-monitor/json", @@ -114,7 +114,7 @@ Array [ ] `; -exports[`datasource/pypi getDependency supports custom datasource url from environmental variable 1`] = ` +exports[`datasource/pypi getPkgReleases supports custom datasource url from environmental variable 1`] = ` Array [ Array [ "https://my.pypi.python/pypi/azure-cli-monitor/json", diff --git a/test/datasource/docker.spec.js b/test/datasource/docker.spec.js index a0040307d922239428ba657c57f313fad077f40e..b97a6938f5c0f92b6d320194e93076838052e6a2 100644 --- a/test/datasource/docker.spec.js +++ b/test/datasource/docker.spec.js @@ -59,10 +59,10 @@ describe('api/docker', () => { expect(res).toBe('some-digest'); }); }); - describe('getDependency', () => { + describe('getPkgReleases', () => { it('returns null if no token', async () => { got.mockReturnValueOnce({ body: {} }); - const res = await docker.getDependency({ + const res = await docker.getPkgReleases({ fullname: 'node', qualifiers: {}, }); @@ -78,7 +78,7 @@ describe('api/docker', () => { }); got.mockReturnValueOnce({ headers: {}, body: { token: 'some-token ' } }); got.mockReturnValueOnce({ headers: {}, body: { tags } }); - const res = await docker.getDependency({ + const res = await docker.getPkgReleases({ fullname: 'my/node', qualifiers: {}, }); @@ -95,7 +95,7 @@ describe('api/docker', () => { }); got.mockReturnValueOnce({ headers: {}, body: { token: 'some-token ' } }); got.mockReturnValueOnce({ headers: {}, body: { tags } }); - const res = await docker.getDependency({ + const res = await docker.getPkgReleases({ fullname: 'my/node', qualifiers: { suffix: 'alpine' }, }); @@ -104,7 +104,7 @@ describe('api/docker', () => { }); it('returns null on error', async () => { got.mockReturnValueOnce({}); - const res = await docker.getDependency({ + const res = await docker.getPkgReleases({ fullname: 'my/node', qualifiers: {}, }); diff --git a/test/datasource/github.spec.js b/test/datasource/github.spec.js index 2ea50f72f9ff17cb8b59a35c560175280135201a..82e57a4f6175877373bc4163a5d2b5e6c28ede65 100644 --- a/test/datasource/github.spec.js +++ b/test/datasource/github.spec.js @@ -5,7 +5,7 @@ jest.mock('../../lib/platform/github/gh-got-wrapper'); jest.mock('got'); describe('datasource/github', () => { - describe('getDependency', () => { + describe('getPkgReleases', () => { it('returns cleaned tags', async () => { const body = [ { name: 'a' }, @@ -14,7 +14,7 @@ describe('datasource/github', () => { { name: 'v1.1.0' }, ]; ghGot.mockReturnValueOnce({ headers: {}, body }); - const res = await datasource.getDependency( + const res = await datasource.getPkgReleases( 'pkg:github/some/dep?sanitize=true' ); expect(res).toMatchSnapshot(); @@ -31,7 +31,7 @@ describe('datasource/github', () => { { tag_name: 'v1.1.0' }, ]; ghGot.mockReturnValueOnce({ headers: {}, body }); - const res = await datasource.getDependency( + const res = await datasource.getPkgReleases( 'pkg:github/some/dep?ref=release' ); expect(res).toMatchSnapshot(); @@ -42,7 +42,7 @@ describe('datasource/github', () => { }); it('returns null for invalid ref', async () => { expect( - await datasource.getDependency('pkg:github/some/dep?ref=invalid') + await datasource.getPkgReleases('pkg:github/some/dep?ref=invalid') ).toBeNull(); }); }); diff --git a/test/datasource/index.spec.js b/test/datasource/index.spec.js index 1d896742f41f5f2a5a7d55bfd86bb778ca83653c..31059e29a3d4f3c0390244340f007f40bfad257f 100644 --- a/test/datasource/index.spec.js +++ b/test/datasource/index.spec.js @@ -4,7 +4,7 @@ jest.mock('../../lib/datasource/docker'); describe('datasource/index', () => { it('returns null for invalid purl', async () => { - expect(await datasource.getDependency('pkggithub/some/dep')).toBeNull(); + expect(await datasource.getPkgReleases('pkggithub/some/dep')).toBeNull(); }); it('returns getDigest', async () => { expect( diff --git a/test/datasource/npm.spec.js b/test/datasource/npm.spec.js index a164b805cb96dbe717cd95cf1db3e74bc79b8994..ef6af4e12229d7f8e09fb36c4f537b22a8f80357 100644 --- a/test/datasource/npm.spec.js +++ b/test/datasource/npm.spec.js @@ -49,14 +49,14 @@ describe('api/npm', () => { nock('https://registry.npmjs.org') .get('/foobar') .reply(200, missingVersions); - const res = await npm.getDependency('foobar', { retries: 1 }); + const res = await npm.getPkgReleases('foobar', { retries: 1 }); expect(res).toBe(null); }); it('should fetch package info from npm', async () => { nock('https://registry.npmjs.org') .get('/foobar') .reply(200, npmResponse); - const res = await npm.getDependency('foobar'); + const res = await npm.getPkgReleases('foobar'); expect(res).toMatchSnapshot(); expect(getRelease(res, '0.0.1').canBeUnpublished).toBe(false); expect(getRelease(res, '0.0.2').canBeUnpublished).toBe(false); @@ -88,7 +88,7 @@ describe('api/npm', () => { nock('https://registry.npmjs.org') .get('/foobar') .reply(200, deprecatedPackage); - const res = await npm.getDependency('foobar'); + const res = await npm.getPkgReleases('foobar'); expect(res).toMatchSnapshot(); expect(res.deprecationMessage).toMatchSnapshot(); }); @@ -96,7 +96,7 @@ describe('api/npm', () => { nock('https://registry.npmjs.org') .get('/foobar') .reply(200, npmResponse); - const res = await npm.getDependency({ fullname: 'foobar' }); + const res = await npm.getPkgReleases({ fullname: 'foobar' }); expect(res).toMatchSnapshot(); }); it('should handle no time', async () => { @@ -104,7 +104,7 @@ describe('api/npm', () => { nock('https://registry.npmjs.org') .get('/foobar') .reply(200, npmResponse); - const res = await npm.getDependency('foobar'); + const res = await npm.getPkgReleases('foobar'); expect(res).toMatchSnapshot(); expect(getRelease(res, '0.0.1').canBeUnpublished).toBe(false); expect(getRelease(res, '0.0.2').canBeUnpublished).toBeUndefined(); @@ -116,7 +116,7 @@ describe('api/npm', () => { nock('https://registry.npmjs.org') .get('/foobar') .reply(200, npmResponse); - const res = await npm.getDependency('foobar'); + const res = await npm.getPkgReleases('foobar'); expect(getRelease(res, '0.0.1').canBeUnpublished).toBe(false); expect(getRelease(res, '0.0.2').canBeUnpublished).toBe(true); }); @@ -124,14 +124,14 @@ describe('api/npm', () => { nock('https://registry.npmjs.org') .get('/foobar') .reply(401); - const res = await npm.getDependency('foobar'); + const res = await npm.getPkgReleases('foobar'); expect(res).toBeNull(); }); it('should return null if lookup fails', async () => { nock('https://registry.npmjs.org') .get('/foobar') .reply(404); - const res = await npm.getDependency('foobar'); + const res = await npm.getPkgReleases('foobar'); expect(res).toBeNull(); }); it('should throw error for unparseable', async () => { @@ -143,7 +143,7 @@ describe('api/npm', () => { .reply(200, 'oops'); let e; try { - await npm.getDependency('foobar', { retries: 1 }); + await npm.getPkgReleases('foobar', { retries: 1 }); } catch (err) { e = err; } @@ -158,7 +158,7 @@ describe('api/npm', () => { .reply(429); let e; try { - await npm.getDependency('foobar', { retries: 1 }); + await npm.getPkgReleases('foobar', { retries: 1 }); } catch (err) { e = err; } @@ -170,7 +170,7 @@ describe('api/npm', () => { .reply(503); let e; try { - await npm.getDependency('foobar', { retries: 0 }); + await npm.getPkgReleases('foobar', { retries: 0 }); } catch (err) { e = err; } @@ -182,7 +182,7 @@ describe('api/npm', () => { .reply(408); let e; try { - await npm.getDependency('foobar', { retries: 0 }); + await npm.getPkgReleases('foobar', { retries: 0 }); } catch (err) { e = err; } @@ -198,7 +198,7 @@ describe('api/npm', () => { nock('https://registry.npmjs.org') .get('/foobar') .reply(200); - const res = await npm.getDependency('foobar', { retries: 2 }); + const res = await npm.getPkgReleases('foobar', { retries: 2 }); expect(res).toMatchSnapshot(); }); it('should throw error for others', async () => { @@ -207,7 +207,7 @@ describe('api/npm', () => { .reply(451); let e; try { - await npm.getDependency('foobar'); + await npm.getPkgReleases('foobar'); } catch (err) { e = err; } @@ -221,7 +221,7 @@ describe('api/npm', () => { nock('https://registry.npmjs.org') .get('/foobar') .reply(200, npmResponse); - const res = await npm.getDependency('foobar'); + const res = await npm.getPkgReleases('foobar'); expect(res).toMatchSnapshot(); }); it('should use NPM_TOKEN if provided', async () => { @@ -230,7 +230,7 @@ describe('api/npm', () => { .reply(200, npmResponse); const oldToken = process.env.NPM_TOKEN; process.env.NPM_TOKEN = 'some-token'; - const res = await npm.getDependency('foobar'); + const res = await npm.getPkgReleases('foobar'); process.env.NPM_TOKEN = oldToken; expect(res).toMatchSnapshot(); }); @@ -244,7 +244,7 @@ describe('api/npm', () => { .get('/foobar') .reply(200, npmResponse); npm.setNpmrc('foo=bar'); - const res = await npm.getDependency('foobar'); + const res = await npm.getPkgReleases('foobar'); expect(res).toMatchSnapshot(); }); it('should cache package info from npm', async () => { @@ -252,8 +252,8 @@ describe('api/npm', () => { nock('https://registry.npmjs.org') .get('/foobar') .reply(200, npmResponse); - const res1 = await npm.getDependency('foobar'); - const res2 = await npm.getDependency('foobar'); + const res1 = await npm.getPkgReleases('foobar'); + const res2 = await npm.getPkgReleases('foobar'); expect(res1).not.toBe(null); expect(res1).toEqual(res2); }); @@ -265,7 +265,7 @@ describe('api/npm', () => { 'registry=https://npm.mycustomregistry.com/\n//npm.mycustomregistry.com/:_auth = ' + Buffer.from('abcdef').toString('base64') ); - const res = await npm.getDependency('foobar'); + const res = await npm.getPkgReleases('foobar'); expect(res).toMatchSnapshot(); }); it('should replace any environment variable in npmrc', async () => { @@ -275,7 +275,7 @@ describe('api/npm', () => { process.env.REGISTRY = 'https://registry.from-env.com'; // eslint-disable-next-line no-template-curly-in-string npm.setNpmrc('registry=${REGISTRY}', true); - const res = await npm.getDependency('foobar'); + const res = await npm.getPkgReleases('foobar'); expect(res).toMatchSnapshot(); }); it('should throw error if necessary env var is not present', () => { diff --git a/test/datasource/nuget.spec.js b/test/datasource/nuget.spec.js index d9ebe9443f0a7145116f749f0780f6e354f40ba9..dd67f5c20d1aafa88c278dd3f0454474a847f4b2 100644 --- a/test/datasource/nuget.spec.js +++ b/test/datasource/nuget.spec.js @@ -8,10 +8,10 @@ const res1 = fs.readFileSync('test/_fixtures/nuget/nunit.json', 'utf8'); const res2 = fs.readFileSync('test/_fixtures/nuget/sample.nuspec', 'utf8'); describe('datasource/nuget', () => { - describe('getDependency', () => { + describe('getPkgReleases', () => { it('returns null for empty result', async () => { got.mockReturnValueOnce({}); - expect(await datasource.getDependency('pkg:nuget/something')).toBeNull(); + expect(await datasource.getPkgReleases('pkg:nuget/something')).toBeNull(); }); it('returns null for 404', async () => { got.mockImplementationOnce(() => @@ -19,13 +19,13 @@ describe('datasource/nuget', () => { statusCode: 404, }) ); - expect(await datasource.getDependency('pkg:nuget/something')).toBeNull(); + expect(await datasource.getPkgReleases('pkg:nuget/something')).toBeNull(); }); it('returns null for unknown error', async () => { got.mockImplementationOnce(() => { throw new Error(); }); - expect(await datasource.getDependency('pkg:nuget/something')).toBeNull(); + expect(await datasource.getPkgReleases('pkg:nuget/something')).toBeNull(); }); it('processes real data', async () => { got.mockReturnValueOnce({ @@ -34,7 +34,7 @@ describe('datasource/nuget', () => { got.mockReturnValueOnce({ body: res2, }); - const res = await datasource.getDependency('pkg:nuget/nunit'); + const res = await datasource.getPkgReleases('pkg:nuget/nunit'); expect(res).not.toBeNull(); expect(res).toMatchSnapshot(); expect(res.repositoryUrl).toBeDefined(); diff --git a/test/datasource/packagist.spec.js b/test/datasource/packagist.spec.js index f207f320ead27cfe04a299481cb3c1b1d04a7bee..695b55db7fe8bf329a75dac707ab0eedbfc564b3 100644 --- a/test/datasource/packagist.spec.js +++ b/test/datasource/packagist.spec.js @@ -8,11 +8,11 @@ const res1 = fs.readFileSync('test/_fixtures/packagist/uploader.json'); const res2 = fs.readFileSync('test/_fixtures/packagist/mailchimp-api.json'); describe('datasource/packagist', () => { - describe('getDependency', () => { + describe('getPkgReleases', () => { it('returns null for empty result', async () => { got.mockReturnValueOnce({}); expect( - await datasource.getDependency('pkg:packagist/something') + await datasource.getPkgReleases('pkg:packagist/something') ).toBeNull(); }); it('returns null for 404', async () => { @@ -22,7 +22,7 @@ describe('datasource/packagist', () => { }) ); expect( - await datasource.getDependency('pkg:packagist/something') + await datasource.getPkgReleases('pkg:packagist/something') ).toBeNull(); }); it('returns null for unknown error', async () => { @@ -30,7 +30,7 @@ describe('datasource/packagist', () => { throw new Error(); }); expect( - await datasource.getDependency('pkg:packagist/something') + await datasource.getPkgReleases('pkg:packagist/something') ).toBeNull(); }); it('processes real data', async () => { @@ -38,7 +38,7 @@ describe('datasource/packagist', () => { body: JSON.parse(res1), }); expect( - await datasource.getDependency('pkg:packagist/cristianvuolo/uploader') + await datasource.getPkgReleases('pkg:packagist/cristianvuolo/uploader') ).toMatchSnapshot(); }); it('processes real versioned data', async () => { @@ -46,7 +46,7 @@ describe('datasource/packagist', () => { body: JSON.parse(res2), }); expect( - await datasource.getDependency('pkg:packagist/drewm/mailchimp-api') + await datasource.getPkgReleases('pkg:packagist/drewm/mailchimp-api') ).toMatchSnapshot(); }); }); diff --git a/test/datasource/pypi.spec.js b/test/datasource/pypi.spec.js index fc879ddadde89766aab44a0e88bf0ce66cac0dae..8b400ce838472f228852111168fb0d0e2f8d5ba5 100644 --- a/test/datasource/pypi.spec.js +++ b/test/datasource/pypi.spec.js @@ -7,26 +7,26 @@ jest.mock('got'); const res1 = fs.readFileSync('test/_fixtures/pypi/azure-cli-monitor.json'); describe('datasource/pypi', () => { - describe('getDependency', () => { + describe('getPkgReleases', () => { beforeEach(() => { jest.resetAllMocks(); }); it('returns null for empty result', async () => { got.mockReturnValueOnce({}); - expect(await datasource.getDependency('pkg:pypi/something')).toBeNull(); + expect(await datasource.getPkgReleases('pkg:pypi/something')).toBeNull(); }); it('returns null for 404', async () => { got.mockImplementationOnce(() => { throw new Error(); }); - expect(await datasource.getDependency('pkg:pypi/something')).toBeNull(); + expect(await datasource.getPkgReleases('pkg:pypi/something')).toBeNull(); }); it('processes real data', async () => { got.mockReturnValueOnce({ body: JSON.parse(res1), }); expect( - await datasource.getDependency('pkg:pypi/azure-cli-monitor') + await datasource.getPkgReleases('pkg:pypi/azure-cli-monitor') ).toMatchSnapshot(); }); it('supports custom datasource url', async () => { @@ -36,7 +36,7 @@ describe('datasource/pypi', () => { const config = { registryUrls: ['https://custom.pypi.net/foo'], }; - await datasource.getDependency('pkg:pypi/azure-cli-monitor', config); + await datasource.getPkgReleases('pkg:pypi/azure-cli-monitor', config); expect(got.mock.calls).toMatchSnapshot(); }); it('supports custom datasource url from environmental variable', async () => { @@ -45,7 +45,7 @@ describe('datasource/pypi', () => { }); const pipIndexUrl = process.env.PIP_INDEX_URL; process.env.PIP_INDEX_URL = 'https://my.pypi.python/pypi/'; - await datasource.getDependency('pkg:pypi/azure-cli-monitor'); + await datasource.getPkgReleases('pkg:pypi/azure-cli-monitor'); expect(got.mock.calls).toMatchSnapshot(); process.env.PIP_INDEX_URL = pipIndexUrl; }); @@ -59,7 +59,7 @@ describe('datasource/pypi', () => { }, }); expect( - await datasource.getDependency('pkg:pypi/something') + await datasource.getPkgReleases('pkg:pypi/something') ).toMatchSnapshot(); }); it('returns null if mismatched name', async () => { @@ -71,7 +71,7 @@ describe('datasource/pypi', () => { }, }, }); - expect(await datasource.getDependency('pkg:pypi/something')).toBeNull(); + expect(await datasource.getPkgReleases('pkg:pypi/something')).toBeNull(); }); }); }); diff --git a/test/manager/travis/package.spec.js b/test/manager/travis/package.spec.js index 2d59bbf41fd93ddca031b87b0b872b655e4bc847..89f15ff52f00ab9c5bc7d1490212ada834d823c9 100644 --- a/test/manager/travis/package.spec.js +++ b/test/manager/travis/package.spec.js @@ -34,7 +34,7 @@ describe('lib/manager/node/package', () => { it('detects pinning', async () => { config.currentValue = ['6.1.0', '8.4.0']; config.supportPolicy = ['lts']; - githubDatasource.getDependency.mockReturnValueOnce({ + githubDatasource.getPkgReleases.mockReturnValueOnce({ releases: [ { version: '4.4.4', diff --git a/test/workers/repository/process/lookup/index.spec.js b/test/workers/repository/process/lookup/index.spec.js index 7be07b707dfccea2a6b0aa4ac662824abbc4fa63..0fc8ab2692dfab84c40d1daac2a81eb746300107 100644 --- a/test/workers/repository/process/lookup/index.spec.js +++ b/test/workers/repository/process/lookup/index.spec.js @@ -904,7 +904,7 @@ describe('manager/npm/lookup', () => { config.depName = 'node'; config.purl = 'pkg:docker/node'; config.pinDigests = true; - docker.getDependency.mockReturnValueOnce({ + docker.getPkgReleases.mockReturnValueOnce({ releases: [ { version: '8.0.0', @@ -924,7 +924,7 @@ describe('manager/npm/lookup', () => { config.depName = 'node'; config.purl = 'pkg:docker/node'; config.pinDigests = true; - docker.getDependency.mockReturnValueOnce({ + docker.getPkgReleases.mockReturnValueOnce({ releases: [ { version: '8.0.0', @@ -946,7 +946,7 @@ describe('manager/npm/lookup', () => { config.depName = 'node'; config.purl = 'pkg:docker/node'; config.pinDigests = true; - docker.getDependency.mockReturnValueOnce({ + docker.getPkgReleases.mockReturnValueOnce({ releases: [ { version: '8.0.0', @@ -969,7 +969,7 @@ describe('manager/npm/lookup', () => { config.purl = 'pkg:docker/node'; config.currentDigest = 'sha256:zzzzzzzzzzzzzzz'; config.pinDigests = true; - docker.getDependency.mockReturnValueOnce({ + docker.getPkgReleases.mockReturnValueOnce({ releases: [ { version: '8.0.0', @@ -990,7 +990,7 @@ describe('manager/npm/lookup', () => { config.purl = 'pkg:docker/node'; config.currentDigest = 'sha256:zzzzzzzzzzzzzzz'; config.pinDigests = true; - docker.getDependency.mockReturnValueOnce({ + docker.getPkgReleases.mockReturnValueOnce({ releases: [ { version: 'alpine', diff --git a/vul.js b/vul.js new file mode 100644 index 0000000000000000000000000000000000000000..47c5dfde24a04726c3cc62cd04dde64ad4722113 --- /dev/null +++ b/vul.js @@ -0,0 +1,16 @@ +module.exports = { + force: { + vulnerabilityAlertsOnly: true, + }, + enabledManagers: ['npm', 'pip_requirements'], + packageRules: [ + { + packagePatterns: ['.*'], + enabled: false, + }, + ], + onboarding: false, + branchPrefix: 'renovate-vulnerable/', + prFooter: + 'This [Vulnerability Alert](https://github.com/apps/vulnerability-alerts) has been raised by [Renovate Bot](https://renovatebot.com)', +};