Skip to content

Commit 015bab0

Browse files
committed
init
0 parents  commit 015bab0

443 files changed

Lines changed: 37476 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-manager=pnpm

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
MIT License
3+
4+
Copyright (c) 2025 Developer Toolbox
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.

README.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Online Dev Tools (pnpm monorepo)
2+
3+
Monorepo of **CodeExpander plugins**, managed with pnpm workspaces.
4+
5+
## Structure
6+
7+
- **packages/ui** — Shared Tailwind + shadcn-style UI components used by plugins.
8+
- **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.
10+
11+
## Commands
12+
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+
---
21+
22+
## 一键发布插件 / One-click plugin publish
23+
24+
插件包名已统一为 **`@codeexpander/plugin-*`**(如 `@codeexpander/plugin-text`),发布到 npm 后可通过 CodeExpander 的 npm 安装方式使用。
25+
26+
**发布前准备**
27+
28+
1. 登录 npm:`npm login`(需有 `@codeexpander` 组织权限或使用个人 scope)。
29+
2. 可选:统一改版本号(如 `0.1.0``0.2.0`):
30+
```bash
31+
pnpm --filter './packages/plugin-*' exec -- npm version patch --no-git-tag-version
32+
```
33+
34+
**执行发布**
35+
36+
```bash
37+
pnpm run publish:plugins
38+
```
39+
40+
该命令会依次:构建所有插件(`build:plugins`)→ 对每个插件执行 `pnpm publish -r``--no-git-checks` 跳过 git 检查)。发布内容为各包的 `dist/` 目录(含 `plugin.json``index.html`、assets)。
41+
42+
若只发布单个插件,可先构建再进入该包目录执行 `pnpm publish`
43+
44+
```bash
45+
pnpm --filter @codeexpander/plugin-text run build
46+
cd packages/plugin-text && pnpm publish --no-git-checks
47+
```
48+
49+
---
50+
51+
## 如何验证开发插件 / How to verify plugin development
52+
53+
### 方式一:本地开发(不依赖 CodeExpander)
54+
55+
在浏览器里直接跑插件的 UI,改代码会热更新,适合改界面、加功能。复制/Toast 在无 host 时会走 fallback(如 `navigator.clipboard`)。
56+
57+
```bash
58+
# 进入某个插件目录并启动 Vite 开发服务器
59+
cd packages/plugin-text && pnpm run dev
60+
# 或从仓库根目录指定插件
61+
pnpm --filter @codeexpander/plugin-text run dev
62+
```
63+
64+
浏览器打开终端里提示的地址(如 `http://localhost:5173`),即可看到该插件的**多 Tab 工具界面**(无「Back to Tools」等外壳,仅插件内容)。
65+
66+
### 方式二:构建后在 CodeExpander 里验证(推荐)
67+
68+
在真实宿主里确认插件是否按规范工作(含 `writeClipboard``showToast`、多语言等)。
69+
70+
1. **构建插件**
71+
```bash
72+
# 构建单个插件
73+
pnpm --filter @codeexpander/plugin-text run build
74+
75+
# 或构建所有插件
76+
pnpm run build:plugins
77+
```
78+
79+
2. **导入 CodeExpander**
80+
- 打开 CodeExpander → **设置****插件中心**
81+
- 选择 **从目录导入**(Import from directory)
82+
- 选中该插件的 **dist** 目录,例如:
83+
- `packages/plugin-text/dist`
84+
- `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`
91+
92+
---
93+
94+
## Using plugins in CodeExpander
95+
96+
1. Build the plugin: `pnpm --filter @codeexpander/plugin-text run build`.
97+
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`).
99+
100+
Each plugin supports multiple languages (en, zh) via `initialPayload.locale` or browser locale.

bun.lockb

194 KB
Binary file not shown.

0 commit comments

Comments
 (0)