Skip to main content

内置行动

Scaffolder 自带多个内置操作,用于获取内容、在目录中注册,当然还有创建和发布 git 仓库的操作。

开箱即支持多个版本库提供商,如 GitHub、Azure、GitLab 和 Bitbucket。

所有已登记行动的清单可在以下栏目中找到/create/actions如需了解当地的发展情况,您可以通过以下方式联系他们http://localhost:3000/create/actions.

fetch:cookiecutter迁移到fetch:template

fetch:template动作是一个新动作,其 API 与fetch:cookiecutter但不依赖于cookiecutter在迁移模板时,有两个选项可以使用fetch:cookiecutter使用fetch:template:

使用 cookiecutterCompat 模式

新的fetch:template动作有一个cookiecutterCompat标记,它应该允许大多数为fetch:cookiecutter在不做任何更改的情况下工作。

  1. 更新 template.yaml 中的操作名称。 名称应从 fetch:cookiecutter 更改为 fetch:template。 2. 在 template.yaml 中的 fetch:template 步骤输入中将 cookiecutterCompat 设为 true
template.yaml
steps:
- id: fetch-base
name: Fetch Base
action: fetch:cookiecutter
action: fetch:template
input:
url: ./skeleton
cookiecutterCompat: true
values:

手动迁移

如果你愿意,可以手动迁移模板,以避免启用 cookiecutter 兼容模式,这样模板变量表达式的冗长程度会稍低一些。

  1. Update action name in template.yaml. The name should be changed from fetch:cookiecutter to fetch:template. 2. Update variable syntax in file names and content. fetch:cookiecutter expects variables to be enclosed in {{ }} and prefixed with cookiecutter., while fetch:template expects variables to be enclosed in ${{ }} and prefixed with values.. For example, a reference to variable myInputVariable would need to be migrated from {{ cookiecutter.myInputVariable }} to ${{ values.myInputVariable }}. 3. Replace uses of jsonify with dump. The jsonify filter is built in to cookiecutter, and is not available by default when using fetch:template. The dump filter is the equivalent filter in nunjucks, so an expression like {{ cookiecutter.myAwesomeList | jsonify }} should be migrated to `${{ values.myAwesomeList | dump }}