From 95c5b3731d079bd1aabdfcbfd077b3b9b169d30e Mon Sep 17 00:00:00 2001 From: Christiaan Scheermeijer Date: Fri, 12 Apr 2024 11:06:10 +0200 Subject: [PATCH] chore: move sync script to root --- knip.config.ts | 1 - package.json | 3 ++- platforms/web/package.json | 1 - .../i18next/sync-translations.ts | 24 ++++++++++++------- 4 files changed, 18 insertions(+), 11 deletions(-) rename {platforms/web/scripts => scripts}/i18next/sync-translations.ts (87%) diff --git a/knip.config.ts b/knip.config.ts index aed1bf371..0e53a9c71 100644 --- a/knip.config.ts +++ b/knip.config.ts @@ -18,7 +18,6 @@ const config: KnipConfig = { 'global', 'start:test', 'codecept:*', - 'i18next', ], }, 'packages/common': { diff --git a/package.json b/package.json index b8464ea34..98fa3e5d2 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,8 @@ "format:prettier": "prettier --write \"{**/*,*}.{js,ts,jsx,tsx}\"", "format:stylelint": "stylelint --fix '**/*.{css,scss}'", "i18next-diff": "npx ts-node ./scripts/i18next/diff-translations", - "i18next-update": "npx ts-node ./scripts/i18next/update-translations.ts && yarn i18next", + "i18next-update": "npx ts-node ./scripts/i18next/update-translations.ts && yarn web i18next", + "i18next:sync": "npx ts-node ./scripts/i18next/sync-translations.ts", "lint": "run-p -c lint:*", "lint:eslint": "eslint \"{**/*,*}.{js,ts,jsx,tsx}\"", "lint:prettier": "prettier --check \"{**/*,*}.{js,ts,jsx,tsx}\"", diff --git a/platforms/web/package.json b/platforms/web/package.json index c1331436a..a2661e281 100644 --- a/platforms/web/package.json +++ b/platforms/web/package.json @@ -15,7 +15,6 @@ "codecept:mobile": "cd test-e2e && rm -rf \"./output/mobile\" && codeceptjs run-workers --suites ${WORKER_COUNT:=8} --config ./codecept.mobile.cjs", "generate-pwa-assets": "pwa-assets-generator", "i18next": "npx ts-node ./scripts/i18next/parse-translations.ts", - "i18next:sync": "npx ts-node ./scripts/i18next/sync-translations.ts", "lint:ts": "tsc --pretty --noEmit -p ./ && tsc --pretty --noEmit -p ./test-e2e", "serve-report:desktop": "cd test-e2e && allure serve \"./output/desktop\"", "serve-report:mobile": "cd test-e2e && allure serve \"./output/mobile\"", diff --git a/platforms/web/scripts/i18next/sync-translations.ts b/scripts/i18next/sync-translations.ts similarity index 87% rename from platforms/web/scripts/i18next/sync-translations.ts rename to scripts/i18next/sync-translations.ts index e01338531..49886c6be 100644 --- a/platforms/web/scripts/i18next/sync-translations.ts +++ b/scripts/i18next/sync-translations.ts @@ -17,7 +17,7 @@ function flattenObject(obj: Trans, parentKey: string = ''): Record> = {}; - const sourcePlatformPath = join(process.cwd(), '../', sourcePlatform); - const targetPlatformPath = join(process.cwd(), '../', targetPlatform); + const sourcePlatformPath = join(process.cwd(), 'platforms', sourcePlatform); + const targetPlatformPath = join(process.cwd(), 'platforms', targetPlatform); if (!existsSync(sourcePlatformPath)) { console.error(`Source platform doesn't exist ${sourcePlatformPath}`);