chore(db): harden workspace env wrappers
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
import { existsSync, readFileSync } from "node:fs";
|
||||
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
||||
import { dirname, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
function resolveWorkspaceRoot() {
|
||||
export function resolveWorkspaceRoot() {
|
||||
return resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
||||
}
|
||||
|
||||
export function resolveRealWorkspaceRoot() {
|
||||
return realpathSync(resolveWorkspaceRoot());
|
||||
}
|
||||
|
||||
export function resolveWorkspaceEnvPath(options = {}) {
|
||||
const { workspaceRoot = resolveWorkspaceRoot() } = options;
|
||||
return resolve(workspaceRoot, ".env");
|
||||
|
||||
Reference in New Issue
Block a user