@amazon-web-services-cloudformation/cloudformation-cli-typescript-lib

中文文档
1.0.6发布于 2024/07/19Apache License 2.0TypeScriptCommonJS近 30 天下载 1.1万

CloudFormation 资源提供方开发 Kit(RPDK) 允许您撰写您自己的资源提供方, 供 CloudFormation 使用 。 此插件库有助于通过 CloudFormation 为您的提供者的执行提供运行时间绑定 .

中文使用文档
文档目录4 节
  1. AWS 云格式资源提供者类型脚本插件
  2. 使用量
  3. 发展
  4. 许可证

AWS 云格式资源提供者打字插件

我们兴奋地分享我们的进步,在"云阵CLI"中加入新的语言!

AWS 云格式资源提供者类型脚本插件

GitHub Workflow Status Codecov PyPI version NPM version Node.js version

CloudFormation CLI (cfn) 允许您编写自己的可供 CloudFormation 使用的资源提供者 .

此插件库帮助提供 TypeScript 运行时间绑定, 通过 CloudFormation 执行您的提供者 .

使用量

如果您正在使用此软件包为 CloudFormation 构建资源提供者, 请安装 云格式 CLI 类型脚本插件 - 这将自动安装 云阵 CLI推荐 Python 虚拟环境 .

先决条件

  • Python 版本 3.6 或以上
  • 萨姆CLI
  • 您选择类型脚本 IDE

安装

pip3 install cloudformation-cli-typescript-plugin

参见 云格式 CLI 用户指南 联 合 国 云阵 CLI 用于使用指令.

怎么样

示例运行 :

$ cfn init
Initializing new project
What's the name of your resource type?
(Organization::Service::Resource)
>> Foo::Bar::Baz
Select a language for code generation:
[1] java
[2] typescript
(enter an integer):
>> 2
Use docker for platform-independent packaging (Y/n)?
This is highly recommended unless you are experienced
with cross-platform Typescript packaging.
>> y
Initialized a new project in <>
$ cfn submit --dry-run
$ sam local invoke --event sam-tests/create.json TestEntrypoint

发展

对于插件的修改,推荐一个Python虚拟环境. 检查并安装可编辑模式的插件 :

python3 -m venv env
source env/bin/activate
pip3 install -e /path/to/cloudformation-cli-typescript-plugin

你也许也想看看 云阵 CLI 如果您想要编辑此内容。 在这种情况下,将它们安装在一次操作中效果良好:

pip3 install \
  -e /path/to/cloudformation-cli \
  -e /path/to/cloudformation-cli-typescript-plugin

这可以确保两个都无意中从PyPI安装.

对于打字机库"@amazon-web- services-cloudform/cloudform-cli-typescript-lib"的修改,将所编译的Javascript:

npm run build
npm pack

您可以在 Cfn 资源工程中安装 :

npm install ../path/to/cloudformation-cli-typescript-plugin/amazon-web-services-cloudformation-cloudformation-cli-typescript-lib-1.0.1.tgz

固定和运行单元测试通过 承诺前,在安装后自动执行(pre-commit install) (中文(简体) ). 持续整合还进行这些检查。 手动选项可供选择,所以不需要执行:

# run all hooks on all files, mirrors what the CI runs
pre-commit run --all-files
# run unit tests only. can also be used for other hooks, e.g. black, flake8, pylint-local
pre-commit run pytest-local

许可证

这个库根据Apache 2.0许可证获得许可.

版本与发布记录

@amazon-web-services-cloudformation/cloudformation-cli-typescript-lib 共发布 7 个版本,首次发布于 2021/04/09;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.6latest2024/07/192 年前
1.0.52023/10/273 年前
1.0.42023/02/253 年前
1.0.32022/08/184 年前
1.0.22022/08/094 年前
1.0.12021/04/095 年前

关于 @amazon-web-services-cloudformation/cloudformation-cli-typescript-lib 的常见问题

@amazon-web-services-cloudformation/cloudformation-cli-typescript-lib 是什么?

CloudFormation 资源提供方开发 Kit(RPDK) 允许您撰写您自己的资源提供方, 供 CloudFormation 使用 。 此插件库有助于通过 CloudFormation 为您的提供者的执行提供运行时间绑定 .

如何安装 @amazon-web-services-cloudformation/cloudformation-cli-typescript-lib?

在项目目录运行 npm install @amazon-web-services-cloudformation/cloudformation-cli-typescript-lib,或使用 pnpm add / yarn add / bun add。

@amazon-web-services-cloudformation/cloudformation-cli-typescript-lib 支持 TypeScript 吗?

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

@amazon-web-services-cloudformation/cloudformation-cli-typescript-lib 支持 ESM 还是 CommonJS?

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

@amazon-web-services-cloudformation/cloudformation-cli-typescript-lib 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@amazon-web-services-cloudformation/cloudformation-cli-typescript-lib 可以商用吗?

@amazon-web-services-cloudformation/cloudformation-cli-typescript-lib 使用 Apache License 2.0 许可。声明的许可为 Apache License 2.0,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@amazon-web-services-cloudformation/cloudformation-cli-typescript-lib 的下载量有多少?

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

@amazon-web-services-cloudformation/cloudformation-cli-typescript-lib 还在维护吗?

最新版本 1.0.6 发布于 2024/07/19(2 年前);至今共发布 7 个版本,其中过去 12 个月发布了 0 个;首次发布于 2021/04/09。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。