mirror of https://github.com/boxyhq/jackson.git
added locale-check to ci/cd
This commit is contained in:
parent
2e6fa98888
commit
8086541dc1
|
@ -141,6 +141,7 @@ jobs:
|
|||
- run: npm install
|
||||
- run: npm run check-lint
|
||||
- run: npm run check-format
|
||||
- run: npm run locale-check
|
||||
- run: npm run build
|
||||
- run: npm run test
|
||||
working-directory: ./npm
|
||||
|
|
|
@ -10,6 +10,8 @@ const localeFile = require('./locales/en/common.json');
|
|||
const files = fs.readdirSync('./', { recursive: true, withFileTypes: true });
|
||||
//console.log('files:', files);
|
||||
|
||||
let error = false;
|
||||
|
||||
files.forEach((file) => {
|
||||
if (file.isDirectory()) {
|
||||
return;
|
||||
|
@ -26,6 +28,7 @@ files.forEach((file) => {
|
|||
// console.log('match:', match);
|
||||
allStrings[id] = true;
|
||||
if (!localeFile[id]) {
|
||||
error = true;
|
||||
console.error(`Missing key: ${path.join(file.path, file.name)} - ${id}`);
|
||||
}
|
||||
});
|
||||
|
@ -35,6 +38,7 @@ files.forEach((file) => {
|
|||
// console.log('match:', match, id);
|
||||
allStrings[id] = true;
|
||||
if (!localeFile[id]) {
|
||||
error = true;
|
||||
console.error(`Missing key: ${path.join(file.path, file.name)} - ${id}`);
|
||||
}
|
||||
});
|
||||
|
@ -43,6 +47,11 @@ files.forEach((file) => {
|
|||
|
||||
Object.keys(localeFile).forEach((key) => {
|
||||
if (!allStrings[key]) {
|
||||
error = true;
|
||||
console.error(`Unused key: ${key}`);
|
||||
}
|
||||
});
|
||||
|
||||
if (error) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,8 @@
|
|||
"check-types": "tsc --pretty --noEmit",
|
||||
"check-format": "prettier --check .",
|
||||
"check-lint": "next lint && eslint -c .eslintrc.js --ext ts --ext tsx --ext js ./",
|
||||
"format": "prettier --write ."
|
||||
"format": "prettier --write .",
|
||||
"locale-check": "node locale-check.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@boxyhq/metrics": "0.2.6",
|
||||
|
|
Loading…
Reference in New Issue