From 6d4083f20e0171bcbd1ebe4f30f5ae600aba680d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Sun, 21 Feb 2021 18:37:47 +0100 Subject: [PATCH] fix(wpt): order version keys alphabetically --- lib/wpt/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/wpt/index.js b/lib/wpt/index.js index fec5531d..222e4c48 100644 --- a/lib/wpt/index.js +++ b/lib/wpt/index.js @@ -94,10 +94,16 @@ class WPTUpdater { async updateVersions(updated) { const versionsPath = this.versionsPath; const readmePath = this.readmePath; - const versions = this.getLocalVersions(); + let versions = this.getLocalVersions(); this.cli.startSpinner('Updating versions.json ...'); Object.assign(versions, updated); + // Reorder keys alphabetically + versions = Object.fromEntries( + Object.entries(versions).sort(([key1], [key2]) => + key1.localeCompare(key2) + ) + ); writeJson(versionsPath, versions); this.cli.stopSpinner(`Updated ${versionsPath}`);