1 Star 5 Fork 1

汪磊 / caz

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
complete.ts 737 Bytes
一键复制 编辑 原始数据 按行查看 历史
汪磊 提交于 2020-07-31 14:52 . feat: update complete fallback
import { Context } from './types'
/**
* Fallback complete hook
*/
export const fallback = async (ctx: Context): Promise<void> => {
console.log(`Created a new project in \`${ctx.project}\` by the \`${ctx.template}\` template.\n`)
ctx.files.map(i => i.path).sort((a, b) => a > b ? +1 : -1).forEach(i => console.log('- ' + i))
console.log('\nHappy hacking :)')
}
/**
* Apply template complete hook.
*/
export default async (ctx: Context): Promise<void> => {
if (ctx.config.complete == null) {
return await fallback(ctx)
}
if (typeof ctx.config.complete === 'string') {
return console.log(ctx.config.complete)
}
const result = await ctx.config.complete(ctx)
if (result == null) return
console.log(result)
}
TypeScript
1
https://gitee.com/zce/caz.git
git@gitee.com:zce/caz.git
zce
caz
caz
master

搜索帮助