OriaTheme
外观

API 参考 · 源码组件 CLI

@oriatheme/cli

安全地把可修改的 React/Vue ThemeEditor 源码复制到使用方项目;不是运行时依赖。

包与运行环境

Node 可执行工具。通常用 pnpm dlx、npm exec、yarn dlx 或 bunx 一次性运行,而不是加入浏览器 bundle。

bash
pnpm add -D @oriatheme/cli

选择使用方项目已有的一种包管理器和 lockfile;示例只使用 package root export,不要从 src、dist 或 registry template 深层导入。

Programmatic export

ExportSignatureDescription
runCli(args: readonly string[], cwd?: string) => Promise<CliResult>Runs the CLI programmatically and returns exitCode plus output lines.

常用命令

bash
pnpm dlx @oriatheme/cli@latest add theme-editor --framework react --dry-run

add 默认只显示计划并以 code 2 退出;--yes 才写入。--dry-run 不写入且以 code 0 退出。用 --path 指定项目内目录,Vue 将 framework 改为 vue。检查计划后,使用同一种 runner 把 --dry-run 替换为 --yes;diff 使用相同 runner 加 diff theme-editor --framework react。

registry 的 theme-editor 现为 0.2.0,按 oria-standard@2 渲染,要求使用方安装 @oriatheme/core@^0.3.0。另一条命令预构建 Tailwind CSS v4 静态 bridge,只把生成的 CSS 写入 --out 指定文件:

bash
oria theme tailwind-bridge --out src/oria-tailwind.css
oria theme tailwind-bridge --prefix acme --out src/oria-tailwind.css --dry-run

写入前的安全保证

CLI 校验 manifest、框架、版本兼容性、相对路径、文件大小和 SHA-256;拒绝脚本、HTTP、越界和符号链接目标。默认拒绝覆盖,diff 不写入,--overwrite 必须与 --yes 明确确认。CLI 不运行 registry 生命周期脚本,也不上传主题或项目文件。