MCPcopy
hub / github.com/remix-run/react-router / gitInitStep

Function gitInitStep

packages/create-react-router/index.ts:517–546  ·  view source on GitHub ↗
(ctx: Context)

Source from the content-addressed store, hash-verified

515}
516
517async function gitInitStep(ctx: Context) {
518 if (!ctx.git) {
519 return;
520 }
521
522 if (existsSync(path.join(ctx.cwd, ".git"))) {
523 log("");
524 info("Nice!", `Git has already been initialized`);
525 return;
526 }
527
528 log("");
529 await loadingIndicator({
530 start: "Git initializing...",
531 end: "Git initialized",
532 while: async () => {
533 let options = { cwd: ctx.cwd, stdio: "ignore" } as const;
534 let commitMsg = "Initial commit from create-react-router";
535 try {
536 await runCommand("git", ["init"], options);
537 await runCommand("git", ["add", "."], options);
538 await runCommand("git", ["commit", "-m", commitMsg], options);
539 } catch (err) {
540 error("Oh no!", "Failed to initialize git.");
541 throw err;
542 }
543 },
544 ctx,
545 });
546}
547
548async function doneStep(ctx: Context) {
549 let projectDir = path.relative(process.cwd(), ctx.cwd);

Callers

nothing calls this directly

Calls 5

logFunction · 0.90
infoFunction · 0.90
errorFunction · 0.90
loadingIndicatorFunction · 0.85
runCommandFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…