From 0e2235f20f92940d0ccd9665fd8fe90768410ad9 Mon Sep 17 00:00:00 2001 From: Thijs Koerselman Date: Thu, 28 Nov 2024 18:20:51 +0100 Subject: [PATCH] Use assert --- src/lib/utils/pack.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lib/utils/pack.ts b/src/lib/utils/pack.ts index 114381e..0527ebc 100644 --- a/src/lib/utils/pack.ts +++ b/src/lib/utils/pack.ts @@ -1,3 +1,4 @@ +import assert from "node:assert"; import { exec } from "node:child_process"; import fs from "node:fs"; import path from "node:path"; @@ -49,9 +50,9 @@ export async function pack(srcDir: string, dstDir: string) { }); const lastLine = stdout.trim().split("\n").at(-1); - if (!lastLine) { - throw new Error(`Failed to parse last line from stdout: ${stdout.trim()}`); - } + + assert(lastLine, `Failed to parse last line from stdout: ${stdout.trim()}`); + const fileName = path.basename(lastLine); const filePath = path.join(dstDir, fileName);