From 37ac9f607c1a63e954751a14e5aceb54df6d1f35 Mon Sep 17 00:00:00 2001 From: Michael Zetterberg Date: Mon, 14 Apr 2025 11:50:54 +0200 Subject: [PATCH] feat(SW-706): load .env.local for download and upload --- apps/scandic-web/.env.local.example | 2 ++ apps/scandic-web/i18n/tooling/download.ts | 5 ++++- apps/scandic-web/i18n/tooling/upload.ts | 5 ++++- packages/design-system/package.json | 1 - yarn.lock | 3 +-- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/apps/scandic-web/.env.local.example b/apps/scandic-web/.env.local.example index 4a2278a48..b63130ed3 100644 --- a/apps/scandic-web/.env.local.example +++ b/apps/scandic-web/.env.local.example @@ -70,3 +70,5 @@ SAS_API_ENDPOINT="" SAS_AUTH_ENDPOINT="" SAS_OCP_APIM="" SAS_AUTH_CLIENTID="" + +LOKALISE_API_KEY="" diff --git a/apps/scandic-web/i18n/tooling/download.ts b/apps/scandic-web/i18n/tooling/download.ts index 5d8b4c24a..16209224f 100644 --- a/apps/scandic-web/i18n/tooling/download.ts +++ b/apps/scandic-web/i18n/tooling/download.ts @@ -1,10 +1,13 @@ import path from "node:path" -import { download } from "./lokalise" +import { config } from "dotenv" + +config({ path: `${process.cwd()}/.env.local` }) const extractPath = path.resolve(__dirname, "translations") async function main() { + const { download } = await import("./lokalise") await download(extractPath) } diff --git a/apps/scandic-web/i18n/tooling/upload.ts b/apps/scandic-web/i18n/tooling/upload.ts index 5381b86c6..ee332bbc7 100644 --- a/apps/scandic-web/i18n/tooling/upload.ts +++ b/apps/scandic-web/i18n/tooling/upload.ts @@ -1,10 +1,13 @@ import path from "node:path" -import { upload } from "./lokalise" +import { config } from "dotenv" + +config({ path: `${process.cwd()}/.env.local` }) const filepath = path.resolve(__dirname, "./extracted.json") async function main() { + const { upload } = await import("./lokalise") await upload(filepath) } diff --git a/packages/design-system/package.json b/packages/design-system/package.json index 1aad0512e..2c7f0f564 100644 --- a/packages/design-system/package.json +++ b/packages/design-system/package.json @@ -157,7 +157,6 @@ "framer-motion": "^11.3.28", "glob": "^11.0.1", "husky": "^9.1.7", - "jiti": "^1", "lint-staged": "^15.4.1", "material-symbols": "^0.29.0", "prettier": "^3.4.2", diff --git a/yarn.lock b/yarn.lock index 3b8865489..f150986cf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6323,7 +6323,6 @@ __metadata: framer-motion: "npm:^11.3.28" glob: "npm:^11.0.1" husky: "npm:^9.1.7" - jiti: "npm:^1" lint-staged: "npm:^15.4.1" material-symbols: "npm:^0.29.0" prettier: "npm:^3.4.2" @@ -15031,7 +15030,7 @@ __metadata: languageName: node linkType: hard -"jiti@npm:^1, jiti@npm:^1.21.0": +"jiti@npm:^1.21.0": version: 1.21.7 resolution: "jiti@npm:1.21.7" bin: