Skip to content

Commit

Permalink
Add check in rekey script to protect against clobbering existing keys
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy committed Sep 29, 2023
1 parent b9895c5 commit aa4cdb5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scripts/rekey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ const translation = _.get(sourceTranslations, oldPath);
if (!translation) {
throw new Error(`"${argv._[0]}" key not present in source translations`);
}
if (_.get(sourceTranslations, newPath)) {
throw new Error(`"${argv._[1]}" key already present in source translations`);
}

function updateTranslations(translations: Translations): void {
const value = _.get(translations, oldPath);
Expand Down

0 comments on commit aa4cdb5

Please sign in to comment.