-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add extract translations job to check workflow and add a wrapp…
…er to exit on extract error
- Loading branch information
1 parent
2cadeb1
commit 5ce4873
Showing
2 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Wrapper around lingui command that exits with a non zero value if an error is detected. Lingui commands do not fail with a non-zero exit code in some cases. There is an open issue here: https://github.com/lingui/js-lingui/issues/1419 | ||
const { exec } = require('child_process'); | ||
|
||
const args = process.argv.splice(2); | ||
const command = `yarn lingui ${args.join(' ')}`; | ||
|
||
const handleLinguiCommand = function (error, stdout, stderr) { | ||
if (error) { | ||
// Handle exec command error (lingui command not found?) | ||
console.log(`error: ${error}`); | ||
throw error; | ||
} | ||
// Display command standard output | ||
console.log(`stdout: ${stdout}`); | ||
// Display command standard error | ||
console.log(`stderr: ${stderr}`); | ||
const errorExists = stderr?.trim() !== '✔'; | ||
process.exit(errorExists ? 1 : 0); | ||
}; | ||
exec(command, handleLinguiCommand); |