fix: prevent argv check on "add-missing-keys-to-other-language" module import

This commit is contained in:
Alireza Ayinmehr 2022-04-13 00:31:32 +04:30
parent ed49650a31
commit 3122052a4b

View File

@ -63,16 +63,16 @@ const addMissingKeys = async lang => {
translationFiles.forEach(addMissingKeyForSingleFile);
};
if (process.argv.length < 3) {
console.warn(
chalk.yellow(
'Please provide a language. For example:\nnode scripts/front/add-missing-keys-to-other-language.js vi'
)
);
process.exit(1);
}
if (require.main === module) {
if (process.argv.length < 3) {
console.warn(
chalk.yellow(
'Please provide a language. For example:\nnode scripts/front/add-missing-keys-to-other-language.js vi'
)
);
process.exit(1);
}
addMissingKeys(process.argv[2]).catch(err => console.error(err));
}