|
|
@ -5,11 +5,17 @@ const statusInfo = { |
|
|
|
'outofdate': ['out of date', 'orange'], |
|
|
|
'notsouptodate': ['up to date', 'yellow'], |
|
|
|
'uptodate': ['up to date', 'green'], |
|
|
|
'none': ['pending', 'grey'] |
|
|
|
'none': ['none', 'blue'] |
|
|
|
} |
|
|
|
|
|
|
|
module.exports = async function (depType, user, repo) { |
|
|
|
const endpoint = `https://david-dm.org/${user}/${repo}/info.json` |
|
|
|
const prefix = { |
|
|
|
'dep': '', |
|
|
|
'dev': 'dev-', |
|
|
|
'peer': 'peer-', |
|
|
|
'optional': 'optional-' |
|
|
|
}[depType] |
|
|
|
const endpoint = `https://david-dm.org/${user}/${repo}/${prefix}info.json` |
|
|
|
const { status } = await axios.get(endpoint).then(res => res.data) |
|
|
|
|
|
|
|
switch (depType) { |
|
|
@ -19,5 +25,23 @@ module.exports = async function (depType, user, repo) { |
|
|
|
status: statusInfo[status][0], |
|
|
|
color: statusInfo[status][1] |
|
|
|
} |
|
|
|
case 'dev': |
|
|
|
return { |
|
|
|
subject: 'devDependencies', |
|
|
|
status: statusInfo[status][0], |
|
|
|
color: statusInfo[status][1] |
|
|
|
} |
|
|
|
case 'peer': |
|
|
|
return { |
|
|
|
subject: 'peerDependencies', |
|
|
|
status: statusInfo[status][0], |
|
|
|
color: statusInfo[status][1] |
|
|
|
} |
|
|
|
case 'optional': |
|
|
|
return { |
|
|
|
subject: 'optionalDependencies', |
|
|
|
status: statusInfo[status][0], |
|
|
|
color: statusInfo[status][1] |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|