mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 15:06:27 +00:00
refactor: replace config dot notation in npm lookup
This commit is contained in:
parent
409cd4adde
commit
2323820df9
1 changed files with 14 additions and 15 deletions
|
@ -9,28 +9,27 @@ module.exports = {
|
||||||
|
|
||||||
async function getPackageUpdates(config) {
|
async function getPackageUpdates(config) {
|
||||||
logger.trace({ config }, `npm.getPackageUpdates()`);
|
logger.trace({ config }, `npm.getPackageUpdates()`);
|
||||||
if (config.depType === 'engines') {
|
const { depType, depName, currentVersion } = config;
|
||||||
if (config.depName !== 'node') {
|
if (depType === 'engines') {
|
||||||
|
if (depName !== 'node') {
|
||||||
logger.debug('Skipping non-node engine');
|
logger.debug('Skipping non-node engine');
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
return nodeManager.getPackageUpdates(config);
|
return nodeManager.getPackageUpdates(config);
|
||||||
}
|
}
|
||||||
let results = [];
|
let results = [];
|
||||||
if (config.currentVersion.startsWith('file:')) {
|
if (currentVersion.startsWith('file:')) {
|
||||||
logger.debug(
|
logger.debug(
|
||||||
{ dependency: config.depName, currentVersion: config.currentVersion },
|
{ dependency: depName, currentVersion },
|
||||||
'Skipping file: dependency'
|
'Skipping file: dependency'
|
||||||
);
|
);
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
if (!isValidSemver(config.currentVersion)) {
|
if (!isValidSemver(currentVersion)) {
|
||||||
results.push({
|
results.push({
|
||||||
depName: config.depName,
|
depName,
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
message: `Dependency uses tag "\`${
|
message: `Dependency uses tag "\`${currentVersion}\`" as its version so that will never be changed by Renovate`,
|
||||||
config.currentVersion
|
|
||||||
}\`" as its version so that will never be changed by Renovate`,
|
|
||||||
});
|
});
|
||||||
logger.debug(results[0].message);
|
logger.debug(results[0].message);
|
||||||
return results;
|
return results;
|
||||||
|
@ -39,12 +38,12 @@ async function getPackageUpdates(config) {
|
||||||
config.npmrc,
|
config.npmrc,
|
||||||
config.global ? config.global.exposeEnv : false
|
config.global ? config.global.exposeEnv : false
|
||||||
);
|
);
|
||||||
const npmDep = await npmApi.getDependency(config.depName);
|
const npmDep = await npmApi.getDependency(depName);
|
||||||
if (npmDep) {
|
if (npmDep) {
|
||||||
results = await versions.determineUpgrades(npmDep, config);
|
results = await versions.determineUpgrades(npmDep, config);
|
||||||
if (results.length > 0) {
|
if (results.length > 0) {
|
||||||
logger.info(
|
logger.info(
|
||||||
{ dependency: config.depName },
|
{ dependency: depName },
|
||||||
`${results.length} result(s): ${results.map(
|
`${results.length} result(s): ${results.map(
|
||||||
upgrade => upgrade.newVersion
|
upgrade => upgrade.newVersion
|
||||||
)}`
|
)}`
|
||||||
|
@ -54,11 +53,11 @@ async function getPackageUpdates(config) {
|
||||||
// If dependency lookup fails then warn and return
|
// If dependency lookup fails then warn and return
|
||||||
const result = {
|
const result = {
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
message: `Failed to look up dependency ${config.depName}`,
|
message: `Failed to look up dependency ${depName}`,
|
||||||
};
|
};
|
||||||
results = [result];
|
results = [result];
|
||||||
logger.info(
|
logger.info(
|
||||||
{ dependency: config.depName, packageFile: config.packageFile },
|
{ dependency: depName, packageFile: config.packageFile },
|
||||||
result.message
|
result.message
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -67,9 +66,9 @@ async function getPackageUpdates(config) {
|
||||||
npmDep && npmDep.repositoryUrl && npmDep.repositoryUrl.length
|
npmDep && npmDep.repositoryUrl && npmDep.repositoryUrl.length
|
||||||
? npmDep.repositoryUrl
|
? npmDep.repositoryUrl
|
||||||
: null;
|
: null;
|
||||||
if (!result.repositoryUrl && config.depName.startsWith('@types/')) {
|
if (!result.repositoryUrl && depName.startsWith('@types/')) {
|
||||||
logger.debug('Setting @types url manually');
|
logger.debug('Setting @types url manually');
|
||||||
result.repositoryUrl = `https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/${config.depName.replace(
|
result.repositoryUrl = `https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/${depName.replace(
|
||||||
'@',
|
'@',
|
||||||
''
|
''
|
||||||
)}`;
|
)}`;
|
||||||
|
|
Loading…
Reference in a new issue