@amazon-codecatalyst/blueprint-component.environments

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

This is a representation of a codecatalyst environment.

原始使用文档
文档目录4 节
  1. Example 1: Creating development environments
  2. Example 2: A simple mock interface
  3. Example 3: A more complicated mock interface
  4. Example 4: A complete mock interface
import {...} from '@amazon-codecatalyst/blueprint-component.environments'

The environment component can be found here.

The blueprint wizard is dynamically generated from the Options interface exposed through the [[wizard|https://github.com/aws/codecatalyst-blueprints/wiki/Wizard]]. Blueprints supports generating UI components from exposed types.

Example 1: Creating development environments

export interface Options extends ParentOptions {
    ...
    myNewEnvironment:  EnvironmentDefinition<{
        thisIsMyFirstAccountConnection: AccountConnection<{
            thisIsARole: Role<['lambda', 's3', 'dynamo']>;
        }>;
    }>;
}

This allows authors to deploy their applications to the cloud.

The above interface will generate a UI component that asks for a new Environment myNewEnvironment with a single account connection thisIsMyFirstAccountConnection and a role on that account connection thisIsARole with ['lambda', 's3', 'dynamo'] as the minimum required role capabilities. Since not all users will have account connections, it is important to check for the case where a user does not connect an account, and does not connect an account with a role either. This is reflected accurately in the type definition.

Roles can also be annotated with @inlinePolicies per the documentation here.

The environment component requires a name and an environmentType. The minimal required default shape looks like this:

{
  ...
  "myNewEnvironment": {
    "name": "myProductionEnvironment",
    "environmentType": "PRODUCTION"
  },
}

The UI component will then prompt the user for various fields and as they fill in those fields the blueprint will get a fully expanded shape. It is sometimes helpful to include the full 'mock' (see the below examples) in the defaults.json for testing and development purposes.

Example 2: A simple mock interface

{
    ...
    "thisIsMyEnvironment": {
        "name": "myProductionEnvironment",
        "environmentType": "PRODUCTION",
        "thisIsMySecondAccountConnection": {
            "id": "12345678910",
            "name": "my-account-connection-name",
            "secondAdminRole": {
                "arn": "arn:aws:iam::12345678910:role/ConnectedCodecatalystRole",
                "name": "ConnectedCodecatalystRole",
                "capabilities": [
                    "lambda",
                    "s3",
                    "dynamo"
                ]
            }
        }
    }
}

Example 3: A more complicated mock interface

export interface Options extends ParentOptions {
  /**
   * The name of an environment
   * @displayName This is a Environment Name
   * @collapsed
   */
  thisIsMyEnvironment: EnvironmentDefinition<{
    /**
     * blah blah blah some comments about the account that i'm deploying into
     * @displayName This account connection has an overriden name
     * @collapsed
     */
    thisIsMyFirstAccountConnection: AccountConnection<{
      /**
       * Blah blah some information about the role that I expect
       * e.g. here's a copy-pastable policy: [to a link]
       * @displayName This role has an overriden name
       */
      adminRole: Role<['admin', 'lambda', 's3', 'cloudfront']>;
      /**
       * Blah blah some information about the second role that I expect
       * e.g. here's a copy-pastable policy: [to a link]
       */
      lambdaRole: Role<['lambda', 's3']>;
    }>;
    /**
     * blah blah blah some comments about the account that i'm deploying into
     */
    thisIsMySecondAccountConnection: AccountConnection<{
      /**
         * Blah blah some information about the role that I expect
         * e.g. here's a copy-pastable policy: [to a link]
         */
      secondAdminRole: Role<['admin', 'lambda', 's3', 'cloudfront']>;
      /**
         * Blah blah some information about the second role that I expect
         * e.g. here's a copy-pastable policy: [to a link]
         */
      secondLambdaRole: Role<['lambda', 's3']>;
    }>;
  }>;
}

Example 4: A complete mock interface

{
  ...
  "thisIsMyEnvironment": {
    "name": "my-production-environment",
    "environmentType": "PRODUCTION",
    "thisIsMySecondAccountConnection": {
      "id": "12345678910",
      "name": "my-connected-account",
      "secondAdminRole": {
        "name": "LambdaCodecatalystRole",
        "arn": "arn:aws:iam::12345678910:role/LambdaCodecatalystRole",
        "capabilities": [
          "admin",
          "lambda",
          "s3",
          "cloudfront"
        ]
      },
      "secondLambdaRole": {
        "name": "LambdaCodecatalystRole",
        "arn": "arn:aws:iam::12345678910:role/LambdaCodecatalystRole",
        "capabilities": [
          "lambda",
          "s3"
        ]
      }
    },
    "thisIsMyFirstAccountConnection": {
      "id": "12345678910",
      "name": "my-connected-account",
      "adminRole": {
        "name": "LambdaCodecatalystRole",
        "arn": "arn:aws:iam::12345678910:role/LambdaCodecatalystRole",
        "capabilities": [
          "admin",
          "lambda",
          "s3",
          "cloudfront"
        ]
      },
      "lambdaRole": {
        "name": "LambdaCodecatalystRole",
        "arn": "arn:aws:iam::12345678910:role/LambdaCodecatalystRole",
        "capabilities": [
          "lambda",
          "s3"
        ]
      }
    }
  },
}

版本与发布记录

@amazon-codecatalyst/blueprint-component.environments 共发布 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.environments 的常见问题

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

This is a representation of a codecatalyst environment.

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

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

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

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

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

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

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

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

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

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

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

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