From 0ed741dbc3f5aa9540041c87c131392f6354cd56 Mon Sep 17 00:00:00 2001 From: Lasse Meland Date: Sat, 18 Jun 2022 15:55:46 +0200 Subject: [PATCH] Fix minor styling issues --- src/cli.ts | 98 ++++++++++++++++++++-------------------- src/utils/writeToDisk.ts | 2 +- 2 files changed, 49 insertions(+), 51 deletions(-) diff --git a/src/cli.ts b/src/cli.ts index a8159a5..44ff263 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -7,56 +7,54 @@ import { LIB_PREFIX } from './constats'; import chalk from 'chalk'; import { syncLocales } from './index'; -const options = yargs - .usage('i18next-locales-sync -p en -s de ja he -l ./path/to/locales -sp 2') - .option({ - primaryLanguage: { - alias: 'p', - type: 'string', - description: 'The primary (source) language', - default: 'en', - }, - secondaryLanguages: { - alias: 's', - description: 'A list of all other supported languages', - type: 'array', - default: [], - }, - localesFolder: { - alias: 'l', - description: 'The locals folder path (can be relative)', - type: 'string', - normalize: true, - }, - outputFolder: { - alias: 'o', - description: 'The output folder', - defaultDescription: '`localesFolder`', - type: 'string', - normalize: true, - }, - config: { - alias: 'c', - description: 'A path to the config file', - type: 'string', - normalize: true, - }, - useEmptyString: { - alias: 'e', - description: 'Use empty string as a value for new keys', - type: 'boolean', - normalize: true, - default: false, - defaultDescription: '`false`', - }, - spaces: { - alias: 'sp', - description: 'Number of indentation spaces in json output', - type: 'number', - normalize: true, - default: 2, - }, - }).argv; +const options = yargs.usage('i18next-locales-sync -p en -s de ja he -l ./path/to/locales').option({ + primaryLanguage: { + alias: 'p', + type: 'string', + description: 'The primary (source) language', + default: 'en', + }, + secondaryLanguages: { + alias: 's', + description: 'A list of all other supported languages', + type: 'array', + default: [], + }, + localesFolder: { + alias: 'l', + description: 'The locals folder path (can be relative)', + type: 'string', + normalize: true, + }, + outputFolder: { + alias: 'o', + description: 'The output folder', + defaultDescription: '`localesFolder`', + type: 'string', + normalize: true, + }, + config: { + alias: 'c', + description: 'A path to the config file', + type: 'string', + normalize: true, + }, + useEmptyString: { + alias: 'e', + description: 'Use empty string as a value for new keys', + type: 'boolean', + normalize: true, + default: false, + defaultDescription: '`false`', + }, + spaces: { + alias: 'sp', + description: 'Number of indentation spaces in json output', + type: 'number', + normalize: true, + default: 2, + }, +}).argv; if (options.config) { options.config = path.resolve(options.config); diff --git a/src/utils/writeToDisk.ts b/src/utils/writeToDisk.ts index b3ebab8..1cefbd2 100644 --- a/src/utils/writeToDisk.ts +++ b/src/utils/writeToDisk.ts @@ -40,7 +40,7 @@ export function writeToDisk({ ) { fs.ensureFileSync(outputFilePath); fs.writeJSONSync(outputFilePath, otherLanguageLocaleFile.data, { - spaces: spaces, + spaces, encoding: 'utf-8', }); }