# @adobe/helix-deploy 中文文档

规范地址：https://npmcn.com/package/%40adobe/helix-deploy/

版本：14\.5\.4
npm 元数据更新时间：2026-10-27T07:14:47.473Z
中文译文更新时间：2026-11-06T00:55:51.870Z
软件包许可：Apache-2\.0

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40adobe/helix-deploy
原文对照：https://npmcn.com/package/%40adobe/helix-deploy/?lang=original
项目主页：https://github.com/adobe/helix-deploy#readme
源码仓库：https://github.com/adobe/helix-deploy

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：1.7 MB，39 个文件
- 模块格式：ES Module
- TypeScript 类型：未声明
- Node.js 要求：\>=18\.0
- 运行依赖：19 个
- peer 依赖：@adobe/helix-universal \>=5\.2\.1
- 首次发布：2020-12-10T10:24:21.073Z
- 最新版本发布：2026-10-27T07:14:46.897Z
- 近 30 天下载量：7644（2026-10-05 至 2026-11-03，npm 官方下载统计）
- 已发布版本数：587（近 12 个月 67 个）

## 中文简介

构建和部署 OpenWhisk 动作的库和命令行工具

## 安装

```sh
npm install @adobe/helix-deploy
```

也可以使用：`pnpm add @adobe/helix-deploy`、`yarn add @adobe/helix-deploy`、`bun add @adobe/helix-deploy`

## README

# 螺旋部署

> 一个用于运行在AWS Lambda,Adobe I/O Runtime,Azure函数,Google Cloud函数,Cloudflare Workers,和快速计算@Edge上的服务器和边缘计算函数的多云部署工具. 写一次,到处跑.

## 状态

[![GitHub license](https://img.shields.io/github/license/adobe/helix-deploy.svg)](https://github.com/adobe/helix-deploy/blob/main/LICENSE.txt) [![GitHub issues](https://img.shields.io/github/issues/adobe/helix-deploy.svg)](https://github.com/adobe/helix-deploy/issues) ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/adobe/helix-deploy/main.yaml) [![codecov](https://img.shields.io/codecov/c/github/adobe/helix-deploy.svg)](https://codecov.io/gh/adobe/helix-deploy)

## 设置

1.  将此包页添加为 dev 依赖 :
    
    ```console
    # Add OpenWhisk wrapper as dependency 
    npm add helix-deploy
    ```
    
2.  在您的软件包中添加构建脚本。 json:
    
    ```json
    "scripts": {
      "build": "./node_modules/.bin/hedy"
    }
    ```
    
3.  构建 OpenWhisk 动作
    
    ```console
    $ npm run build
    ...
    Created action: dist/my-example.zip.
    ```
    
4.  部署 OpenWhisk 动作
    
    ```console
    $ wsk action update ....
    ```
    

部署参数可在CLI中通过 `-p`. 见下文.

## 发展中国家

1.  安装依赖性一次 `npm install`。 。 。 .
2.  运行天线通过 `npm run lint`。 。 。 .
3.  运行单元测试套件 `npm test`。脚本运行 `c8 mocha -i -g Integration`,因此明确标记为"整合"的测试被跳过.

## 国 际

命令行接口 `hedy` 可以通过 `./node_modules/.bin/hedy`。 。 。 . 您也可以使用 npx: `npx hedy` 或在全球安装 `npm install -g helix-deploy`。 。 。 .

```console
$ hedy --help
General Options
  -v, --verbose  [boolean] [default: false]
      --directory  Project directory  [string] [default: "."]
      --version    Show version number  [boolean]

Operation Options
      --help            Show help  [boolean]
      --build           Build the deployment package  [boolean] [default: true]
      --deploy          Automatically deploy to specified targets  [boolean] [default: false]
      --test            Invoke action after deployment. Can be relative url or "true"  [string]
      --test-bundle     Invoke bundle after build. Can be relative url or "true". Defaults to the same as --test  [string]
      --update-package  Create or update package with params.  [boolean] [default: false]
  -l, --version-link    Create symlinks (sequences) after deployment. "major" and "minor" will create respective version links  [array]
      --delete          Delete the action from OpenWhisk. Implies no-build  [boolean] [default: false]
      --plugin          Specify bundler or deploy plugins.  [array] [default: []]

Build Options
      --minify                Minify the final bundle  [boolean] [default: false]
  -s, --static                Includes a static file into the archive  [array] [default: []]
      --entryFile             Specifies the entry file (the universal function).  [default: "src/index.js"]
      --externals             Defines the externals for the bundler (these dependencies will not be bundled).  [array] [default: []]
      --edge-externals        Defines the externals for the edge bundler (these dependencies will not be bundled for Cloudflare or Fastly).  [array] [default: []]
      --serverless-externals  Defines the externals for the serverless bundler (these dependencies will not be bundled for AWS Lambda or Google Cloud Functions).  [array] [default: []]
  -m, --modules               Include a node_module as is.  [array] [default: []]
      --adapterFile           Specifies the adapter file (the exported module).
      --esm                   Produce EcmaScript Module (experimental, disables edge arch)  [boolean] [default: false]
      --bundler
      --dist-directory        Specifies the dist (output) directory  [default: "dist"]

Deploy Options
      --target             Select target(s) for test, deploy, update-package actions (wsk,aws,google,auto)  [array] [default: ["auto"]]
      --hints, --no-hints  Show additional hints for deployment  [boolean] [default: true]

Test Options
      --target        Select target(s) for test, deploy, update-package actions (wsk,aws,google,auto)  [array] [default: ["auto"]]
      --test-params   Invoke openwhisk action after deployment with the given params.  [array] [default: []]
      --test-url      Test url to use after deployment, in case --test is not an url.  [string]
      --test-headers  Test headers to send in test requests.  [array] [default: []]

Link Options
      --target       Select target(s) for test, deploy, update-package actions (wsk,aws,google,auto)  [array] [default: ["auto"]]
      --linkPackage  Package name for version links  [string]

Update Package Options
      --package.params       OpenWhisk package params.  [array] [default: []]
      --package.params-file  OpenWhisk package params file.  [array] [default: []]

Cleanup Old Deployments: automatically delete redundant versions older than specified.
  Use a pattern like 7d or 1m to specify time frames.
  Use a simple number like --cleanup-ci=5 to retain the last five CI builds
      --cleanup-ci     Automatically delete redundant CI versions
      --cleanup-patch  Automatically delete redundant patch versions. At least one patch version for each minor version will be kept.
      --cleanup-minor  Automatically delete redundant minor versions. At least one minor version for each major version will be kept.
      --cleanup-major  Automatically delete redundant major versions.

General Action Options
      --name          Action name. Can be prefixed with package.
      --package.name  Action package name.  [string]
      --node-version  Specifies the node.js version to use in the serverless runtime  [default: "18"]
  -p, --params        Include the given action param. can be json or env.  [array] [default: []]
  -f, --params-file   Include the given action param from a file; can be json or env.  [array] [default: []]
      --updated-by    user that updated the action or sequence.  [string]
      --updated-at    unix timestamp when the action or sequence was updated (defaults to the current time).  [number] [default: 1719567952628]
      --web-secure    Annotates the action with require-whisk-auth. leave empty to generate random token.  [string]
  -t, --timeout       the timeout limit in milliseconds after which the action is terminated  [default: 60000]
      --pkgVersion    Version use in the embedded package.json.
      --memory        the maximum memory LIMIT in MB for the action
      --concurrency   the maximum intra-container concurrent activation LIMIT for the action

OpenWhisk Action Options
      --namespace       OpenWhisk namespace. Needs to match the namespace provided with the openwhisk credentials.
      --package.shared  OpenWhisk package scope.  [boolean] [default: false]

AWS Deployment Options
      --aws-region                the AWS region to deploy lambda functions to  [string] [default: ""]
      --aws-api                   the AWS API Gateway name. (id, "auto" or "create")  [string] [default: "auto"]
      --aws-role                  the AWS role ARN to execute lambda functions with  [string] [default: ""]
      --aws-cleanup-buckets
      --aws-cleanup-integrations  Cleans up unused integrations  [boolean] [default: false]
      --aws-cleanup-versions      Cleans up unused versions  [boolean] [default: false]
      --aws-create-routes         Create routes for function (usually not needed due to proxy function).  [boolean] [default: false]
      --aws-link-routes           Create or update routes, integrations, permissions, and authorizers when linking versions.  [boolean] [default: true]
      --aws-create-authorizer     Creates API Gateway authorizer using lambda authorization with this function and the specified name. The string can contain placeholders (note that all dots ('.') are replaced with underscores. Example: "helix-authorizer_${version}".  [string]
      --aws-attach-authorizer     Attach specified authorizer to routes during linking.  [string]
      --aws-lambda-format         Format to use to create lambda functions (note that all dots ('.') will be replaced with underscores.  [string] [default: "${packageName}--${baseName}"]
      --aws-parameter-manager     Manager to use for storing package params. (either "secret" for Secrets Manager or "system" for System Manager)  [array] [default: ["secret"]]
      --aws-deploy-template
      --aws-arch                  deployment architecture. either 'x86_64' or 'arm64'  [string] [default: "x86_64"]
      --aws-update-secrets        Uploads the function specific secrets with the params. defaults to /helix-deploy/{pkg}/{name}  [string]
      --aws-deploy-secrets        Name of a secret in the target account (in AWS Secrets Manager) holding the HLX_AWS_* environment variables to use for the deployment.  [string]
      --aws-deploy-bucket         Name of the deploy S3 bucket to use (default is helix-deploy-bucket-{accountId})  [string] [default: ""]
      --aws-identity-source       Identity source to used when creating the authorizer  [array] [default: ["$request.header.Authorization"]]
      --aws-log-format            The lambda log format. Can be either "JSON" or "Text".  [string]
      --aws-layers                List of layers ARNs to attach to the lambda function.  [array]
      --aws-tracing-mode          The lambda tracing mode. Can be either "Active" or "PassThrough".  [string]
      --aws-extra-permissions     A list of additional invoke permissions to add to the lambda function in the form <SourceARN>@<Principal>. Optionally, you can use <SourceARN>@<Principal>:<Alias> if you want to scope the permission to a specific alias.  [array]
      --aws-tags                  A list of additional tags to attach to the lambda function in the form key=value. To remove a tag, use key= (i.e. without a value).  [array]
      --aws-handler               Set custom lambda Handler. For example, set if an AWS layer provides another function entry point.  [string]
      --aws-ephemeral-storage     Size of the Lambda /tmp ephemeral storage in MB (512-10240).  [number] [default: 512]
      --aws-vpc-subnet-ids          List of VPC subnet IDs to attach the Lambda function to.  [array]
      --aws-vpc-security-group-ids  List of VPC security group IDs to attach the Lambda function to.  [array]

Google Deployment Options
      --google-project-id  the Google Cloud project to deploy to. Optional when the key file is a JSON file  [string] [default: ""]
      --google-key-file    full path to the a .json, .pem, or .p12 key downloaded from the Google Developers Console  [string] [default: ""]
      --google-email       the Google  account email address. Required when using a .pem or .p12 credential file  [string] [default: ""]

Options:
      --arch           Select archs(s) for bundles (node,edge).  [array] [default: ["node"]]
      --format         Action formats  [default: {"aws":"/${packageName}/${baseName}/${version}"}]
      --property       Additional properties that can be used in formats.  [default: {}]
      --package-token  Protects access to the gateway-stored package parameters with this token. leave empty to generate random token.  [string] [default: "2l8JumQIoX+SLQRc2eO2TUh1VO44/qh9KkL7VZO1T9k="]
      --google-region  the Google Cloud region to deploy in  [string] [default: ""]
```

没有争论 `hedy` 将代码捆入相应的 `action.zip`数字 :

### 自动部署到开怀斯克

当得到 `--deploy`,则 `wskbot` 将尝试使用来自 `~/.wskprops`或者,您也可以设置 `WSK_NAMESPACE`, (中文(简体) ), `WSK_AUTH`, (中文(简体) ), `WSK_APIHOST` 在你身边 环境或环境 `.env` 文档.

```console
$ hedy --deploy --no-hints
ok: created action: dist/my-example.zip.
ok: updated action tripod/my-example
```

### 自动 _测试_ 已部署的行动

为了快速测试部署的行动, `hedy` 可以发送 `GET` 请求动作 url.

```console
$ hedy --deploy --no-hints --test
ok: created action: dist/my-example.zip.
ok: updated action tripod/my-example
--: requesting: https://runtime.adobe.io/api/v1/web/tripod/default/my-example ...
ok: 200
```

页:1 `--test` 参数可以是相对的url,以防请求不应针对root url, 如:

```console
$ hedy --deploy --no-hints --test=/ping
ok: created action: dist/my-example.zip.
ok: updated action tripod/my-example
--: requesting: https://runtime.adobe.io/api/v1/web/tripod/default/my-example/ping ...
ok: 200
```

### 包括行动参数

行动参数可通过 `-p`,或者作为json 在env字符串, 或json或env文件.

实例:

```console
# specify as env string
hedy -p MY_TOKEN=1234 -p MY_PWD=foo

# specify as json string
hedy -p '{ "MY_TOKEN": 1234, "MY_PWD": "foo" }'

# specify as env file
hedy -f .env

# specify as json file
hedy -f params.json

# and a combination of the above
hedy -f .env -f params.json -p MY_TOKEN=123

# like in curl, you can include file contents with `@` (also works in .env or .json file)
hedy -p MY_TOKEN=@token.txt

```

### 在 `package.json`

您不通过命令行传递所有参数, 也可以在 `package.json` 输入 `hlx` 对象

```json
{
...
  "scripts": {
    "build": "./node_modules/.bin/hedy -v",
    "deploy": "./node_modules/.bin/hedy -v --deploy --test"
  },
  "hlx": {
    "name": "my-test-action",
    "params-file": [
      "secrets/secrets.env"
    ],
    "externals": [
      "fs-extra",
      "js-yaml",
      "dotenv",
      "bunyan",
      "bunyan-loggly",
      "bunyan-syslog",
      "bunyan-format"
    ],
    "docker": "adobe/probot-ow-nodejs8:latest"
  },
...
}
```

配置名称改为 `hlx` 版本中 `12.3`上一个名称 `wsk` 仍然被支持,但贬值。 如果两者都在场, `hlx` 将被使用.

### 修改您的动作

将动作名称与 `@version` 标注. 比如说

```json
"hlx": {
  "name": "my-action@4.3.1"
}
```

为了自动使用版本 `package.json` 使用:

```json
"hlx": {
  "name": "my-action@${version}"
}
```

> **说明**:该版本从内部取自 `pkgVersion` 变量,因此可以用 页:1 `--pkgVersion` 理由,如果应用不同,则采用不同方法.

### 参数中的环境变量内插

计外 `${version}` 参数将使用存在变量的环境变量进行插值。 例如,给定一个命名的环境变量 `PROBOT_DOCKER_VERSION` 设置为 `latest`,此配置 :

```json
{
...
  "hlx": {
    ...
    "docker": "adobe/probot-ow-nodejs8:${env.PROBOT_DOCKER_VERSION}"
  },
...
}
```

将实现 `docker` 设置为 `adobe/probot-ow-nodejs8:latest`。 。 。 .

#### 自动创建语义版本序列动作

通过使用 `--version-link` (单位:千美元)`-l`),而起步器可以创建动作序列 _链接_ 到部署的版本, 使用语义版本标记: `latest`, (中文(简体) ), `major`, (中文(简体) ), `minor`数字 :

| 动作名称 | 指定者 | 序列名称 |
| --- | --- | --- |
| `foo@2.4.3` | `latest` | `foo@latest` |
| `foo@2.4.3` | `major` | `foo@v2` |
| `foo@2.4.3` | `minor` | `foo@v2.4` |

### 包括静态文件

添加静态文件, 即未从中引用的文件 `index.js` 被网包检测到, 可以通过 `-s` 参数。 它们总是被放入档案的根目录.

示例

```bash
# include an image
hedy -s logo.png
```

如果路径指向一个目录,则会递归包含.

静态文件的文件也可以在 `package.json` 它允许指定 目标文件名 。 例如:

```json
...
  "hlx": {
    ...
    "static": [
      "config.json",
      ["assets/logo.png", "static/icon.ong"],
      ["public/", "static/"],
    ]
  }
...
```

## 使用插件

Helix 部署支持可以通过 `--plugin` 参数。 插件 可导出一个 `bundler` 和(或) `deployer` 函数。 例如,以下插件可用于 部署到边缘计算平台 : [https://github.com/adobe/helix-deplog-plugin-edge 页面存档备份,存于互联网档案馆](https://github.com/adobe/helix-deploy-plugin-edge)

```console
hedy --plugin @adobe/helix-deploy-plugin-edge --deploy
```

## 使用开发服务器

测试通用函数可以用 [开发服务器](https://github.com/adobe/helix-universal-devserver)。 。 。 .

只要创建一个 `test/dev.js` 文件为 :

```js
import { DevelopmentServer } from '@adobe/helix-universal-devserver';
import { main } from '../src/index.js';

async function run() {
  const devServer = await new DevelopmentServer(main).init();
  await devServer.start();
}

run().then(process.stdout).catch(process.stderr);
```

运行 `node test/dev.js`。 。 。 .

更多信息请参见 [https://github.com/adobe/helix-universal-devserver 页面存档备份,存于互联网档案馆](https://github.com/adobe/helix-universal-devserver)

## 页:1

### 捆绑

动作是使用 Web 包创建源代码捆绑, 然后创建 zip 归档 与捆绑,a `package.json`,私钥文件和 `.env`。 。 。 .

## 捐款

如果您对如何改进这些 OpenWhisk 动作工具有建议, 或是想要报告错误, 请打开一个问题 ! 我们很乐意所有的贡献.

更多,请检查 [贡献指南](https://npmcn.com/package/%40adobe/helix-deploy/CONTRIBUTING.md)。 。 。 .

## 常见问题

### @adobe/helix-deploy 是什么？

构建和部署 OpenWhisk 动作的库和命令行工具

### 如何安装 @adobe/helix-deploy？

在项目目录运行 npm install @adobe/helix-deploy，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：@adobe/helix-universal（\>=5\.2\.1）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。它还提供命令行工具 hedy，可以用 npx hedy 直接运行。

### @adobe/helix-deploy 支持 TypeScript 吗？

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

### @adobe/helix-deploy 支持 ESM 还是 CommonJS？

以 ES Module 形式发布，推荐使用 import 引入。在 CommonJS 项目中，Node\.js 20\.19\+ / 22\.12\+ 可以直接 require\(\) 不含顶层 await 的 ES Module，更早的版本需要改用动态 import\(\)。

### @adobe/helix-deploy 需要什么版本的 Node\.js？

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

### @adobe/helix-deploy 可以商用吗？

@adobe/helix-deploy 使用 Apache-2\.0 许可。宽松许可：允许商业使用、修改和再分发，并附带明确的专利授权；分发时需保留许可与 NOTICE 文件，修改过的文件要注明改动。以上为概括，不构成法律意见，请以许可原文为准。

### @adobe/helix-deploy 的下载量有多少？

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

### @adobe/helix-deploy 还在维护吗？

最新版本 14\.5\.4 发布于 2026/10/27（11 天前）；至今共发布 587 个版本，其中过去 12 个月发布了 67 个；首次发布于 2020/12/10。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

