Issue
the function isRepo tests for the existence of the .git folder. In case of mixed repositories the nx workspace might not contain the .git but its located within a git repository.
export function isRepo(): boolean {
return fs.existsSync('.git');
}
a probably better aproach will be running the git command that returns true
git rev-parse --is-inside-work-tree
Suggestion for the solution:
import { execSync } from "child_process";
function isRepo(): boolean {
try {
execSync("git rev-parse --is-inside-work-tree", { stdio: "ignore" });
return true;
} catch (error) {
return false;
}
}