diff --git a/package.json b/package.json index 0856ca9..7326145 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,11 @@ { "name": "patcher", + "license": "AGPL-3.0-or-later", + "homepage": "https://git.jedipedia.net/swtor/patcher", + "repository": { + "type": "git", + "url": "https://git.jedipedia.net/swtor/patcher.git" + }, "main": "dist/index.js", "scripts": { "start": "rm -rf dist && tsc && cd ../patch-installer && ./build.sh && cd ../patcher && mkdir dist/lib && cp ../patch-installer/patch-installer dist/lib", diff --git a/src/ssn/findReleasePath.ts b/src/ssn/findReleasePath.ts index d435244..465bd41 100644 --- a/src/ssn/findReleasePath.ts +++ b/src/ssn/findReleasePath.ts @@ -54,7 +54,7 @@ function getFromList({ product, to: releaseTo}: {product: Product, to: number}) * Does not actually look at the manifest.xml file but theorizes on possible patches based on the usually created patches, allowing * us to find release paths for products that have not been released yet. */ -export default function findReleasePath({ product, from, to}: {product: Product, from: number, to: number}): Array<[number, number]> { +export default function findReleasePath({ product, from, to }: {product: Product, from: number, to: number}): Array<[number, number]> { //Verify function arguments if (!verifyProductName(product)) { throw new Error(`"${product}" is not a valid product.`); @@ -75,11 +75,10 @@ export default function findReleasePath({ product, from, to}: {product: Product, //Otherwise, check all from values recursively, by checking interim releases const smallerFromList = fromList.filter((num) => num > from); //Always prefer shortest release paths (e.g. 1->3 vs. 1->2->3) by ensuring we check smallest from values first - smallerFromList.sort(); + smallerFromList.sort((a, b) => (a < b) ? -1 : (a > b) ? 1 : 0); for (let i = 0, il = smallerFromList.length; i < il; i += 1) { const interim = smallerFromList[i]; - //FIXME: This sometimes causes a "Maximum call stack size exceeded" error, e.g. for `{ product: '*', from: 1, to: 11 }` const releasePath = findReleasePath({ product, from, to: interim} ); if (releasePath.length > 0) { return [...releasePath, [interim, to]];