为了方便开发,一般初始化项目时都会使用 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);};
更多?
工具目前支持CLI
与VSCode Extension
进行执行,脚本支持yaml
/js
/ts
您可以查看文档了解更多如果您想看更多的实例,可以访问仓库查看并运行如果您已经感兴趣,那麽可以快速开始