1 Star 5 Fork 1

汪磊 / caz

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
init.ts 710 Bytes
一键复制 编辑 原始数据 按行查看 历史
汪磊 提交于 2020-12-07 14:54 . feat(core): exec command util
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.
}
TypeScript
1
https://gitee.com/zce/caz.git
git@gitee.com:zce/caz.git
zce
caz
caz
master

搜索帮助