Verify i18n in CI

This commit is contained in:
Travis Ralston 2019-07-11 12:45:06 -06:00
parent bba167c433
commit 6b07186078
3 changed files with 20 additions and 0 deletions

View file

@ -44,3 +44,12 @@ steps:
plugins: plugins:
- docker#v3.0.1: - docker#v3.0.1:
image: "node:10" image: "node:10"
- label: "🌐 i18n"
command:
# Do the things needed to actually run the i18n stuff
- "yarn install"
- "yarn diff-i18n"
plugins:
- docker#v3.0.1:
image: "node:10"

View file

@ -30,6 +30,7 @@
"reskindex:watch": "reskindex -h src/header -w", "reskindex:watch": "reskindex -h src/header -w",
"i18n": "matrix-gen-i18n", "i18n": "matrix-gen-i18n",
"prunei18n": "matrix-prune-i18n", "prunei18n": "matrix-prune-i18n",
"diff-i18n": "cp src/i18n/strings/en_EN.json src/i18n/strings/en_EN_orig.json && yarn i18n && node scripts/compare-file.js src/i18n/strings/en_EN_orig.json src/i18n/strings/en_EN.json",
"build:res": "node scripts/copy-res.js", "build:res": "node scripts/copy-res.js",
"build:modernizr": "modernizr -c .modernizr.json -d src/vector/modernizr.js", "build:modernizr": "modernizr -c .modernizr.json -d src/vector/modernizr.js",
"build:compile": "yarn reskindex && babel --source-maps -d lib src", "build:compile": "yarn reskindex && babel --source-maps -d lib src",

10
scripts/compare-file.js Normal file
View file

@ -0,0 +1,10 @@
const fs = require("fs");
if (process.argv.length < 4) throw new Error("Missing source and target file arguments");
const sourceFile = fs.readFileSync(process.argv[2], 'utf8');
const targetFile = fs.readFileSync(process.argv[3], 'utf8');
if (sourceFile !== targetFile) {
throw new Error("Files do not match");
}