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:
parent
8fbf77a76d
commit
172b271c6f
1 changed files with 8 additions and 1 deletions
|
@ -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] = {};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue