Skip to content

Commit dae2362

Browse files
committed
Update README files to reflect project name change to "CodeExpander Plugins" and improve command descriptions. Add Chinese localization for README.
1 parent 015bab0 commit dae2362

2 files changed

Lines changed: 134 additions & 46 deletions

File tree

README.md

Lines changed: 40 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,94 @@
1-
# Online Dev Tools (pnpm monorepo)
1+
# CodeExpander Plugins
2+
3+
[English](./README.md) | [简体中文](./README.zh-CN.md)
24

35
Monorepo of **CodeExpander plugins**, managed with pnpm workspaces.
46

57
## Structure
68

79
- **packages/ui** — Shared Tailwind + shadcn-style UI components used by plugins.
810
- **packages/i18n** — Minimal i18n helpers (`getLocale`, `t`) for plugin locales.
9-
- **packages/plugin-text****packages/plugin-ai** — CodeExpander plugin packages (one per category). Each builds to a `dist/` folder with `plugin.json` + `index.html` + assets.
11+
- **packages/plugin-text****packages/plugin-ai** — CodeExpander plugin packages (one per category). Each builds to a `dist/` folder with `plugin.json`, `index.html`, and assets.
1012

1113
## Commands
1214

13-
- `pnpm install` — Install all workspace dependencies.
14-
- `pnpm run dev` — Start the plugin-text dev server. **`make dev`** — CLI 选择要开发的插件后启动对应 dev server;或 `make dev PLUGIN=plugin-html` 直接指定。
15-
- `pnpm run build` — Build all plugin packages.
16-
- Build a single plugin: `pnpm --filter @codeexpander/plugin-text run build`.
17-
- Build all plugins only: `pnpm run build:plugins`(或 `pnpm --filter './packages/plugin-*' run build`)。
18-
- **一键发布所有插件到 npm**`pnpm run publish:plugins`(先构建再按序发布 11 个包,包名为 `@codeexpander/plugin-xxx`)。
19-
20-
---
15+
| Command | Description |
16+
|--------|-------------|
17+
| `pnpm install` | Install all workspace dependencies. |
18+
| `pnpm run dev` | Start the default plugin dev server. Use **`make dev`** to pick a plugin interactively, or `make dev PLUGIN=plugin-html` to specify one. |
19+
| `pnpm run build` | Build all packages. |
20+
| `pnpm --filter @codeexpander/plugin-text run build` | Build a single plugin. |
21+
| `pnpm run build:plugins` | Build all plugin packages only (`pnpm --filter './packages/plugin-*' run build`). |
22+
| `pnpm run publish:plugins` | Build and publish all plugins to npm in sequence (package names: `@codeexpander/plugin-*`). |
2123

22-
## 一键发布插件 / One-click plugin publish
24+
## One-Click Plugin Publish
2325

24-
插件包名已统一为 **`@codeexpander/plugin-*`**(如 `@codeexpander/plugin-text`),发布到 npm 后可通过 CodeExpander 的 npm 安装方式使用。
26+
Plugin packages use the **`@codeexpander/plugin-*`** scope (e.g. `@codeexpander/plugin-text`). After publishing to npm, they can be installed via CodeExpander’s npm install flow.
2527

26-
**发布前准备**
28+
**Before publishing**
2729

28-
1. 登录 npm`npm login`(需有 `@codeexpander` 组织权限或使用个人 scope)。
29-
2. 可选:统一改版本号(如 `0.1.0``0.2.0`):
30+
1. Log in to npm: `npm login` (requires `@codeexpander` org access or your own scope).
31+
2. Optional — bump versions (e.g. `0.1.0``0.2.0`):
3032
```bash
3133
pnpm --filter './packages/plugin-*' exec -- npm version patch --no-git-tag-version
3234
```
3335

34-
**执行发布**
36+
**Publish**
3537

3638
```bash
3739
pnpm run publish:plugins
3840
```
3941

40-
该命令会依次:构建所有插件(`build:plugins`)→ 对每个插件执行 `pnpm publish -r``--no-git-checks` 跳过 git 检查)。发布内容为各包的 `dist/` 目录(含 `plugin.json``index.html`assets)。
42+
This will: build all plugins (`build:plugins`), then run `pnpm publish` for each plugin (with `--no-git-checks`). Published content is each package’s `dist/` (including `plugin.json`, `index.html`, and assets).
4143

42-
若只发布单个插件,可先构建再进入该包目录执行 `pnpm publish`
44+
To publish a single plugin:
4345

4446
```bash
4547
pnpm --filter @codeexpander/plugin-text run build
4648
cd packages/plugin-text && pnpm publish --no-git-checks
4749
```
4850

49-
---
50-
51-
## 如何验证开发插件 / How to verify plugin development
51+
## Verifying Plugin Development
5252

53-
### 方式一:本地开发(不依赖 CodeExpander
53+
### Option 1: Local dev (no CodeExpander)
5454

55-
在浏览器里直接跑插件的 UI,改代码会热更新,适合改界面、加功能。复制/Toast 在无 host 时会走 fallback(如 `navigator.clipboard`)。
55+
Run the plugin UI in the browser with hot reload. Copy/Toast use fallbacks (e.g. `navigator.clipboard`) when not running inside CodeExpander.
5656

5757
```bash
58-
# 进入某个插件目录并启动 Vite 开发服务器
5958
cd packages/plugin-text && pnpm run dev
60-
# 或从仓库根目录指定插件
59+
# or from repo root:
6160
pnpm --filter @codeexpander/plugin-text run dev
6261
```
6362

64-
浏览器打开终端里提示的地址(如 `http://localhost:5173`),即可看到该插件的**多 Tab 工具界面**(无「Back to Tools」等外壳,仅插件内容)。
63+
Open the URL shown in the terminal (e.g. `http://localhost:5173`) to see the plugin’s multi-tab tools UI (no “Back to Tools” shell, just the plugin).
6564

66-
### 方式二:构建后在 CodeExpander 里验证(推荐)
65+
### Option 2: Build and test in CodeExpander (recommended)
6766

68-
在真实宿主里确认插件是否按规范工作(含 `writeClipboard``showToast`、多语言等)。
67+
Verify behavior in the real host (e.g. `writeClipboard`, `showToast`, i18n).
6968

70-
1. **构建插件**
69+
1. **Build**
7170
```bash
72-
# 构建单个插件
7371
pnpm --filter @codeexpander/plugin-text run build
74-
75-
# 或构建所有插件
72+
# or all plugins:
7673
pnpm run build:plugins
7774
```
7875

79-
2. **导入 CodeExpander**
80-
- 打开 CodeExpander → **设置** **插件中心**
81-
- 选择 **从目录导入**Import from directory
82-
- 选中该插件的 **dist** 目录,例如:
76+
2. **Import in CodeExpander**
77+
- Open CodeExpander → **Settings** or **Plugin Hub**
78+
- Choose **Import from directory**
79+
- Select the plugin’s **dist** folder, e.g.:
8380
- `packages/plugin-text/dist`
8481
- `packages/plugin-html/dist`
85-
- 等等
86-
87-
3. **验证**
88-
- 在 CodeExpander 里搜索或打开对应插件(如 "Text Tools")
89-
- 应只看到插件内容:Tab 切换各工具(如 Word Counter、Text Diff…),无「Back to Tools」
90-
- 测试复制、Toast、中英文切换(若传了 `initialPayload.locale`
9182

92-
---
83+
3. **Verify**
84+
- Search or open the plugin (e.g. “Text Tools”) in CodeExpander.
85+
- You should see only the plugin content: tabs for each tool (Word Counter, Text Diff, etc.), no “Back to Tools”.
86+
- Test copy, Toast, and locale (if `initialPayload.locale` is passed).
9387

94-
## Using plugins in CodeExpander
88+
## Using Plugins in CodeExpander
9589

9690
1. Build the plugin: `pnpm --filter @codeexpander/plugin-text run build`.
9791
2. In CodeExpander: **Settings** or **Plugin Hub****Import from directory**.
98-
3. Select the plugin’s `dist` folder (e.g. `packages/plugin-text/dist`). The folder must contain `plugin.json` and the entry file (`index.html`).
92+
3. Select the plugin’s `dist` folder (e.g. `packages/plugin-text/dist`). It must contain `plugin.json` and the entry file (`index.html`).
9993

100-
Each plugin supports multiple languages (en, zh) via `initialPayload.locale` or browser locale.
94+
Plugins support multiple languages (en, zh) via `initialPayload.locale` or browser locale.

README.zh-CN.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# CodeExpander Plugins
2+
3+
[English](./README.md) | [简体中文](./README.zh-CN.md)
4+
5+
本仓库是 **CodeExpander 插件** 的 pnpm 单体仓库。
6+
7+
## 结构
8+
9+
- **packages/ui** — 插件共用的 Tailwind + shadcn 风格 UI 组件。
10+
- **packages/i18n** — 插件多语言用的轻量 i18n 工具(`getLocale``t`)。
11+
- **packages/plugin-text****packages/plugin-ai** — 各品类 CodeExpander 插件包,构建输出到 `dist/`(含 `plugin.json``index.html` 及静态资源)。
12+
13+
## 常用命令
14+
15+
| 命令 | 说明 |
16+
|--------|-------------|
17+
| `pnpm install` | 安装工作区依赖。 |
18+
| `pnpm run dev` | 启动默认插件开发服务。**`make dev`** 可交互选择要开发的插件;`make dev PLUGIN=plugin-html` 直接指定插件。 |
19+
| `pnpm run build` | 构建所有包。 |
20+
| `pnpm --filter @codeexpander/plugin-text run build` | 仅构建单个插件。 |
21+
| `pnpm run build:plugins` | 仅构建所有插件(等价于 `pnpm --filter './packages/plugin-*' run build`)。 |
22+
| `pnpm run publish:plugins` | 先构建再按序发布所有插件到 npm(包名为 `@codeexpander/plugin-*`)。 |
23+
24+
## 一键发布插件
25+
26+
插件包名统一为 **`@codeexpander/plugin-*`**(如 `@codeexpander/plugin-text`),发布到 npm 后可在 CodeExpander 中通过 npm 安装使用。
27+
28+
**发布前准备**
29+
30+
1. 登录 npm:`npm login`(需具备 `@codeexpander` 组织权限或使用个人 scope)。
31+
2. 可选:统一提升版本号(如 `0.1.0``0.2.0`):
32+
```bash
33+
pnpm --filter './packages/plugin-*' exec -- npm version patch --no-git-tag-version
34+
```
35+
36+
**执行发布**
37+
38+
```bash
39+
pnpm run publish:plugins
40+
```
41+
42+
该命令会依次:构建所有插件(`build:plugins`)→ 对每个插件执行 `pnpm publish``--no-git-checks` 跳过 git 检查)。发布内容为各包的 `dist/` 目录(含 `plugin.json``index.html` 及资源)。
43+
44+
若只发布单个插件,可先构建再进入该包目录执行 `pnpm publish`
45+
46+
```bash
47+
pnpm --filter @codeexpander/plugin-text run build
48+
cd packages/plugin-text && pnpm publish --no-git-checks
49+
```
50+
51+
## 如何验证插件开发
52+
53+
### 方式一:本地开发(不依赖 CodeExpander)
54+
55+
在浏览器中直接运行插件 UI,支持热更新;无宿主时复制/Toast 会走 fallback(如 `navigator.clipboard`)。
56+
57+
```bash
58+
cd packages/plugin-text && pnpm run dev
59+
# 或从仓库根目录指定插件
60+
pnpm --filter @codeexpander/plugin-text run dev
61+
```
62+
63+
在终端提示的地址(如 `http://localhost:5173`)打开,即可看到该插件的多 Tab 工具界面(无「返回工具」等外壳,仅插件内容)。
64+
65+
### 方式二:构建后在 CodeExpander 中验证(推荐)
66+
67+
在真实宿主中确认插件行为(含 `writeClipboard``showToast`、多语言等)。
68+
69+
1. **构建插件**
70+
```bash
71+
pnpm --filter @codeexpander/plugin-text run build
72+
# 或构建所有插件
73+
pnpm run build:plugins
74+
```
75+
76+
2. **在 CodeExpander 中导入**
77+
- 打开 CodeExpander → **设置****插件中心**
78+
- 选择 **从目录导入**
79+
- 选中该插件的 **dist** 目录,例如:
80+
- `packages/plugin-text/dist`
81+
- `packages/plugin-html/dist`
82+
83+
3. **验证**
84+
- 在 CodeExpander 中搜索或打开对应插件(如「文本工具」)
85+
- 应只看到插件内容:Tab 切换各工具(如字数统计、文本对比等),无「返回工具」
86+
- 测试复制、Toast、中英文切换(若传入 `initialPayload.locale`
87+
88+
## 在 CodeExpander 中使用插件
89+
90+
1. 构建插件:`pnpm --filter @codeexpander/plugin-text run build`
91+
2. 在 CodeExpander:**设置****插件中心****从目录导入**
92+
3. 选择插件的 `dist` 目录(如 `packages/plugin-text/dist`),其中需包含 `plugin.json` 和入口文件 `index.html`
93+
94+
插件通过 `initialPayload.locale` 或浏览器语言支持多语言(en、zh)。

0 commit comments

Comments
 (0)