git() — astro Function Reference
Architecture documentation for the git() function in git.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD b8e2bfc1_004d_846a_3dd7_e51b44d009ea["git()"] 86455456_bee6_f020_bc22_ec5ab2dbdbe1["git.ts"] b8e2bfc1_004d_846a_3dd7_e51b44d009ea -->|defined in| 86455456_bee6_f020_bc22_ec5ab2dbdbe1 4ebcb86a_c096_d7e6_00c4_0fd19877bf72["init()"] b8e2bfc1_004d_846a_3dd7_e51b44d009ea -->|calls| 4ebcb86a_c096_d7e6_00c4_0fd19877bf72 style b8e2bfc1_004d_846a_3dd7_e51b44d009ea fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/create-astro/src/actions/git.ts lines 8–46
export async function git(
ctx: Pick<Context, 'cwd' | 'git' | 'yes' | 'prompt' | 'dryRun' | 'tasks'>,
) {
if (fs.existsSync(path.join(ctx.cwd, '.git'))) {
await info('Nice!', `Git has already been initialized`);
return;
}
let _git = ctx.git ?? ctx.yes;
if (_git === undefined) {
({ git: _git } = await ctx.prompt({
name: 'git',
type: 'confirm',
label: title('git'),
message: `Initialize a new git repository?`,
hint: 'optional',
initial: true,
}));
}
if (ctx.dryRun) {
await info('--dry-run', `Skipping Git initialization`);
} else if (_git) {
ctx.tasks.push({
pending: 'Git',
start: 'Git initializing...',
end: 'Git initialized',
while: () =>
init({ cwd: ctx.cwd }).catch((e) => {
error('error', e);
process.exit(1);
}),
});
} else {
await info(
ctx.yes === false ? 'git [skip]' : 'Sounds good!',
`You can always run ${color.reset('git init')}${color.dim(' manually.')}`,
);
}
}
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does git() do?
git() is a function in the astro codebase, defined in packages/create-astro/src/actions/git.ts.
Where is git() defined?
git() is defined in packages/create-astro/src/actions/git.ts at line 8.
What does git() call?
git() calls 1 function(s): init.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free