mirror of
https://github.com/Instadapp/trustwallet-assets.git
synced 2024-07-29 22:37:31 +00:00
Proper version update (#5379)
Co-authored-by: Catenocrypt <catenocrypt@users.noreply.github.com>
This commit is contained in:
parent
c850c6f2e9
commit
6ba5809679
|
@ -93,7 +93,6 @@ export function writeToFile(filename: string, list: List): void {
|
|||
// Write out to file, updating version+timestamp if there was change
|
||||
export function writeToFileWithUpdate(filename: string, list: List): void {
|
||||
let listOld: List = undefined;
|
||||
let oldVersion: Version = new Version(0, 0, 0);
|
||||
try {
|
||||
listOld = readJsonFile(filename) as List;
|
||||
} catch (err) {
|
||||
|
@ -103,18 +102,16 @@ export function writeToFileWithUpdate(filename: string, list: List): void {
|
|||
if (listOld === undefined) {
|
||||
changed = true;
|
||||
} else {
|
||||
oldVersion = listOld.version;
|
||||
list.version = listOld.version; // take over
|
||||
const diffs = diffTokenlist(list, listOld);
|
||||
if (diffs != undefined) {
|
||||
//console.log("List has Changed", JSON.stringify(diffs));
|
||||
changed = true;
|
||||
list.version = new Version(list.version.major + 1, 0, 0);
|
||||
}
|
||||
}
|
||||
if (changed) {
|
||||
// update version and time
|
||||
list.version.major = oldVersion.major + 1;
|
||||
list.version.minor = 0;
|
||||
list.version.patch = 0;
|
||||
// update timestqamp
|
||||
list.timestamp = (new Date()).toISOString();
|
||||
console.log(`Version and timestamp updated, ${list.version.major}.${list.version.minor}.${list.version.patch} timestamp ${list.timestamp}`);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user