0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-30 22:34:10 -05:00

Fix #73 Add time property to new published local packages

This commit is contained in:
Juan Picado @jotadeveloper 2017-06-23 08:13:19 +02:00
parent 8fbf77a76d
commit 172b271c6f
No known key found for this signature in database
GPG key ID: 18AC54485952D158

View file

@ -29,6 +29,7 @@ const generatePackageTemplate = function(name) {
'name': name,
'versions': {},
'dist-tags': {},
'time': {},
// our own object
'_distfiles': {},
@ -263,6 +264,12 @@ class LocalStorage {
+ ' != ' + metadata.dist.shasum) );
}
}
let currentDate = new Date().toISOString();
data.time['modified'] = currentDate;
if (('created' in data.time) === false) {
data.time.created = currentDate;
}
data.time[version] = currentDate;
data._attachments[tarball].version = version;
}
}
@ -703,7 +710,7 @@ class LocalStorage {
* @param {Object} pkg package reference.
*/
_normalizePackage(pkg) {
['versions', 'dist-tags', '_distfiles', '_attachments', '_uplinks'].forEach(function(key) {
['versions', 'dist-tags', '_distfiles', '_attachments', '_uplinks', 'time'].forEach(function(key) {
if (!Utils.is_object(pkg[key])) {
pkg[key] = {};
}