From bf46d471204c7cc202afc0524cd944d9f5e85e2d Mon Sep 17 00:00:00 2001 From: Masaharu Tashiro Date: Thu, 16 Oct 2025 21:52:38 +0900 Subject: [PATCH 1/2] feat: automatically create output directory with `--sea` option --- lib/sea.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/sea.ts b/lib/sea.ts index c637453c..2e9f4928 100644 --- a/lib/sea.ts +++ b/lib/sea.ts @@ -1,6 +1,6 @@ import { exec as cExec } from 'child_process'; import util from 'util'; -import { basename, dirname, join, resolve } from 'path'; +import path, { basename, dirname, join, resolve } from 'path'; import { copyFile, writeFile, rm, mkdir, stat, readFile } from 'fs/promises'; import { createWriteStream } from 'fs'; import { pipeline } from 'stream/promises'; @@ -308,8 +308,7 @@ async function bake( ); if (!(await exists(dirname(outPath)))) { - log.error(`Output directory "${dirname(outPath)}" does not exist`); - return; + await mkdir(path.dirname(outPath), { recursive: true }); } // check if executable_path exists if (await exists(outPath)) { From 8822c41c50a5b8744a0604a0d6838569d22cdd34 Mon Sep 17 00:00:00 2001 From: Masaharu Tashiro Date: Thu, 16 Oct 2025 22:03:27 +0900 Subject: [PATCH 2/2] refactor: use named imported dirname function --- lib/sea.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sea.ts b/lib/sea.ts index 2e9f4928..bf811e2f 100644 --- a/lib/sea.ts +++ b/lib/sea.ts @@ -1,6 +1,6 @@ import { exec as cExec } from 'child_process'; import util from 'util'; -import path, { basename, dirname, join, resolve } from 'path'; +import { basename, dirname, join, resolve } from 'path'; import { copyFile, writeFile, rm, mkdir, stat, readFile } from 'fs/promises'; import { createWriteStream } from 'fs'; import { pipeline } from 'stream/promises'; @@ -308,7 +308,7 @@ async function bake( ); if (!(await exists(dirname(outPath)))) { - await mkdir(path.dirname(outPath), { recursive: true }); + await mkdir(dirname(outPath), { recursive: true }); } // check if executable_path exists if (await exists(outPath)) {