ci: ensure that lang files stay sorted

This commit is contained in:
Christoph Settgast 2022-01-20 12:44:08 +01:00 committed by Saúl Ibarra Corretgé
parent bd38df5d61
commit a84130d67d
3 changed files with 11 additions and 0 deletions

View File

@ -14,6 +14,8 @@ jobs:
- run: npm install
- name: Check git status
run: git status
- name: Normalize lang files to ensure sorted
run: npm run lang-sort
- name: Check git diff
run: git diff
- name: Check if the git repository is clean

View File

@ -174,6 +174,7 @@
"license": "Apache-2.0",
"scripts": {
"lint": "eslint --max-warnings 0 .",
"lang-sort": "./resources/lang-sort.sh",
"lint-fix": "eslint --max-warnings 0 --fix .",
"postinstall": "patch-package && jetify",
"validate": "npm ls",

8
resources/lang-sort.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash -e
for file in ./lang/*.json; do
echo "Sorting and standardizing ${file}"
t=$(mktemp)
jq --indent 4 -S "." "${file}" > "${t}"
mv "${t}" "${file}"
done