mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-21 14:04:38 +02:00
Update npm
This commit is contained in:
@@ -26,13 +26,14 @@ module.exports = class NPMCommand extends Command {
|
|||||||
async run(msg, { query }) {
|
async run(msg, { query }) {
|
||||||
try {
|
try {
|
||||||
const { body } = await snekfetch.get(`https://registry.npmjs.com/${query}`);
|
const { body } = await snekfetch.get(`https://registry.npmjs.com/${query}`);
|
||||||
|
const version = body.versions[body['dist-tags'].latest];
|
||||||
let maintainers = body.maintainers.map(user => user.name);
|
let maintainers = body.maintainers.map(user => user.name);
|
||||||
if (maintainers.length > 10) {
|
if (maintainers.length > 10) {
|
||||||
const len = maintainers.length - 10;
|
const len = maintainers.length - 10;
|
||||||
maintainers = maintainers.slice(0, 10);
|
maintainers = maintainers.slice(0, 10);
|
||||||
maintainers.push(`...${len} more.`);
|
maintainers.push(`...${len} more.`);
|
||||||
}
|
}
|
||||||
let dependencies = body.dependencies ? Object.keys(body.dependencies) : null;
|
let dependencies = version.dependencies ? Object.keys(version.dependencies) : null;
|
||||||
if (dependencies && dependencies.length > 10) {
|
if (dependencies && dependencies.length > 10) {
|
||||||
const len = dependencies.length - 10;
|
const len = dependencies.length - 10;
|
||||||
dependencies = dependencies.slice(0, 10);
|
dependencies = dependencies.slice(0, 10);
|
||||||
@@ -55,7 +56,7 @@ module.exports = class NPMCommand extends Command {
|
|||||||
.addField('❯ Modified',
|
.addField('❯ Modified',
|
||||||
new Date(body.time.modified).toDateString(), true)
|
new Date(body.time.modified).toDateString(), true)
|
||||||
.addField('❯ Main File',
|
.addField('❯ Main File',
|
||||||
body.versions[body['dist-tags'].latest].main, true)
|
version.main, true)
|
||||||
.addField('❯ Dependencies',
|
.addField('❯ Dependencies',
|
||||||
dependencies ? dependencies.join(', ') : 'None')
|
dependencies ? dependencies.join(', ') : 'None')
|
||||||
.addField('❯ Maintainers',
|
.addField('❯ Maintainers',
|
||||||
|
|||||||
Reference in New Issue
Block a user