🎨 Improve patchmanifest JSON format

This commit is contained in:
C-3PO 2018-06-23 21:36:29 +02:00
parent 82804f6657
commit 33175d9dbe
Signed by: c3po
GPG key ID: 62993C4BB4D86F24

View file

@ -11,10 +11,20 @@ export default function parsePatchManifest(manifestFile: any): any {
//<Releases><Release><Id>0</Id><SHA1>53678f8057e52896a8145dca5c188ab3f24fa55f</SHA1></Release></Releases> //<Releases><Release><Id>0</Id><SHA1>53678f8057e52896a8145dca5c188ab3f24fa55f</SHA1></Release></Releases>
const Releases = PatchManifest.elements[7]; const Releases = PatchManifest.elements[7];
out.releases = Releases.elements.map((Release: any) => ({ id: Release.elements[0].elements[0].text, sha1: Release.elements[1].elements[0].text })); out.releases = {};
Releases.elements.forEach((Release: any) => {
const id = Release.elements[0].elements[0].text;
const sha1 = Release.elements[1].elements[0].text;
out.releases[id] = { sha1, from: [], to: [] };
});
const ReleaseUpdatePaths = PatchManifest.elements[8]; const ReleaseUpdatePaths = PatchManifest.elements[8];
out.paths = ReleaseUpdatePaths.elements.map((ReleaseUpdatePath: any) => ({ from: ReleaseUpdatePath.elements[0].elements[0].text, to: ReleaseUpdatePath.elements[1].elements[0].text })); ReleaseUpdatePaths.elements.forEach((ReleaseUpdatePath: any) => {
const from = ReleaseUpdatePath.elements[0].elements[0].text;
const to = ReleaseUpdatePath.elements[1].elements[0].text;
out.releases[from].to.push(to);
out.releases[to].from.push(from);
});
return out; return out;
} }