mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-01-06 22:40:26 -05:00
refactor: methods to camel case
This commit is contained in:
parent
67414a5ed5
commit
42f23da363
4 changed files with 13 additions and 13 deletions
|
@ -15,7 +15,7 @@ module.exports = function(route, auth, storage) {
|
||||||
|
|
||||||
let tags = {};
|
let tags = {};
|
||||||
tags[req.params.tag] = req.body;
|
tags[req.params.tag] = req.body;
|
||||||
storage.merge_tags(req.params.package, tags, function(err) {
|
storage.mergeTags(req.params.package, tags, function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ module.exports = function(route, auth, storage) {
|
||||||
route.delete('/-/package/:package/dist-tags/:tag', can('publish'), function(req, res, next) {
|
route.delete('/-/package/:package/dist-tags/:tag', can('publish'), function(req, res, next) {
|
||||||
const tags = {};
|
const tags = {};
|
||||||
tags[req.params.tag] = null;
|
tags[req.params.tag] = null;
|
||||||
storage.merge_tags(req.params.package, tags, function(err) {
|
storage.mergeTags(req.params.package, tags, function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ module.exports = function(route, auth, storage) {
|
||||||
});
|
});
|
||||||
|
|
||||||
route.post('/-/package/:package/dist-tags', can('publish'), function(req, res, next) {
|
route.post('/-/package/:package/dist-tags', can('publish'), function(req, res, next) {
|
||||||
storage.merge_tags(req.params.package, req.body, function(err) {
|
storage.mergeTags(req.params.package, req.body, function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,11 +35,11 @@ module.exports = function(router, auth, storage, config) {
|
||||||
};
|
};
|
||||||
|
|
||||||
const create_version = function(version, data, cb) {
|
const create_version = function(version, data, cb) {
|
||||||
storage.add_version(name, version, data, null, cb);
|
storage.addVersion(name, version, data, null, cb);
|
||||||
};
|
};
|
||||||
|
|
||||||
const add_tags = function(tags, cb) {
|
const add_tags = function(tags, cb) {
|
||||||
storage.merge_tags(name, tags, cb);
|
storage.mergeTags(name, tags, cb);
|
||||||
};
|
};
|
||||||
|
|
||||||
const after_change = function(err, ok_message) {
|
const after_change = function(err, ok_message) {
|
||||||
|
@ -175,7 +175,7 @@ module.exports = function(router, auth, storage, config) {
|
||||||
let version = req.params.version;
|
let version = req.params.version;
|
||||||
let tag = req.params.tag;
|
let tag = req.params.tag;
|
||||||
|
|
||||||
storage.add_version(name, version, req.body, tag, function(err) {
|
storage.addVersion(name, version, req.body, tag, function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,7 +144,7 @@ class Storage {
|
||||||
* @param {*} tag
|
* @param {*} tag
|
||||||
* @param {*} callback
|
* @param {*} callback
|
||||||
*/
|
*/
|
||||||
add_version(name, version, metadata, tag, callback) {
|
addVersion(name, version, metadata, tag, callback) {
|
||||||
this.localStorage.addVersion(name, version, metadata, tag, callback);
|
this.localStorage.addVersion(name, version, metadata, tag, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ class Storage {
|
||||||
* @param {*} tag_hash
|
* @param {*} tag_hash
|
||||||
* @param {*} callback
|
* @param {*} callback
|
||||||
*/
|
*/
|
||||||
merge_tags(name, tag_hash, callback) {
|
mergeTags(name, tag_hash, callback) {
|
||||||
this.localStorage.mergeTags(name, tag_hash, callback);
|
this.localStorage.mergeTags(name, tag_hash, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -569,7 +569,7 @@ class Storage {
|
||||||
this._updateVersionsHiddenUpLink(upLinkResponse.versions, upLink);
|
this._updateVersionsHiddenUpLink(upLinkResponse.versions, upLink);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Storage._merge_versions(packageInfo, upLinkResponse, self.config);
|
Storage._mergeVersions(packageInfo, upLinkResponse, self.config);
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
self.logger.error({
|
self.logger.error({
|
||||||
sub: 'out',
|
sub: 'out',
|
||||||
|
@ -643,7 +643,7 @@ class Storage {
|
||||||
* @param {*} config
|
* @param {*} config
|
||||||
* @static
|
* @static
|
||||||
*/
|
*/
|
||||||
static _merge_versions(local, up, config) {
|
static _mergeVersions(local, up, config) {
|
||||||
// copy new versions to a cache
|
// copy new versions to a cache
|
||||||
// NOTE: if a certain version was updated, we can't refresh it reliably
|
// NOTE: if a certain version was updated, we can't refresh it reliably
|
||||||
for (let i in up.versions) {
|
for (let i in up.versions) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ describe('Storage._merge_versions versions', () => {
|
||||||
'dist-tags': {},
|
'dist-tags': {},
|
||||||
};
|
};
|
||||||
|
|
||||||
Storage._merge_versions(pkg, {versions: {a: 2, q: 2}});
|
Storage._mergeVersions(pkg, {versions: {a: 2, q: 2}});
|
||||||
|
|
||||||
assert.deepEqual(pkg, {
|
assert.deepEqual(pkg, {
|
||||||
'versions': {a: 1, b: 1, c: 1, q: 2},
|
'versions': {a: 1, b: 1, c: 1, q: 2},
|
||||||
|
@ -28,7 +28,7 @@ describe('Storage._merge_versions versions', () => {
|
||||||
'dist-tags': {q: '1.1.1', w: '2.2.2'},
|
'dist-tags': {q: '1.1.1', w: '2.2.2'},
|
||||||
};
|
};
|
||||||
|
|
||||||
Storage._merge_versions(pkg, {'dist-tags': {q: '2.2.2', w: '3.3.3', t: '4.4.4'}});
|
Storage._mergeVersions(pkg, {'dist-tags': {q: '2.2.2', w: '3.3.3', t: '4.4.4'}});
|
||||||
|
|
||||||
assert.deepEqual(pkg, {
|
assert.deepEqual(pkg, {
|
||||||
'versions': {},
|
'versions': {},
|
||||||
|
@ -48,7 +48,7 @@ describe('Storage._merge_versions versions', () => {
|
||||||
// against our local 1.1.10, which may end up published as 1.1.3 in the
|
// against our local 1.1.10, which may end up published as 1.1.3 in the
|
||||||
// future
|
// future
|
||||||
|
|
||||||
Storage._merge_versions(pkg, {'dist-tags':{q:'1.1.2',w:'3.3.3',t:'4.4.4'}})
|
Storage._mergeVersions(pkg, {'dist-tags':{q:'1.1.2',w:'3.3.3',t:'4.4.4'}})
|
||||||
|
|
||||||
assert.deepEqual(pkg, {
|
assert.deepEqual(pkg, {
|
||||||
versions: {},
|
versions: {},
|
||||||
|
|
Loading…
Reference in a new issue