forked from withastro/astro
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d2187d
commit 6a59531
Showing
20 changed files
with
412 additions
and
301 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import type { Context } from "./context"; | ||
import fs from 'node:fs'; | ||
import path from 'node:path'; | ||
import type { Context } from './context'; | ||
|
||
import { color } from '@astrojs/cli-kit'; | ||
import { title, info, spinner } from '../messages.js'; | ||
import { execa } from 'execa'; | ||
import { info, spinner, title } from '../messages.js'; | ||
|
||
export async function git(ctx: Pick<Context, 'cwd'|'git'|'yes'|'prompt'|'dryRun'>) { | ||
export async function git(ctx: Pick<Context, 'cwd' | 'git' | 'yes' | 'prompt' | 'dryRun'>) { | ||
if (fs.existsSync(path.join(ctx.cwd, '.git'))) { | ||
await info('Nice!', `Git has already been initialized`); | ||
return | ||
return; | ||
} | ||
let _git = ctx.git ?? ctx.yes; | ||
if (_git === undefined) { | ||
|
@@ -43,6 +43,15 @@ async function init({ cwd }: { cwd: string }) { | |
try { | ||
await execa('git', ['init'], { cwd, stdio: 'ignore' }); | ||
await execa('git', ['add', '-A'], { cwd, stdio: 'ignore' }); | ||
await execa('git', ['commit', '-m', 'Initial commit from Astro', '--author="houston[bot] <[email protected]>"'], { cwd, stdio: 'ignore' }); | ||
await execa( | ||
'git', | ||
[ | ||
'commit', | ||
'-m', | ||
'Initial commit from Astro', | ||
'--author="houston[bot] <[email protected]>"', | ||
], | ||
{ cwd, stdio: 'ignore' } | ||
); | ||
} catch (e) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.