@amazon-codecatalyst/blueprint-component.workflows

中文文档
0.3.159发布于 2026/08/24Apache-2.0TypeScriptCommonJS近 30 天下载 6799

This is a representation of a codecatalyst workflow.

原始使用文档
文档目录4 节
  1. What is a workflow component?
  2. Example 1: WorkflowBuilder component
  3. Example 2: Workflow projen component
  4. Connecting to an environment
import {...} from '@amazon-codecatalyst/blueprint-component.workflows'

The workflow component can be found here.

What is a workflow component?

A workflow is used by CodeCatalyst projects to execute some actions based off triggers. The blueprints team exposes some helpful workflows components that are meant to help in building and putting together workflow yaml files. See public workflows documentation for general use.

import { WorkflowBuilder, Workflow } from '@amazon-codecatalyst/blueprint-component.workflows'

Example 1: WorkflowBuilder component

This is a class that helps build a workflow definition. This can then be given over to a workflow component for rendering in a repository.

import { WorkflowBuilder } from '@amazon-codecatalyst/blueprint-component.workflows'

const workflowBuilder = new WorkflowBuilder({} as Blueprint, {
  Name: 'my_workflow',
});

// trigger the workflow on pushes to branch 'main'
workflowBuilder.addBranchTrigger(['main']);

// add a build action
workflowBuilder.addBuildAction({
  // give the action a name
  actionName: 'build_and_do_some_other_stuff',

  // the action pulls from source code
  input: {
    Sources: ['WorkflowSource'],
  },

  // the output attempts to autodiscover test reports, but not in the node modules
  output: {
    AutoDiscoverReports: {
      Enabled: true,
      ReportNamePrefix: AutoDiscovered,
      IncludePaths: ['**/*'],
      ExcludePaths: ['*/node_modules/**/*'],
    },
  },
  // execute some arbitrary steps
  steps: [
    'npm install',
    'npm run myscript',
    'echo hello-world',
  ],
  // add an account connection to the workflow
  environment: convertToWorkflowEnvironment(myEnv),
});

Example 2: Workflow projen component

This is a projen component that writes a workflow yaml to a repository.

import { Workflow } from '@amazon-codecatalyst/blueprint-component.workflows'

...

const repo = new SourceRepository
const blueprint = this;
const workflowDef = workflowBuilder.getDefinition()

// creates a workflow.yaml at .aws/workflows/${workflowDef.name}.yaml
new Workflow(blueprint, repo, workflowDef);

// can also pass in any object and have it rendered as a yaml. This is unsafe and may not produce a valid workflow
new Workflow(blueprint, repo, {... some object ...});

Connecting to an environment

Many workflows need to run in an AWS account connection. Workflows deal with this by allowing actions to connect to environments, with account and role name specifications.

import { convertToWorkflowEnvironment } from '@amazon-codecatalyst/blueprint-component.workflows'


const myEnv = new Environment(...);

// can be passed into a workflow constructor
const workflowEnvironment = convertToWorkflowEnvironment(myEnv);


// add a build action
workflowBuilder.addBuildAction({
  ...
  // add an account connection to the workflow
  environment: convertToWorkflowEnvironment(myEnv),
});

版本与发布记录

@amazon-codecatalyst/blueprint-component.workflows 共发布 159 个版本,首次发布于 2023/09/26;过去 12 个月发布了 4 个版本。

版本发布日期距今
0.3.159latest2026/08/242 个月前
0.3.1582026/08/222 个月前
0.3.1572026/08/152 个月前
0.3.1562026/07/074 个月前
0.3.1552025/01/081.8 年前
0.3.1542024/10/022 年前

关于 @amazon-codecatalyst/blueprint-component.workflows 的常见问题

@amazon-codecatalyst/blueprint-component.workflows 是什么?

This is a representation of a codecatalyst workflow.

如何安装 @amazon-codecatalyst/blueprint-component.workflows?

在项目目录运行 npm install @amazon-codecatalyst/blueprint-component.workflows,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@amazon-codecatalyst/blueprint-component.environments(*)、@amazon-codecatalyst/blueprint-component.source-repositories(*)、@amazon-codecatalyst/blueprints.blueprint(*)、projen(*)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@amazon-codecatalyst/blueprint-component.workflows 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@amazon-codecatalyst/blueprint-component.workflows 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@amazon-codecatalyst/blueprint-component.workflows 可以商用吗?

@amazon-codecatalyst/blueprint-component.workflows 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@amazon-codecatalyst/blueprint-component.workflows 的下载量有多少?

根据 npm 官方下载统计,@amazon-codecatalyst/blueprint-component.workflows 在 2026/10/06 – 2026/11/04 这 30 天内被下载 6,799 次,日均约 227 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@amazon-codecatalyst/blueprint-component.workflows 还在维护吗?

最新版本 0.3.159 发布于 2026/08/24(2 个月前);至今共发布 159 个版本,其中过去 12 个月发布了 4 个;首次发布于 2023/09/26。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。