diff --git a/lib/storage/local/local-storage.js b/lib/storage/local/local-storage.js index ff37db17e..f7ce5fda1 100644 --- a/lib/storage/local/local-storage.js +++ b/lib/storage/local/local-storage.js @@ -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] = {}; }