Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/sync-readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Sync README

# Regenerates the plugin overview in README.md from lithe-plugin-index.json
# after every change lands on main, so contributors and the release bot only
# edit the index. Commits made with GITHUB_TOKEN do not trigger workflows,
# so the sync commit cannot loop.
on:
push:
branches: [main]
paths:
- lithe-plugin-index.json
- scripts/render-readme.mjs
- README.md
- assets/**
workflow_dispatch:

permissions:
contents: write

concurrency:
group: sync-readme
cancel-in-progress: false

jobs:
sync:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 22

- name: Render the plugin overview
run: node scripts/render-readme.mjs

- name: Commit when README changed
run: |
if git diff --quiet -- README.md; then
echo "README.md is already in sync."
exit 0
fi
git config user.name "lithe-store-bot"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add README.md
git commit -m "docs(readme): 同步插件总览"
git push origin HEAD:main
3 changes: 1 addition & 2 deletions .github/workflows/track-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ jobs:
args=""
if [ -n "$PLUGIN" ]; then args="--plugin $PLUGIN"; fi
node scripts/track-releases.mjs lithe-plugin-index.json $args
node scripts/render-readme.mjs

- name: Verify the new archives
if: steps.track.outputs.added != '0'
Expand All @@ -63,7 +62,7 @@ jobs:
git config user.name "lithe-store-bot"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git switch -C "$BRANCH"
git add lithe-plugin-index.json README.md
git add lithe-plugin-index.json
git commit -m "chore(index): track new plugin releases" -m "$SUMMARY"
git push --force origin "$BRANCH"
body=$(printf '自动追踪到新的插件版本:\n\n%s\n\n已校验 SHA-256 与包内 plugin.json(id、version、pluginAPIVersion、signatureRequirement)。维护者请按 docs/maintainers.md 的清单审查后合并。' "$(echo "$SUMMARY" | tr ',' '\n' | sed 's/^ */- /')")
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ jobs:
- name: Validate index
run: node scripts/validate-index.mjs lithe-plugin-index.json

- name: Check the README plugin overview
run: node scripts/render-readme.mjs --check

- name: Pick the base index
id: base
run: |
Expand Down
9 changes: 5 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
| --- | --- |
| 收录自己的插件 | 读 [docs/publishing.md](docs/publishing.md),提 PR 或开“插件收录申请” issue |
| 发布插件新版本 | 在自己仓库发布 Release 即可,bot 会自动开 PR(见 [发布新版本](docs/publishing.md#4-发布新版本)) |
| 修改插件信息 | 提 PR 修改 `lithe-plugin-index.json` 中自己的条目,并运行 `node scripts/render-readme.mjs` 更新 README |
| 修改插件信息 | 提 PR 修改 `lithe-plugin-index.json` 中自己的条目(含 `icon`) |
| 报告有问题的插件 | 开“报告插件问题” issue;安全问题请勾选“安全问题”,维护者会优先处理 |
| 改进脚本、CI 或文档 | 直接提 PR,并运行 `node --test scripts/store.test.mjs` |

Expand All @@ -13,7 +13,8 @@
- 一个 PR 只改一个插件,便于审查和回退。
- `plugins` 按 `id` 字母序排列;每个插件的 `versions` 新版本在前。
- 不修改已发布版本的 `downloadURL` 与 `sha256`;不删除历史版本(撤回问题版本除外)。
- 修改索引后运行 `node scripts/render-readme.mjs`,README 的插件总览由它生成,CI 会检查两者是否一致。
- README 的插件总览由 `scripts/render-readme.mjs` 根据索引生成,合并到 main 后由 `Sync README` 工作流自动提交,PR 中不需要手动更新。
- 插件图标填在条目的 `icon` 字段,指向插件仓库内固定到提交的 SVG/PNG(`raw.githubusercontent.com/<owner>/<repo>/<commit>/…`);没有填写时 README 使用默认图标。
- 插件的 bug 与功能请求请提到插件自己的仓库,本仓库只处理收录相关事务。

第一次开发语言插件,先读[LSP 插件完整生命周期](docs/lsp-plugin-lifecycle.md),
Expand Down Expand Up @@ -63,7 +64,7 @@ scripts/track-releases.mjs # 追踪已收录插件的新 Release 并生成
scripts/render-readme.mjs # 根据索引生成 README 的插件总览
scripts/store.test.mjs # 校验脚本的测试(fixtures 复制自 Lithe 主仓库)
assets/ # README 用到的图片(无图标插件的默认图标)
.github/workflows/ # validate(PR/推送/每周)与 track-releases(每 6 小时)
.github/workflows/ # validate(PR/推送/每周)、track-releases(每 6 小时)、sync-readme(main 更新后同步 README)
```

## 本地校验
Expand All @@ -73,5 +74,5 @@ assets/ # README 用到的图片(无图标插件的默
```bash
node --test scripts/store.test.mjs
node scripts/validate-index.mjs --verify-archives
node scripts/render-readme.mjs --check
node scripts/render-readme.mjs # 本地预览 README 插件总览
```
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<table>
<tr>
<td width="50%" valign="top">
<h3><img src="assets/plugin-default.svg" width="28" height="28" alt=""> <a href="https://github.com/Lithe-IDEA/lithe-plugin-go">Go Support</a></h3>
<h3><img src="https://raw.githubusercontent.com/Lithe-IDEA/lithe-plugin-go/14321930779d1b441e1b7d13d2a4a741ef8f305c/io.github.lithe-idea.go-support/icons/go.svg" width="28" height="28" alt=""> <a href="https://github.com/Lithe-IDEA/lithe-plugin-go">Go Support</a></h3>
<p><sub>Lithe Community · v0.1.0 · API 1</sub></p>
<p>使用你自己安装的 gopls 提供 Go 补全、跳转定义和错误提示,并支持运行 main 包和 go test(整个模块、单个文件所在的包或单个测试函数)。需要先安装 Go 和 gopls(go install gola…</p>
<p>🏷️ 语言支持 · 💻 macOS · <img src="https://img.shields.io/github/stars/Lithe-IDEA/lithe-plugin-go?style=flat&label=stars&logo=github" alt="GitHub stars"></p>
Expand All @@ -47,7 +47,7 @@
</tr>
<tr>
<td width="50%" valign="top">
<h3><img src="assets/plugin-default.svg" width="28" height="28" alt=""> <a href="https://github.com/Lithe-IDEA/lithe-plugin-lua">Lua Support</a></h3>
<h3><img src="https://raw.githubusercontent.com/Lithe-IDEA/lithe-plugin-lua/c5f88bf94e9d5616c7770e58febc53a0d520dd50/io.github.lithe-idea.lua-support/icons/lua.svg" width="28" height="28" alt=""> <a href="https://github.com/Lithe-IDEA/lithe-plugin-lua">Lua Support</a></h3>
<p><sub>Lithe Community · v0.3.0 · API 1</sub></p>
<p>内置 lua-language-server(LuaLS)提供 Lua 补全、跳转定义和错误提示,无需另外安装;“运行当前文件”使用你自己的 lua(brew install lua)。</p>
<p>🏷️ 语言支持 · 💻 macOS · <img src="https://img.shields.io/github/stars/Lithe-IDEA/lithe-plugin-lua?style=flat&label=stars&logo=github" alt="GitHub stars"></p>
Expand All @@ -63,7 +63,7 @@
</tr>
<tr>
<td width="50%" valign="top">
<h3><img src="assets/plugin-default.svg" width="28" height="28" alt=""> <a href="https://github.com/Lithe-IDEA/lithe-plugin-php">PHP Support</a></h3>
<h3><img src="https://raw.githubusercontent.com/Lithe-IDEA/lithe-plugin-php/a0b5600d2629e7acc72dda5871dbe403ce1922a9/io.github.lithe-idea.php-support/icons/php.svg" width="28" height="28" alt=""> <a href="https://github.com/Lithe-IDEA/lithe-plugin-php">PHP Support</a></h3>
<p><sub>Lithe Community · v0.1.0 · API 1</sub></p>
<p>使用你自己安装的 Intelephense 提供 PHP 补全、跳转定义和错误提示,并支持运行 PHP 文件和 PHPUnit 测试。插件不内置 Intelephense(其许可证不允许再分发),请用 npm insta…</p>
<p>🏷️ 语言支持 · 💻 macOS · <img src="https://img.shields.io/github/stars/Lithe-IDEA/lithe-plugin-php?style=flat&label=stars&logo=github" alt="GitHub stars"></p>
Expand All @@ -86,7 +86,7 @@
## 🤝 参与贡献

想收录自己的插件、发布新版本或报告有问题的插件,请看 [CONTRIBUTING.md](CONTRIBUTING.md)。
上方的插件总览由 `scripts/render-readme.mjs` 根据 [`lithe-plugin-index.json`](lithe-plugin-index.json) 生成,修改索引后运行一次即可。
上方的插件总览由 `scripts/render-readme.mjs` 根据 [`lithe-plugin-index.json`](lithe-plugin-index.json) 生成,索引合并到 main 后由 CI 自动同步。

## 📄 许可

Expand Down
3 changes: 3 additions & 0 deletions lithe-plugin-index.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
},
"tags": ["language", "go"],
"license": "Apache-2.0",
"icon": "https://raw.githubusercontent.com/Lithe-IDEA/lithe-plugin-go/14321930779d1b441e1b7d13d2a4a741ef8f305c/io.github.lithe-idea.go-support/icons/go.svg",
"versions": [
{
"version": "0.1.0",
Expand Down Expand Up @@ -86,6 +87,7 @@
},
"tags": ["language", "lua"],
"license": "Apache-2.0",
"icon": "https://raw.githubusercontent.com/Lithe-IDEA/lithe-plugin-lua/c5f88bf94e9d5616c7770e58febc53a0d520dd50/io.github.lithe-idea.lua-support/icons/lua.svg",
"versions": [
{
"version": "0.3.0",
Expand Down Expand Up @@ -173,6 +175,7 @@
},
"tags": ["language", "php"],
"license": "Apache-2.0",
"icon": "https://raw.githubusercontent.com/Lithe-IDEA/lithe-plugin-php/a0b5600d2629e7acc72dda5871dbe403ce1922a9/io.github.lithe-idea.php-support/icons/php.svg",
"versions": [
{
"version": "0.1.0",
Expand Down
1 change: 1 addition & 0 deletions scripts/render-readme.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Renders the plugin overview in README.md from lithe-plugin-index.json, so the
// cards always match what Lithe shows in its marketplace. Only the block between
// the `plugins:start` / `plugins:end` markers is generated; edit the rest by hand.
// The `Sync README` workflow runs this after every change on main.
//
// Usage: node scripts/render-readme.mjs [--check]
// --check exit 1 when README.md is out of date instead of rewriting it.
Expand Down
5 changes: 0 additions & 5 deletions scripts/store.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -327,11 +327,6 @@ test("archives must hold one matching community plugin.json", () => {
}
});

test("the README plugin overview matches the published index", () => {
const index = JSON.parse(readFileSync(new URL("../lithe-plugin-index.json", import.meta.url)));
const readme = readFileSync(new URL("../README.md", import.meta.url), "utf8");
assert.equal(renderReadme(readme, index), readme, "run: node scripts/render-readme.mjs");
});

test("the overview renders one escaped card per plugin with a default icon", () => {
const entry = validEntry();
Expand Down
Loading