mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-16 21:56:25 -05:00
marked -> render-readme
This commit is contained in:
parent
950cfb2945
commit
2b9bfcc0d9
3 changed files with 110 additions and 15 deletions
|
@ -2,9 +2,9 @@ var bodyParser = require('body-parser')
|
|||
var Cookies = require('cookies')
|
||||
var express = require('express')
|
||||
var fs = require('fs')
|
||||
var marked = require('marked')
|
||||
var Handlebars = require('handlebars')
|
||||
var Error = require('http-errors')
|
||||
var renderReadme = require('render-readme')
|
||||
var Search = require('./search')
|
||||
var Middleware = require('./middleware')
|
||||
var match = Middleware.match
|
||||
|
@ -123,17 +123,10 @@ module.exports = function(config, auth, storage) {
|
|||
}
|
||||
})
|
||||
|
||||
// Readme
|
||||
marked.setOptions({
|
||||
highlight: function (code) {
|
||||
return require('highlight.js').highlightAuto(code).value
|
||||
}
|
||||
})
|
||||
|
||||
app.get('/-/readme/:package/:version?', can('access'), function(req, res, next) {
|
||||
storage.get_package(req.params.package, {req: req}, function(err, info) {
|
||||
if (err) return next(err)
|
||||
next( marked(info.readme || 'ERROR: No README data found!') )
|
||||
next( renderReadme(info.readme || 'ERROR: No README data found!') )
|
||||
})
|
||||
})
|
||||
return app
|
||||
|
|
112
npm-shrinkwrap.json
generated
112
npm-shrinkwrap.json
generated
|
@ -560,11 +560,6 @@
|
|||
"from": "lunr@>=0.5.2 <1.0.0-0",
|
||||
"resolved": "https://registry.npmjs.org/lunr/-/lunr-0.5.6.tgz"
|
||||
},
|
||||
"marked": {
|
||||
"version": "0.3.2",
|
||||
"from": "marked@>=0.3.2 <1.0.0-0",
|
||||
"resolved": "https://registry.npmjs.org/marked/-/marked-0.3.2.tgz"
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "1.0.0",
|
||||
"from": "minimatch@>=0.2.14 <2.0.0-0",
|
||||
|
@ -594,6 +589,113 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"render-readme": {
|
||||
"version": "0.2.1",
|
||||
"from": "render-readme@*",
|
||||
"resolved": "https://registry.npmjs.org/render-readme/-/render-readme-0.2.1.tgz",
|
||||
"dependencies": {
|
||||
"remarkable": {
|
||||
"version": "1.4.2",
|
||||
"from": "remarkable@>=1.0.0 <2.0.0 >=1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/remarkable/-/remarkable-1.4.2.tgz",
|
||||
"dependencies": {
|
||||
"argparse": {
|
||||
"version": "0.1.16",
|
||||
"from": "argparse@>=0.1.15 <0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-0.1.16.tgz",
|
||||
"dependencies": {
|
||||
"underscore": {
|
||||
"version": "1.7.0",
|
||||
"from": "underscore@>=1.7.0 <1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.7.0.tgz"
|
||||
},
|
||||
"underscore.string": {
|
||||
"version": "2.4.0",
|
||||
"from": "underscore.string@>=2.4.0 <2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.4.0.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"autolinker": {
|
||||
"version": "0.15.0",
|
||||
"from": "autolinker@>=0.15.0 <0.16.0",
|
||||
"resolved": "https://registry.npmjs.org/autolinker/-/autolinker-0.15.0.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"sanitize-html": {
|
||||
"version": "1.4.3",
|
||||
"from": "sanitize-html@>=1.0.0 <2.0.0 >=1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/sanitize-html/-/sanitize-html-1.4.3.tgz",
|
||||
"dependencies": {
|
||||
"he": {
|
||||
"version": "0.4.1",
|
||||
"from": "he@>=0.4.1 <0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/he/-/he-0.4.1.tgz"
|
||||
},
|
||||
"htmlparser2": {
|
||||
"version": "3.7.3",
|
||||
"from": "htmlparser2@>=3.7.0 <3.8.0",
|
||||
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.7.3.tgz",
|
||||
"dependencies": {
|
||||
"domhandler": {
|
||||
"version": "2.2.1",
|
||||
"from": "domhandler@>=2.2.0 <2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.2.1.tgz"
|
||||
},
|
||||
"domutils": {
|
||||
"version": "1.5.0",
|
||||
"from": "domutils@>=1.5.0 <1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.0.tgz"
|
||||
},
|
||||
"domelementtype": {
|
||||
"version": "1.1.3",
|
||||
"from": "domelementtype@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz"
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "1.1.13",
|
||||
"from": "readable-stream@>=1.1.0 <1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.13.tgz",
|
||||
"dependencies": {
|
||||
"core-util-is": {
|
||||
"version": "1.0.1",
|
||||
"from": "core-util-is@>=1.0.0 <1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz"
|
||||
},
|
||||
"isarray": {
|
||||
"version": "0.0.1",
|
||||
"from": "isarray@0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz"
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "0.10.31",
|
||||
"from": "string_decoder@>=0.10.0 <0.11.0",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz"
|
||||
},
|
||||
"inherits": {
|
||||
"version": "2.0.1",
|
||||
"from": "inherits@>=2.0.1 <2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"entities": {
|
||||
"version": "1.0.0",
|
||||
"from": "entities@>=1.0.0 <1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/entities/-/entities-1.0.0.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"lodash": {
|
||||
"version": "2.4.1",
|
||||
"from": "lodash@>=2.4.0 <2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.1.tgz"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"request": {
|
||||
"version": "2.49.0",
|
||||
"from": "request@>=2.31.0 <3.0.0-0",
|
||||
|
|
|
@ -37,7 +37,7 @@ dependencies:
|
|||
handlebars: '1.x'
|
||||
highlight.js: '8.x'
|
||||
lunr: '>=0.5.2 <1.0.0-0'
|
||||
marked: '>=0.3.2 <1.0.0-0'
|
||||
render-readme: '>=0.2.1'
|
||||
jju: '1.x'
|
||||
|
||||
mkdirp: '>=0.3.5 <1.0.0-0'
|
||||
|
|
Loading…
Reference in a new issue