🎨 Improve patchmanifest JSON format
This commit is contained in:
parent
82804f6657
commit
33175d9dbe
1 changed files with 12 additions and 2 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue