Skip to content

Commit 3d89e9e

Browse files
committed
scripts/sync-i18n-files.ts: rework lodash import
Don't use require-style imports, and scope the imports to only the methods we are using.
1 parent 452f0e2 commit 3d89e9e

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

scripts/sync-i18n-files.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@ import {
99

1010
import { Command } from 'commander';
1111
import { stringify } from 'json5';
12+
import {
13+
isEmpty,
14+
isEqual,
15+
} from 'lodash';
1216

1317
import { projectRoot } from '../webpack/helpers';
1418

1519
const _cliProgress = require('cli-progress');
16-
const _ = require('lodash');
1720

1821
const program = new Command();
1922
program.version('1.0.0', '-v, --version');
@@ -212,13 +215,13 @@ function createNewChunkComparingSourceAndTarget(correspondingTargetChunk, source
212215
if (oldKeyValueInTargetComments != null) {
213216
const oldKeyValueUncommented = getSubStringWithRegex(oldKeyValueInTargetComments[0], '".*')[0];
214217

215-
if (!(_.isEmpty(correspondingTargetChunk) && _.isEmpty(commentSource)) && !removeWhiteLines(correspondingTargetChunk).includes(removeWhiteLines(commentSource.trim()))) {
218+
if (!(isEmpty(correspondingTargetChunk) && isEmpty(commentSource)) && !removeWhiteLines(correspondingTargetChunk).includes(removeWhiteLines(commentSource.trim()))) {
216219
commentsOfSourceHaveChanged = true;
217220
newChunk.push(COMMENTS_CHANGED_TODO);
218221
}
219222
const parsedOldKey = stringify('{' + oldKeyValueUncommented + '}');
220223
const parsedSourceKey = stringify('{' + keyValueSource + '}');
221-
if (!_.isEqual(parsedOldKey, parsedSourceKey)) {
224+
if (!isEqual(parsedOldKey, parsedSourceKey)) {
222225
messageOfSourceHasChanged = true;
223226
newChunk.push(MESSAGE_CHANGED_TODO);
224227
}

0 commit comments

Comments
 (0)