@architect/destroy

中文文档
6.0.1发布于 2025/11/29Apache-2.0CommonJS近 30 天下载 1.1万

Destroy projects created with Architect

原始使用文档
文档目录6 节
  1. @architect/destroy
  2. Testing
  3. Running Tests
  4. Test Structure
  5. API
  6. destroy({ appname, stackname, env, force, now, retries, cre…

@architect/destroy

Architect serverless framework module for destroying projects created with Architect

GitHub CI status

Architect Destroy destroys Architect-generated projects. More specifically, it destroys your projects' CloudFormation Stacks, CloudWatch Log Groups, S3 bucket used during deployment, SSM Parameters added by arc env, and if called with --force (or the force param via API), destroys your DynamoDB (@tables) databases and S3 bucket housing your static assets (@static).

Testing

This project uses Node.js's native test runner (node:test) for all testing. The test suite includes unit tests and integration tests.

Running Tests

# Run linter and unit tests
npm test

# Run only unit tests
npm run test:unit

# Run only integration tests
npm run test:integration

# Run tests with coverage report
npm run coverage

Test Structure

Tests are organized in the test/ directory:

  • test/unit/ - Unit tests for individual modules
  • test/integration/ - Integration tests for end-to-end scenarios
  • test/helpers/ - Shared test utilities and mock helpers

For detailed information about writing tests, mock patterns, and testing best practices, see TESTING.md.

API

destroy({ appname, stackname, env, force, now, retries, credentials, quiet, region }, callback)

Destroys all infrastructure associated to your Architect app.

  • appname: the name of the Architect app in question as defined in your app.arc file.
  • stackname: the custom stack name (if specified during deployment, e.g. arc deploy --name foo)
  • env: the stage or environment name to destroy, typical values are staging or production
  • force proceeds to destroy your app even if it contains DynamoDB tables and / or an S3 bucket containing @static assets.
  • now: (boolean) immeditely destroy the app (instead of waiting the requisite 5 seconds)
  • retries: while waiting for a CloudFormation Stack to be destroyed, how many times do we ping the CloudFormation API checking if the Stack has been removed? This API is pinged every 10 seconds. If retries is exhausted, callback will be invoked with an error.
  • credentials: (object) AWS credentials object with accessKeyId, secretAccessKey, and optionally sessionToken
  • quiet: (boolean) suppress status output during destruction
  • region: (string) provide region override

版本与发布记录

@architect/destroy 共发布 69 个版本,首次发布于 2020/06/23;过去 12 个月发布了 4 个版本。

版本发布日期距今
6.0.1latest2025/11/2911 个月前
6.0.02025/11/2811 个月前
6.0.0-RC.0RC2025/11/2611 个月前
5.0.22025/11/1011 个月前
5.0.12025/09/261.1 年前
5.0.02025/09/251.1 年前

关于 @architect/destroy 的常见问题

@architect/destroy 是什么?

Destroy projects created with Architect

如何安装 @architect/destroy?

在项目目录运行 npm install @architect/destroy,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 arc-destroy,可以用 npx arc-destroy 直接运行。

@architect/destroy 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/architect__destroy 是否存在。

@architect/destroy 支持 ESM 还是 CommonJS?

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

@architect/destroy 需要什么版本的 Node.js?

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

@architect/destroy 可以商用吗?

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

@architect/destroy 的下载量有多少?

根据 npm 官方下载统计,@architect/destroy 在 2026/10/07 – 2026/11/05 这 30 天内被下载 10,973 次,日均约 366 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@architect/destroy 还在维护吗?

最新版本 6.0.1 发布于 2025/11/29(11 个月前);至今共发布 69 个版本,其中过去 12 个月发布了 4 个;首次发布于 2020/06/23。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。