From 8a66197ad88d59f8ab820f1daa16ff24977922b9 Mon Sep 17 00:00:00 2001 From: "monada-bot[bot]" Date: Mon, 22 Apr 2024 19:55:18 +0000 Subject: [PATCH] chore: self mutation (build.diff) Signed-off-by: monada-bot[bot] --- libs/wingsdk/src/platform/platform-manager.ts | 4 +++- libs/wingsdk/src/target-sim/platform.ts | 4 ++-- libs/wingsdk/test/target-sim/secret.test.ts | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/libs/wingsdk/src/platform/platform-manager.ts b/libs/wingsdk/src/platform/platform-manager.ts index becd17b6777..f4c957272c3 100644 --- a/libs/wingsdk/src/platform/platform-manager.ts +++ b/libs/wingsdk/src/platform/platform-manager.ts @@ -150,7 +150,9 @@ export class PlatformManager { public async storeSecrets(secrets: Record): Promise { const hooks = collectHooks(this.platformInstances); if (!hooks.storeSecretsHook) { - throw new Error(`Cannot find a platform or platform extension that supports storing secrets`); + throw new Error( + `Cannot find a platform or platform extension that supports storing secrets` + ); } await hooks.storeSecretsHook(secrets); } diff --git a/libs/wingsdk/src/target-sim/platform.ts b/libs/wingsdk/src/target-sim/platform.ts index fdef259d76f..112fcd8c869 100644 --- a/libs/wingsdk/src/target-sim/platform.ts +++ b/libs/wingsdk/src/target-sim/platform.ts @@ -1,7 +1,7 @@ import fs from "fs"; +import { join } from "path"; import { App } from "./app"; import { IPlatform } from "../platform"; -import { join } from "path"; /** * Sim Platform @@ -17,7 +17,7 @@ export class Platform implements IPlatform { public async storeSecrets(secrets: Record): Promise { let existingSecretsContent = ""; const envFile = join(process.env.WING_SOURCE_DIR!, ".env"); - + try { existingSecretsContent = fs.readFileSync(envFile, "utf8"); } catch (error) {} diff --git a/libs/wingsdk/test/target-sim/secret.test.ts b/libs/wingsdk/test/target-sim/secret.test.ts index 037d8436c28..a0a94ceb83b 100644 --- a/libs/wingsdk/test/target-sim/secret.test.ts +++ b/libs/wingsdk/test/target-sim/secret.test.ts @@ -45,7 +45,7 @@ describe("secrets", () => { new cloud.Secret(app, "my_secret", { name: "wing-sim-test-my-secret", }); - + await fs.writeFile(SECRETS_FILE, "wing-sim-test-my-secret=secret-value"); const secretsContent = fs.readFileSync(SECRETS_FILE, "utf-8"); @@ -71,4 +71,4 @@ function tryParse(content: string): string | undefined { } catch (err) { return undefined; } -} \ No newline at end of file +}