From 9fc997c898f5806fa8a841597966547fd371db90 Mon Sep 17 00:00:00 2001 From: vantezzen Date: Fri, 27 Mar 2020 12:17:22 +0100 Subject: Add sorting package list alphabetically --- scripts/package.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'scripts/package.js') diff --git a/scripts/package.js b/scripts/package.js index 90a05a9..a241edc 100644 --- a/scripts/package.js +++ b/scripts/package.js @@ -92,6 +92,13 @@ Please make sure it contains: id, name, config`); console.log('No package with ID found - creating new.'); all.push(packageInfo); } + + // Sort package list alphabetically + all = all.sort((a, b) => { + var textA = a.id.toLowerCase(); + var textB = b.id.toLowerCase(); + return (textA < textB) ? -1 : (textA > textB) ? 1 : 0; + }); await fs.writeJson(allJson, all, { spaces: 2, EOL: '\n', -- cgit v1.2.3-54-g00ecf