浏览代码

ci: ensure that lang files stay sorted

factor2
Christoph Settgast 3 年前
父节点
当前提交
a84130d67d
共有 3 个文件被更改,包括 11 次插入0 次删除
  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 查看文件

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 查看文件

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 查看文件

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

正在加载...
取消
保存