@app-config/main

中文文档
2.9.0-beta.3发布于 2025/05/23MPL-2.0TypeScriptESM + CJS近 30 天下载 1.6万

Easy to use configuration loader with schema validation

原始使用文档
文档目录3 节
  1. App Config
  2. Features
  3. Using App Config

App Config

Easy Configuration Loader with Strict Validation


Features

  • Schema Validation: Avoid production typos. Write JSON Schema for your configuration, and we'll have your back.
  • Strong Typing: Use it with TypeScript without separate validation. Types are generated based on JSON Schema constraints.
  • Powerful and Robust: Flexible parsing extensions and file loading strategies. Provides file merging, environment specific values (eg. production vs development) and more.
  • First Class Encryption: Manage your secrets in version control, backed by OpenPGP (optional). Or, keep secrets away from committed files with schema validation.
  • Use Your Tools: Don't be constrained by your tools - export environment variables for usage anywhere.
  • Multi-Format: Write YAML, TOML, JSON, JSON5 - whatever makes most sense for you.

Using App Config

Read the Introduction or Quick Start guides on our website.

Or, start by installing through your package manager:

yarn add @app-config/main@2

Or, using NPM.

npm i @app-config/main@2

版本与发布记录

@app-config/main 共发布 48 个版本,首次发布于 2021/02/11;过去 12 个月发布了 0 个版本。

版本发布日期距今
2.9.0-beta.3latest2025/05/231.5 年前
2.9.0-beta.22025/05/221.5 年前
2.9.0-beta.12023/06/093 年前
2.8.72023/02/273 年前
2.8.62022/11/143 年前
2.8.52022/08/104 年前

其他发布通道:next → 3.0.0-alpha.6。

关于 @app-config/main 的常见问题

@app-config/main 是什么?

Easy to use configuration loader with schema validation

如何安装 @app-config/main?

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

@app-config/main 支持 TypeScript 吗?

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

@app-config/main 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@app-config/main 可以商用吗?

@app-config/main 使用 MPL-2.0 许可。弱 Copyleft:可以商用,也可以和闭源代码一起使用;但如果分发时修改了 MPL 授权的文件,这些文件的修改需以 MPL 开源。以上为概括,不构成法律意见,请以许可原文为准。

@app-config/main 的下载量有多少?

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

@app-config/main 还在维护吗?

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