mirror of
https://github.com/PR0M3TH3AN/TORCH.git
synced 2026-10-27 07:51:52 +00:00
Always prefer parent torch-config in repo/torch mode
This commit is contained in:
1 parent
f56bbb5a0f
commit
8894d40a01
1 file changed
+1
-14
+1
-14
@@ -71,21 +71,8 @@ export function getTorchConfigPath() {
|
||||
const localPath = path.resolve(process.cwd(), DEFAULT_CONFIG_PATH);
|
||||
const parentPath = path.resolve(process.cwd(), '..', DEFAULT_CONFIG_PATH);
|
||||
const cwdBaseName = path.basename(process.cwd());
|
||||
const parentPkgPath = path.resolve(process.cwd(), '..', 'package.json');
|
||||
let parentLooksLikeHostRepo = false;
|
||||
|
||||
try {
|
||||
if (fs.existsSync(parentPkgPath)) {
|
||||
const parentPkgRaw = fs.readFileSync(parentPkgPath, 'utf8');
|
||||
const parentPkg = JSON.parse(parentPkgRaw);
|
||||
parentLooksLikeHostRepo = parentPkg && typeof parentPkg.name === 'string' && parentPkg.name !== 'torch-lock';
|
||||
}
|
||||
} catch {
|
||||
parentLooksLikeHostRepo = false;
|
||||
}
|
||||
|
||||
// Host-repo mode: when running from "<repo>/torch", prefer parent config.
|
||||
if (cwdBaseName === 'torch' && parentLooksLikeHostRepo && fs.existsSync(parentPath)) {
|
||||
if (cwdBaseName === 'torch' && fs.existsSync(parentPath)) {
|
||||
return parentPath;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user