fix: auto-load .env, resolves #2987

This commit is contained in:
Amruth Pillai
2026-05-08 11:57:59 +02:00
parent 2cd774dab7
commit 26ca5c29c3
13 changed files with 129 additions and 18 deletions
+15
View File
@@ -0,0 +1,15 @@
import { realpathSync } from "node:fs";
import { dirname, join } from "node:path";
import { findUpSync } from "find-up";
export const findWorkspaceRoot = (cwd = process.cwd()) => {
const workspaceManifestPath = findUpSync("pnpm-workspace.yaml", { cwd: realpathSync(cwd) });
return workspaceManifestPath ? dirname(workspaceManifestPath) : null;
};
export const getLocalDataDirectory = (cwd = process.cwd()) => {
const workspaceRoot = findWorkspaceRoot(cwd);
return join(workspaceRoot ?? realpathSync(cwd), "data");
};