使用任意 git 仓库初始化项目 - `Code Recycle`

为了方便开发,一般初始化项目时都会使用 git 上的模板仓库想了解某个项目的功能时,可能会去运行这个仓库下的某个实例或者仓库下某个文件夹内提供了一些文件模板用来限定一些模块的初始化上面三种场景,我们都需要拉取仓库,但是有时候只需要拉取仓库的一部分,这时候不妨使用Code Recycle,通过几行配置进行自定义拉取

全部拉取

changeList:  - type: copy    from: https://github.com/maximegris/angular-electron.git    to: ./ae    source: git

部分拉取

changeList:  - type: copy    from:       url: https://github.com/microsoft/vscode-extension-samples.git      match:        - /l10n-sample      output: /l10n-sample    to: ./l10n    source: git

拉取模板生成

module.exports = async (util, rule, host, injector) => {  let list = await util.changeList([    {      type: 'copy',      source: 'git',      from: {        url: 'https://github.com/angular/angular-cli.git',        match: '/packages/schematics/angular/directive/files',        output: '/packages/schematics/angular/directive/files',      },      pathTemplate: '@angular-devkit',      contentTemplate: '@angular-devkit',      pathTemplateSuffix: '.template',      templateContext: { name: 'hello', standalone: true, selector: 'hello', 'if-flat': (input) => '' },      to: './hello-directive'    },  ]);  await util.updateChangeList(list);};

更多?

工具目前支持CLIVSCode Extension进行执行,脚本支持yaml/js/ts您可以查看文档了解更多如果您想看更多的实例,可以访问仓库查看并运行如果您已经感兴趣,那麽可以快速开始

关于作者: 网站小编

码农网专注IT技术教程资源分享平台,学习资源下载网站,58码农网包含计算机技术、网站程序源码下载、编程技术论坛、互联网资源下载等产品服务,提供原创、优质、完整内容的专业码农交流分享平台。

热门文章