@flexent/ensemble

中文文档
2.22.1发布于 2026/11/13MITES Module近 30 天下载 2088

YAML-driven process manager for local development

原始使用文档
文档目录4 节
  1. Install
  2. CLI
  3. Config
  4. Programmatic API

@flexent/ensemble

YAML-driven process manager for running multiple Node.js apps locally.

Install

npm install @flexent/ensemble

CLI

From the directory that contains ensemble.yaml:

npx ensemble

Options:

  • -f, --file <path> — config file (default: ensemble.yaml in cwd)

Config

Create ensemble.yaml at the project root:

apps:
  - id: api
    dir: packages/api
    entrypoint: out/bin/run.js
    args:
      - --watch
    env:
      HTTP_PORT: "32001"
      META_HTTP_PORT: "38001"
    waitForPorts:
      - HTTP_PORT
      - META_HTTP_PORT
  - id: worker
    dir: packages/worker
    entrypoint: out/bin/run.js
    dependsOn:
      - api
    waitForPorts:
      - 39001
    env:
      SKIP_STORAGE_SETUP: "true"

sharedEnv:
  LOG_PRETTY: "true"
  REGISTRY_URL: http://localhost:32003

stopGracePeriodMs: 5000

Each app is forked with stdio: inherit. On stop, ensemble sends SIGTERM, waits stopGracePeriodMs (default 5000), then sends SIGKILL if the child is still running.

args is optional. Command-line arguments passed to the forked process after entrypoint.

stopGracePeriodMs is optional.

dependsOn lists app ids that must start before this one. Apps without dependencies start in config order. Ensemble stops apps in reverse start order.

waitForPorts lists env var names or literal port numbers. After forking, ensemble waits until each port accepts TCP connections on 127.0.0.1 before the app is considered started. Env var names are resolved from the app’s merged env (sharedEnv, then per-app env). Combine with dependsOn when a dependent should wait for a dependency to be listening.

sharedEnv is merged into each forked app’s environment. Per-app env overrides shared values. The ensemble parent process is not modified.

Programmatic API

import { Ensemble } from '@flexent/ensemble';

const ensemble = new Ensemble();
await ensemble.resolve('path/to/ensemble.yaml');
await ensemble.start('api');
await ensemble.stop('api');
// OR
await ensemble.startAll();
await ensemble.stopAll();

版本与发布记录

@flexent/ensemble 共发布 27 个版本,首次发布于 2026/05/21;过去 12 个月发布了 27 个版本。

版本发布日期距今
2.22.1latest2026/11/132 天前
2.22.02026/11/132 天前
2.21.02026/11/132 天前
2.20.22026/11/133 天前
2.20.12026/11/115 天前
2.20.02026/11/069 天前

关于 @flexent/ensemble 的常见问题

@flexent/ensemble 是什么?

YAML-driven process manager for local development

如何安装 @flexent/ensemble?

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

@flexent/ensemble 支持 TypeScript 吗?

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

@flexent/ensemble 支持 ESM 还是 CommonJS?

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

@flexent/ensemble 可以商用吗?

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

@flexent/ensemble 的下载量有多少?

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

@flexent/ensemble 还在维护吗?

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