nx/packages/workspace/src/utilities/default-base.ts
Miroslav Jonaš 15d83258fe
feat(core): move git commit from generators to create-nx-workspace (#11633)
* fix(core): move git commit to create-nx-workspace

* fix(core): add git init to create-nx-plugin
2022-08-18 18:40:46 -04:00

14 lines
288 B
TypeScript

import { execSync } from 'child_process';
export function deduceDefaultBase(): string {
const nxDefaultBase = 'main';
try {
return (
execSync('git config --get init.defaultBranch').toString().trim() ||
nxDefaultBase
);
} catch {
return nxDefaultBase;
}
}