1 Star 5 Fork 1

汪磊/caz

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
init.ts 709 Bytes
一键复制 编辑 原始数据 按行查看 历史
汪磊 提交于 2022-03-24 18:33 . v1.0.0 (#93)
import { exec, config } from './core'
import { Context } from './types'
/**
* Execute `git init && git add && git commit` command.
*/
export default async (ctx: Context): Promise<void> => {
// init === false or not contains `.gitignore`
if (!(ctx.config.init ?? ctx.files.find(i => i.path === '.gitignore') != null)) return
// Initializing git repository...
try {
const options = { cwd: ctx.dest, stdio: 'inherit' as 'inherit' }
await exec('git', ['init'], options)
await exec('git', ['add', '--all'], options)
await exec('git', ['commit', '-m', config.commitMessage], options)
} catch (e) {
throw new Error('Initial repository failed.')
}
// Initial repo completed.
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
TypeScript
1
https://gitee.com/zce/caz.git
git@gitee.com:zce/caz.git
zce
caz
caz
main

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385