mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-07-27 10:24:48 +10:00
fix: auto-load .env, resolves #2987
This commit is contained in:
@@ -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");
|
||||
};
|
||||
Reference in New Issue
Block a user