From 0a88beaf5b7fab99de7501f03bf8a8827abe242c Mon Sep 17 00:00:00 2001 From: Vadim Velicodnii Date: Tue, 21 Jul 2026 14:57:47 +0100 Subject: [PATCH] fix(config): stop appending blank lines --- config.ts | 2 +- tests/config.test.ts | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/config.ts b/config.ts index 2a82774..c575728 100644 --- a/config.ts +++ b/config.ts @@ -395,7 +395,7 @@ async function writeConfig( await Deno.writeTextFile( configContent.config?.path ?? join(Deno.cwd(), "deno.jsonc"), - config.toString() + "\n", + config.toString(), ); if (!configContent.config) { diff --git a/tests/config.test.ts b/tests/config.test.ts index b5365d0..315e936 100644 --- a/tests/config.test.ts +++ b/tests/config.test.ts @@ -95,6 +95,29 @@ Deno.test("deploy preserves comments and formatting (jsonc)", async () => { assertStringIncludes(out, "// and this one"); }); +Deno.test("deploy does not append a blank line on repeated updates", async () => { + const input = `{ + "deploy": { + "org": "old-org", + "app": "my-app" + } +} +`; + const expected = `{ + "deploy": { + "org": "my-org", + "app": "my-app" + } +} +`; + + const once = await runDeploy(input, { org: "my-org", app: "my-app" }); + const twice = await runDeploy(once, { org: "my-org", app: "my-app" }); + + assertEquals(once, expected); + assertEquals(twice, expected); +}); + // Regression: a read-only command (one that never touches `config.files`) must // NOT trigger the recursive deploy-manifest file walk. Before the lazy-`files` // fix, `actionHandler` eagerly walked the whole working directory, so commands