From 81169894f3c232f4e9f2e07be3329bc49fc2195f Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Wed, 30 Dec 2020 17:22:27 +0100 Subject: [PATCH] Sort all.json inside build (#40) --- package.json | 1 + scripts/sortAll.mjs | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 scripts/sortAll.mjs diff --git a/package.json b/package.json index 3f3b24db8..12fe21189 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ }, "scripts": { "build": "polkadot-dev-build-ts", + "build:extra": "node scripts/sortAll.mjs", "build:release": "polkadot-ci-ghact-build --skip-beta", "lint": "polkadot-dev-run-lint", "clean": "polkadot-dev-clean-build", diff --git a/scripts/sortAll.mjs b/scripts/sortAll.mjs new file mode 100644 index 000000000..3e7c98299 --- /dev/null +++ b/scripts/sortAll.mjs @@ -0,0 +1,14 @@ +// Copyright 2020 @polkadot/phishing authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +import fs from 'fs'; + +function sortSection (values) { + return values.sort((a, b) => a.localeCompare(b)); +} + +const original = JSON.parse(fs.readFileSync('all.json', 'utf-8')); +const allow = sortSection(original.allow); +const deny = sortSection(original.deny); + +fs.writeFileSync('all.json', JSON.stringify({ allow, deny }, null, 2));