mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-21 03:04:28 +00:00
feat(config): add PI_PACKAGE_DIR env var to override package path (#1153)
This commit is contained in:
parent
8306b3bc20
commit
0e49235af0
1 changed files with 8 additions and 0 deletions
|
|
@ -31,6 +31,14 @@ export const isBunRuntime = !!process.versions.bun;
|
||||||
* - For tsx (src/): returns parent directory (the package root)
|
* - For tsx (src/): returns parent directory (the package root)
|
||||||
*/
|
*/
|
||||||
export function getPackageDir(): string {
|
export function getPackageDir(): string {
|
||||||
|
// Allow override via environment variable (useful for Nix/Guix where store paths tokenize poorly)
|
||||||
|
const envDir = process.env.PI_PACKAGE_DIR;
|
||||||
|
if (envDir) {
|
||||||
|
if (envDir === "~") return homedir();
|
||||||
|
if (envDir.startsWith("~/")) return homedir() + envDir.slice(1);
|
||||||
|
return envDir;
|
||||||
|
}
|
||||||
|
|
||||||
if (isBunBinary) {
|
if (isBunBinary) {
|
||||||
// Bun binary: process.execPath points to the compiled executable
|
// Bun binary: process.execPath points to the compiled executable
|
||||||
return dirname(process.execPath);
|
return dirname(process.execPath);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue