fix(49492): restore alphabetical sort of packages (#52021)

Unwated artefact of #49492 was a change in the order of no longer needed
pacakges from alphabetical sort to chronological (desc)

This commit restores the alphabetical sort.

Thanks!

/cc @jablko @andrewbranch
This commit is contained in:
Piotr Błażejewicz (Peter Blazejewicz)
2021-03-26 20:02:43 +01:00
committed by GitHub
parent 9136269c01
commit 78f0288bd8
2 changed files with 15 additions and 8 deletions

View File

@@ -1,3 +1,4 @@
/// <reference lib="esnext"/>
// Script to remove a package from DefinitelyTyped and add it to notNeededPackages.json
const fs = require("fs");
@@ -13,8 +14,14 @@ if (process.argv.length !== 4 && process.argv.length !== 5) {
}
rmdirRecursive(path.join("types", typingsPackageName));
/** @type {{packages: Record<string, { libraryName: string; asOfVersion: string; }> }} */
const notNeededPackages = JSON.parse(fs.readFileSync("notNeededPackages.json", "utf-8"));
notNeededPackages.packages[typingsPackageName] = { libraryName, asOfVersion };
const sortedPackages = Object.entries(notNeededPackages.packages).sort((packageA, packageB) =>
packageA[0].localeCompare(packageB[0]),
);
notNeededPackages.packages = Object.fromEntries(sortedPackages);
fs.writeFileSync("notNeededPackages.json", JSON.stringify(notNeededPackages, undefined, 4) + "\n", "utf-8");
function rmdirRecursive(dir) {