API 參考 · 來源元件 CLI
@oriatheme/cli
將可編輯的 React/Vue ThemeEditor 來源安全複製到消費者專案中;它不是執行時間依賴項。包裝及環境
節點可執行檔。通常透過 pnpm dlx、npm exec、yarn dlx 或 Bunx 執行一次,而不是將其新增至瀏覽器套件。
bash
pnpm add -D @oriatheme/clibash
npm install -D @oriatheme/clibash
yarn add -D @oriatheme/clibash
bun add -D @oriatheme/cli使用消費者專案已經選擇的套件管理器和鎖定檔案。範例僅使用包根匯出;不要從 src、dist 或註冊表範本深度匯入。
Programmatic export
| 出口 | 簽名 | 描述 |
|---|---|---|
runCli | (args: readonly string[], cwd?: string) => Promise<CliResult> | 以程式設計方式運行 CLI 並傳回 exitCode 和輸出行。 |
常用命令
bash
pnpm dlx @oriatheme/cli@latest add theme-editor --framework react --dry-runbash
npm exec --yes --package=@oriatheme/cli@latest -- oria add theme-editor --framework react --dry-runbash
yarn dlx @oriatheme/cli@latest add theme-editor --framework react --dry-runbash
bunx @oriatheme/cli@latest add theme-editor --framework react --dry-runadd 列印計劃並預設以代碼 2 退出;僅 --yes 寫入。 --dry-run 不執行任何寫入操作並以代碼 0 退出。使用 --path 作為專案內目標,使用 vue 作為 Vue 的框架。經審核,透過同一流道將--dry-run替換為--yes;將此運行器與 diff 主題編輯器 --framework 結合使用,以對差異做出反應。
註冊表主題編輯器現在為 0.2.0,呈現 oria-standard@2,並且在消費者項目中需要 @oriatheme/core@^0.3.0。第二個指令預先建置靜態 Tailwind CSS v4 橋,並僅將產生的 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 驗證清單、框架、相容版本、相對路徑、檔案大小和 SHA-256。它拒絕腳本、HTTP、路徑轉義和符號連結目標。預設拒絕覆蓋; diff 從不寫入,且 --overwrite 需要明確 --yes。 CLI 不執行註冊表生命週期腳本,也不上傳任何主題或專案檔案。