Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Arduini <luke.arduini@gmail.com>2013-03-07 18:31:49 +0400
committerLuke Arduini <luke.arduini@gmail.com>2013-03-07 18:31:49 +0400
commit833a80c8dc7a9bb0bbe2061cba9ff525e9675422 (patch)
tree40e8baec46517dc03be89c57b78f0d77116cd0af /lib/search.js
parent11864e18c413619fc2af0ea71783401593ab7e68 (diff)
Adding current version header to npm search output
Diffstat (limited to 'lib/search.js')
-rw-r--r--lib/search.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/search.js b/lib/search.js
index 3e9bdb15f..edbdc70b1 100644
--- a/lib/search.js
+++ b/lib/search.js
@@ -86,6 +86,7 @@ function stripData (data) {
})
, url: !Object.keys(data.versions || {}).length ? data.url : null
, keywords: data.keywords || []
+ , version: Object.keys(data.versions)[0] || []
, time: data.time
&& data.time.modified
&& (new Date(data.time.modified).toISOString()
@@ -142,18 +143,19 @@ function prettify (data, args) {
var longest = []
, spaces
, maxLen = npm.config.get("description")
- ? [20, 60, 20, 20, Infinity]
- : [20, 20, 20, Infinity]
+ ? [20, 60, 20, 20, 10, Infinity]
+ : [20, 20, 20, 10, Infinity]
, headings = npm.config.get("description")
- ? ["NAME", "DESCRIPTION", "AUTHOR", "DATE", "KEYWORDS"]
- : ["NAME", "AUTHOR", "DATE", "KEYWORDS"]
+ ? ["NAME", "DESCRIPTION", "AUTHOR", "DATE", "VERSION", "KEYWORDS"]
+ : ["NAME", "AUTHOR", "DATE", "VERSION", "KEYWORDS"]
, lines
, searchsort = (npm.config.get("searchsort") || "NAME").toLowerCase()
, sortFields = { name: 0
, description: 1
, author: 2
, date: 3
- , keywords: 4 }
+ , version: 4
+ , keywords: 5 }
, searchRev = searchsort.charAt(0) === "-"
, sortField = sortFields[searchsort.replace(/^\-+/, "")]
@@ -171,6 +173,7 @@ function prettify (data, args) {
, data.description || ""
, data.maintainers.join(" ")
, data.time
+ , data.version || ""
, (data.keywords || []).join(" ")
]
l.forEach(function (s, i) {