From 33175d9dbe80316a00b256204ac86f735cab81fb Mon Sep 17 00:00:00 2001 From: C-3PO Date: Sat, 23 Jun 2018 21:36:29 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Improve=20patchmanifest=20JSON?= =?UTF-8?q?=20format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ssn/parsePatchmanifest.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/ssn/parsePatchmanifest.ts b/src/ssn/parsePatchmanifest.ts index 9c93d87..a614a53 100644 --- a/src/ssn/parsePatchmanifest.ts +++ b/src/ssn/parsePatchmanifest.ts @@ -11,10 +11,20 @@ export default function parsePatchManifest(manifestFile: any): any { //053678f8057e52896a8145dca5c188ab3f24fa55f 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]; - 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; }