Files
hyperframes/packages/cli/src/utils/outputFolder.ts
T
Miguel Ángel 50ce9fb514 fix(cli): an output in a drive root (D:\) no longer fails before it is written on Windows (#7151)
* fix(cli): an output in a drive root (D:\) no longer fails before it is written on Windows

* fix(cli): keep the output folder helper's reason in its test

* fix(cli): make the output folder only when nothing is there, as the producer does

* fix(cli): keep the output folder's directory check and fix the stat mock that hid isDirectory
2026-11-04 10:47:39 +00:00

8 lines
264 B
TypeScript

import { mkdirSync, statSync } from "node:fs";
const isFolder = (dir: string) => statSync(dir, { throwIfNoEntry: false })?.isDirectory() === true;
export function makeOutputFolder(dir: string): void {
if (!isFolder(dir)) mkdirSync(dir, { recursive: true });
}