From 6b07186078b412ede4eff57b9491593ece747dcc Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 11 Jul 2019 12:45:06 -0600 Subject: [PATCH 1/2] Verify i18n in CI --- .buildkite/pipeline.yaml | 9 +++++++++ package.json | 1 + scripts/compare-file.js | 10 ++++++++++ 3 files changed, 20 insertions(+) create mode 100644 scripts/compare-file.js diff --git a/.buildkite/pipeline.yaml b/.buildkite/pipeline.yaml index 3cab4e0fb3a..dee18e49cb3 100644 --- a/.buildkite/pipeline.yaml +++ b/.buildkite/pipeline.yaml @@ -44,3 +44,12 @@ steps: plugins: - docker#v3.0.1: 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" \ No newline at end of file diff --git a/package.json b/package.json index aa2290b1adc..c1fe79e14c3 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "reskindex:watch": "reskindex -h src/header -w", "i18n": "matrix-gen-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:modernizr": "modernizr -c .modernizr.json -d src/vector/modernizr.js", "build:compile": "yarn reskindex && babel --source-maps -d lib src", diff --git a/scripts/compare-file.js b/scripts/compare-file.js new file mode 100644 index 00000000000..f53275ebfa6 --- /dev/null +++ b/scripts/compare-file.js @@ -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"); +} From c22e03a222be0d02832fc84dd77ec0f58f6aa196 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 11 Jul 2019 12:47:50 -0600 Subject: [PATCH 2/2] Fetch deps --- .buildkite/pipeline.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.buildkite/pipeline.yaml b/.buildkite/pipeline.yaml index dee18e49cb3..46ec4edc615 100644 --- a/.buildkite/pipeline.yaml +++ b/.buildkite/pipeline.yaml @@ -47,8 +47,10 @@ steps: - label: "🌐 i18n" command: - # Do the things needed to actually run the i18n stuff + - "echo '--- Fetching Dependencies'" + - "./scripts/fetch-develop.deps.sh --depth 1" - "yarn install" + - "echo '+++ Testing i18n output'" - "yarn diff-i18n" plugins: - docker#v3.0.1: