@emulsify/cli

中文文档
2.4.1发布于 2026/08/31GPL-2.0ES Module构建来源已验证近 30 天下载 6418

Build and use component systems in Drupal, WordPress, or standalone front ends.

原始使用文档
文档目录6 节
  1. Requirements
  2. Installation
  3. Quick Start
  4. Documentation
  5. Command Overview
  6. Contributors

Emulsify Design System npm

Emulsify CLI

Build and use component systems in Drupal, WordPress, or standalone front ends.

Requirements

Emulsify CLI requires Node.js 24 or newer.

Installation

Install Emulsify CLI globally from npm:

npm install -g @emulsify/cli

Run the current command help at any time:

emulsify
emulsify --help

Quick Start

Create a Drupal starter project, install a system, and add components:

emulsify init "My Theme" ./web/themes/custom --platform drupal
cd ./web/themes/custom/my_theme
emulsify system install
emulsify component list
emulsify component install card
emulsify component create promo-card --directory molecules --type twig

Built-in platforms are drupal, wordpress, and none. For WordPress child themes, use the WordPress platform and starter:

emulsify init "My Theme" ./wp-content/themes --platform wordpress

When WordPress is auto-detected, Emulsify initializes child themes into the detected themes directory, such as wp-content/themes/my-theme or web/app/themes/my-theme for Bedrock.

To author a standalone, distributable component system, run system create outside or inside any project. The target directory is created beneath the selected parent directory:

emulsify system create "My System" --directory ./systems --platform "drupal || wordpress" --git

This creates ./systems/my-system with valid system and variant configuration, an installable example-card component, repository documentation, a .gitignore, and a license placeholder to replace before distribution. Unless overridden, its required URL metadata uses obvious, schema-valid https://TODO.invalid/... placeholders that must also be replaced before publishing.

Add --dry-run to preview the normalized target, every generated file, and whether Git would be initialized without changing the filesystem.

When components installed from another system have evolved into the basis of your own, detach the configured system before authoring a replacement:

emulsify system detach

Detaching removes only the system and variant entries from project.emulsify.json. Components, project assets, and the cached system repository stay in place. Run system create to scaffold a new system repository, then move or copy the preserved components into that scaffold and update system.emulsify.json; system create does not import them automatically.

Interactive terminals can run emulsify component create with no arguments to walk through the component name, type, and directory prompts. The type picker always offers Twig, offers Twig SDC in Drupal projects, and offers React and Web Component scaffolds when the project's package.json declares @emulsify/core. When a choice is unavailable, the wizard explains why; when Twig is the only suitable choice, it skips the one-item prompt. Likewise, emulsify component install with no name presents the components available in the installed system variant plus an explicit choice to install all components.

To customize component scaffolds, copy the CLI's built-in templates into the project, then edit the resulting files under .cli/templates/:

emulsify component eject-templates twig

Run the command without a type in an interactive terminal to select one or more component types. Use --all to eject every type non-interactively. Existing overrides are protected unless --force is passed.

Prompts only run when standard input is a TTY. In CI, scripts, and commands with piped or redirected input, provide every required positional argument and flag; the CLI exits with an actionable error instead of waiting for input:

emulsify init "My Theme" ./web/themes/custom --platform drupal --yes
emulsify system create my-system --directory ./systems --platform none --git
emulsify system create my-system --directory ./systems --platform none --git --dry-run
emulsify system install compound
emulsify component install card --force
# Or install every available component:
emulsify component install --all
emulsify component create promo-card --directory molecules --type twig --force
emulsify component create card --directory molecules --type web-component --tag-name acme-card
emulsify component eject-templates --all
emulsify system detach --yes

For component installation, provide either a component name or --all, and use --force when an existing destination should be replaced. For component creation, provide the positional name plus --type and --directory, and use --force when an existing generated component should be replaced. The existing -y, --yes form remains available as a compatibility alias. Explicit --type values are honored even when project detection would hide that choice from the wizard. The deprecated --format default and --format sdc forms remain available as aliases for --type twig and --type twig-sdc, respectively, and print a deprecation warning. Web Components derive their tag name from the component and project names; pass --tag-name to override it, including when the derived value would be invalid in a non-interactive run. For template ejection, provide the component type or --all outside a TTY; use --dry-run to preview paths and --force only when existing customizations should be replaced.

Documentation

Detailed documentation lives in docs.

TopicUse This When
CLI ReferenceLooking up commands, aliases, options, and examples.
Project InitializationCreating a new Emulsify project from a starter.
SystemsListing, installing, detaching, or authoring component systems.
ComponentsListing, installing, dry-running, or creating components.
Project ConfigurationUnderstanding project.emulsify.json, variants, and structure mappings.
Component Template OverridesEjecting and customizing files used by emulsify component create.
Hooks And CacheUnderstanding starter hooks, system hooks, and local repository cache behavior.
DevelopmentSetting up this repository and running local checks.
ReleaseUnderstanding CI, semantic-release, and npm publishing.

Command Overview

CommandAliasDescription
emulsify init [name] [path]Initializes an Emulsify project from a starter.
emulsify audit [...args]Runs the project-installed Emulsify Core audit.
emulsify system listemulsify system lsLists built-in systems available for installation.
emulsify system create [name]Creates a standalone component-system repository.
emulsify system install [name]Installs a system in the current Emulsify project.
emulsify system detachDetaches the system and keeps project components.
emulsify component listemulsify component lsLists components available from the installed system and variant.
emulsify component install [name]emulsify component i [name]Installs one component from the installed system and variant.
emulsify component create [name]emulsify component c [name]Creates a local component in the current Emulsify project.
emulsify component eject-templates [type]Writes editable built-in templates into the current project.
emulsify cache clearClears locally cached system repositories.

emulsify audit is a convenience façade. The project-installed @emulsify/core package remains the owner of the canonical emulsify-audit machine interface, checks, findings, JSON schema, output, and exit behavior. See the CLI reference and Core audit documentation.

Contributors

See Contributors.

版本与发布记录

@emulsify/cli 共发布 39 个版本,首次发布于 2021/07/17;过去 12 个月发布了 11 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
2.4.1latest2026/08/312 个月前
2.4.02026/08/312 个月前
2.3.12026/08/302 个月前
2.3.02026/08/302 个月前
2.2.02026/06/214 个月前
2.1.12026/06/154 个月前

关于 @emulsify/cli 的常见问题

@emulsify/cli 是什么?

Build and use component systems in Drupal, WordPress, or standalone front ends.

如何安装 @emulsify/cli?

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

@emulsify/cli 支持 TypeScript 吗?

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

@emulsify/cli 支持 ESM 还是 CommonJS?

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

@emulsify/cli 需要什么版本的 Node.js?

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

@emulsify/cli 可以商用吗?

@emulsify/cli 使用 GPL-2.0 许可。强 Copyleft:分发包含该代码的软件时,整个作品需以兼容的 GPL 许可开源。仅在内部使用、不对外分发时不触发此义务。以上为概括,不构成法律意见,请以许可原文为准。

@emulsify/cli 的下载量有多少?

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

@emulsify/cli 还在维护吗?

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