Skip to content

Commit

Permalink
feat: add versions info to the view command
Browse files Browse the repository at this point in the history
  • Loading branch information
favoyang committed Nov 13, 2020
1 parent bdb9899 commit c76b21d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/cmd-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ const printInfo = function(pkg) {
const homepage = verInfo.homepage;
const dist = verInfo.dist;
const dependencies = verInfo.dependencies;
const time = (pkg.time.modified || "").split("T")[0];
const latest = pkg["dist-tags"].latest;
let time = pkg.time.modified;
if (!time && latest in pkg.time) time = pkg.time[latest];

console.log();
console.log(
Expand Down Expand Up @@ -85,6 +86,12 @@ const printInfo = function(pkg) {

console.log();
console.log("published at " + chalk.yellow(time));

console.log();
console.log("versions:");
for (const version in pkg.versions) {
console.log(" " + chalk.greenBright(version));
}
};

module.exports = view;

0 comments on commit c76b21d

Please sign in to comment.