mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-16 21:56:25 -05:00
refactor: getPackage method
This commit is contained in:
parent
bee4d1cf4f
commit
67414a5ed5
5 changed files with 6 additions and 6 deletions
|
@ -49,7 +49,7 @@ module.exports = function(route, auth, storage) {
|
|||
});
|
||||
|
||||
route.get('/-/package/:package/dist-tags', can('access'), function(req, res, next) {
|
||||
storage.get_package({
|
||||
storage.getPackage({
|
||||
name: req.params.package,
|
||||
req,
|
||||
callback: function(err, info) {
|
||||
|
|
|
@ -37,7 +37,7 @@ module.exports = function(route, auth, storage, config) {
|
|||
return next( createError[404]('version not found: ' + req.params.version) );
|
||||
};
|
||||
|
||||
storage.get_package({
|
||||
storage.getPackage({
|
||||
name: req.params.package,
|
||||
req,
|
||||
callback: getPackageMetaCallback,
|
||||
|
|
|
@ -43,7 +43,7 @@ function addPackageWebApi(route, storage, auth) {
|
|||
route.get('/package/readme/(@:scope/)?:package/:version?', can('access'), function(req, res, next) {
|
||||
const packageName = req.params.scope ? addScope(req.params.scope, req.params.package) : req.params.package;
|
||||
|
||||
storage.get_package({
|
||||
storage.getPackage({
|
||||
name: packageName,
|
||||
req,
|
||||
callback: function(err, info) {
|
||||
|
@ -60,7 +60,7 @@ function addPackageWebApi(route, storage, auth) {
|
|||
route.get('/sidebar/(@:scope/)?:package', function(req, res, next) {
|
||||
const packageName = req.params.scope ? addScope(req.params.scope, req.params.package) : req.params.package;
|
||||
|
||||
storage.get_package({
|
||||
storage.getPackage({
|
||||
name: packageName,
|
||||
keepUpLinkData: true,
|
||||
req,
|
||||
|
|
|
@ -7,7 +7,7 @@ function addSearchWebApi(route, storage, auth) {
|
|||
const packages = [];
|
||||
|
||||
const getPackageInfo = function(i) {
|
||||
storage.get_package({
|
||||
storage.getPackage({
|
||||
name: results[i].ref,
|
||||
callback: (err, entry) => {
|
||||
if (!err && entry) {
|
||||
|
|
|
@ -366,7 +366,7 @@ class Storage {
|
|||
* @property {boolean} options.keepUpLinkData keep up link info in package meta, last update, etc.
|
||||
* @property {function} options.callback Callback for receive data
|
||||
*/
|
||||
get_package(options) {
|
||||
getPackage(options) {
|
||||
this.localStorage.getPackageMetadata(options.name, (err, data) => {
|
||||
if (err && (!err.status || err.status >= 500)) {
|
||||
// report internal errors right away
|
||||
|
|
Loading…
Reference in a new issue