Files
toir-automatization/tools/lib/project-root.mjs
2026-04-07 19:40:41 +03:00

16 lines
447 B
JavaScript

/**
* Resolve the KIS-TOiR project root directory.
*
* Works from any module file in the tools/ directory by walking up
* relative to __dirname.
*/
import path from "node:path";
import { fileURLToPath } from "node:url";
export function getProjectRoot() {
const __dirname = path.dirname(fileURLToPath(import.meta.url));
// From tools/lib, go up two levels: ../.. = project root
return path.resolve(path.join(__dirname, "..", ".."));
}