Browse Source

ci: ensure that lang files stay sorted

master
Christoph Settgast 3 years ago
parent
commit
a84130d67d
3 changed files with 11 additions and 0 deletions
  1. 2
    0
      .github/workflows/ci.yml
  2. 1
    0
      package.json
  3. 8
    0
      resources/lang-sort.sh

+ 2
- 0
.github/workflows/ci.yml View File

14
     - run: npm install
14
     - run: npm install
15
     - name: Check git status
15
     - name: Check git status
16
       run: git status
16
       run: git status
17
+    - name: Normalize lang files to ensure sorted
18
+      run: npm run lang-sort
17
     - name: Check git diff
19
     - name: Check git diff
18
       run: git diff
20
       run: git diff
19
     - name: Check if the git repository is clean
21
     - name: Check if the git repository is clean

+ 1
- 0
package.json View File

174
   "license": "Apache-2.0",
174
   "license": "Apache-2.0",
175
   "scripts": {
175
   "scripts": {
176
     "lint": "eslint  --max-warnings 0 .",
176
     "lint": "eslint  --max-warnings 0 .",
177
+    "lang-sort": "./resources/lang-sort.sh",
177
     "lint-fix": "eslint  --max-warnings 0 --fix .",
178
     "lint-fix": "eslint  --max-warnings 0 --fix .",
178
     "postinstall": "patch-package && jetify",
179
     "postinstall": "patch-package && jetify",
179
     "validate": "npm ls",
180
     "validate": "npm ls",

+ 8
- 0
resources/lang-sort.sh View File

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

Loading…
Cancel
Save