@cruglobal/serverless-merge-config

中文文档
1.1.0发布于 2018/11/01MITCommonJS近 30 天下载 9907

Serverless merge config adds the ability to merge configuration after serverless variables have been evaluated.

原始使用文档

Serverless Merge Config

serverless Build Status Coverage Status npm version

Serverless merge config adds the ability to merge configuration after serverless variables have been evaluated.

Installation

Run:

# From npm (recommended)
npm install --save-dev @cruglobal/serverless-merge-config

# From github
npm install --save-dev https://github.com/CruGlobal/serverless-merge-config.git

Then make the following edits to your serverless.yml file:

plugins:
  - '@cruglobal/serverless-merge-config'
  - other-plugins

Including serverless-merge-config first will give other plugins access to the merged configuration.

How it Works

Serverless merge config works similarly to YAML merge except that it merges after serverless has completed variable substitution.

Use $<< property to merge:

provider:
    name: aws
    $<<: ${file:path/to/other.yml}

This will merge everything in path/to/other.yml to provider. Duplicate properties will be overridden by the merged value.

It is possible to use array if you want to merge variables from multiple sources:

provider:
    name: aws
    $<<:
      - ${file:path/to/other.yml}
      - ${file:path/to/another.yml}

This will merge everything in path/to/other.yml, then in file:path/to/another.yml to provider. Duplicate properties will be overridden by the merged value.

caveat: serverless print will not show the merged configuration. This command reloads and parses serverless.yml a second time with no hooks for plugins to tie into.

Contributing

We welcome pull requests!

  1. For any sizable change, first open a GitHub issue to discuss your idea.
  2. Create a pull request. Explain why you want to make the change and what it’s for.

版本与发布记录

@cruglobal/serverless-merge-config 共发布 3 个版本,首次发布于 2018/03/13;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.1.0latest2018/11/018 年前
1.0.12018/03/138 年前
1.0.02018/03/138 年前

关于 @cruglobal/serverless-merge-config 的常见问题

@cruglobal/serverless-merge-config 是什么?

Serverless merge config adds the ability to merge configuration after serverless variables have been evaluated.

如何安装 @cruglobal/serverless-merge-config?

在项目目录运行 npm install @cruglobal/serverless-merge-config,或使用 pnpm add / yarn add / bun add。

@cruglobal/serverless-merge-config 支持 TypeScript 吗?

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

@cruglobal/serverless-merge-config 支持 ESM 还是 CommonJS?

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

@cruglobal/serverless-merge-config 需要什么版本的 Node.js?

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

@cruglobal/serverless-merge-config 可以商用吗?

@cruglobal/serverless-merge-config 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@cruglobal/serverless-merge-config 的下载量有多少?

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

@cruglobal/serverless-merge-config 还在维护吗?

最新版本 1.1.0 发布于 2018/11/01(8 年前);至今共发布 3 个版本,其中过去 12 个月发布了 0 个;首次发布于 2018/03/13。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。