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
27 changes: 11 additions & 16 deletions .changeset/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,20 @@ npm run changeset
# 选受影响的包 + patch|minor|major,写中文摘要
```

## 本地发版(维护者)
然后 **push `main`** 即可:CI 会开/更新 Version Packages PR;合并该 PR 后自动 `ci-release-packages`(publish → tag → push → GitHub Release)。

当前在 pre mode,请用 **prerelease**:
本地一般 **不需要** 手动跑发版命令。

```bash
npm run prerelease-packages
```

入口为 `node tools/run-release.mjs --pre`,内部依次:assert pre → ensure changeset → version → commit → tag → push → publish → GitHub Pre-release。
## CI 发版入口

退出 pre 且达标后,正式发版:

```bash
npx changeset pre exit
npm run release-packages # run-release.mjs --stable → npm latest + GitHub Release
```
根 `package.json`:

## CI
| 脚本 | 谁调 |
|------|------|
| `version-packages` | changesets/action(Version PR) |
| `ci-release-packages` | 合并 Version PR 后的 publish 步骤 |
| `build:publishable` | CI build 可发包拓扑 |

`changeset-release.yml` 在 `main` 上开 Version PR;合并后跑 `ci-release-packages`(`run-release.mjs --ci`:publish → tag → push tags → gh release,无交互)。
应急单包:`.github/workflows/npm-publish.yml`(`workflow_dispatch`)。

详情见 [docs/dev/publish.md](../docs/dev/publish.md)(平台包附录)
详情见 [docs/zh/dev/publish.md](../docs/zh/dev/publish.md)。
5 changes: 1 addition & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ npm run start # sfmc CLI REPL
npm run lint # 先 build eslint-plugin,再 eslint .
npm run typecheck
npm run verify # 平台集成自检(CI 默认)
npm run catalog-sync # 装模块后投影 catalog(维护命令)
npm run syncpack:lint
```

Expand Down Expand Up @@ -215,9 +214,7 @@ npm start -- update

```bash
node packages/tools/verify.mjs
node packages/tools/catalog-sync.mjs
node packages/tools/check-modules.mjs
sfmc mod install <id>
sfmc mod install <id> # 在独立 SFMC 根,非主仓
```

## SAPI debug 与 Sentry
Expand Down
7 changes: 2 additions & 5 deletions docs/en/guide/modules.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,8 @@ The list below is generated at build time from the `sfmc-modules` registry (loca

<ModuleCatalog />

## Related checks (monorepo)
## Related checks (user SFMC root)

```bash
npm run catalog-sync
npm run check-modules
```
Module install and catalog projection are done by `sfmc mod install` (the monorepo does not host business modules).

Official module service index: [Module services](../api/modules/index.md).
4 changes: 1 addition & 3 deletions docs/en/guide/troubleshooting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ Pick a symptom and work through the steps; the full checklist below remains for

```bash
npm run verify
npm run check-modules
npm run catalog-sync
```

### db-server won't start
Expand All @@ -31,7 +29,7 @@ curl http://127.0.0.1:3001/api/health

1. Read the load summary in the console and `<SFMC_ROOT>/.sfmc/logs/`
2. Run `mod build` and check esbuild errors
3. `npm run check-modules` (monorepo)
3. In your SFMC root, confirm the module is `mod install`ed and enabled in lock
4. Inbox conflicts blocking pre-start scan (see [Add-ons](./addons.md))

### Module enabled but no effect in-game
Expand Down
9 changes: 3 additions & 6 deletions docs/zh/dev/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ npm run verify
| 命令 | 说明 |
| ------ | ------ |
| `npm run verify` | 平台集成自检 |
| `npm run catalog-sync` | packages → catalog |
| `npm run check-modules` | catalog + manifest |

### 文档

Expand All @@ -57,11 +55,10 @@ npx syncpack format --check

| 命令 | 说明 |
| ------ | ------ |
| `npm run changeset` | 添加 changeset |
| `npm run prerelease-packages` | 本地 beta 一键 |
| `npm run pack:verify` | `npm pack` 冒烟 |
| `npm run changeset` | 添加 changeset;push `main` 后 CI 开 Version PR |
| `npm run pack:verify` | 可选:`npm pack` 冒烟 |

当前 **beta-only**。模块作者发包见 [发布你的模块](./publish.md) 附录
日常发版:**合并 Version PR 即可**,无需本地 `prerelease` / `release`。当前 **beta-only**。模块作者发包见 [发布你的模块](./publish.md)。

## 仓库规则

Expand Down
8 changes: 4 additions & 4 deletions docs/zh/dev/module-author.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -185,16 +185,16 @@ v3 是**完全可选**的能力扩展:不写 v3 字段也能 boot;旧 v2 模

### 兼容性与迁移

- **v2 → v3 自动迁移**:沙箱与 `check-modules` 都内置自动 migrate(`migrateV2toV3`)。v2 manifest 加载时直接补 `schemaVersion: 3`、保留所有原有字段,`semantic` 视为空。
- **v2 → v3 自动迁移**:沙箱与 CLI `check-modules`(`mod install` 后)都内置自动 migrate(`migrateV2toV3`)。v2 manifest 加载时直接补 `schemaVersion: 3`、保留所有原有字段,`semantic` 视为空。
- **缺省 semantic 合法**:v3 manifest 可以不写 `semantic`,等价于「暂时没声明语义」——后续可逐字段补全。
- **运行时校验**:保留 v2 的硬校验(id/name/type/configKey/requires/permissions/services 必填);`semantic` 子字段类型错时给 `errors: string[]`,但不拒绝启动(沙箱会剥掉坏字段、用 v3 顶层继续)。

### 配套工具

| 工具 | 行为 |
| --- | --- |
| `tools/check-modules.mjs` | v2 校验路径不变;v3 manifest 走新校验(`semantic` 字段类型错会报错)。 |
| `catalog-sync` / CLI `fetch-module` | 投影时把 `semantic` 块原样写入 catalog(仅读取,不主动注入) |
| CLI `scripts/module-install/check-modules.mjs` | `mod install` 后校验;v3 `semantic` 类型错会报错 |
| CLI `fetch-module` | 投影时把 `semantic` 块原样写入 catalog(仅读取,不主动注入) |

### 与缺口 1 / 3 的衔接

Expand All @@ -205,4 +205,4 @@ v3 `semantic` 不是终点,是**数据源**:

`publicApi` 当前只支持单签名;多载/重载留 TODO,等下一轮按真实模块诉求再加。

> v2 manifest 作者请保持现状不动;只有新增模块或主动升级时再写 v3。`fetch-module` 与 `catalog-sync` 不会因为写错 v3 而拒绝模块——错就报在 `check-modules`,不必动 v2 字段。
> v2 manifest 作者请保持现状不动;只有新增模块或主动升级时再写 v3。`fetch-module` 不会因为写错 v3 而拒绝模块——错就报在 install 后的 check-modules,不必动 v2 字段。
51 changes: 8 additions & 43 deletions docs/zh/dev/tools.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,22 @@
# 工具脚本

`packages/tools/` 为 **monorepo 私有**脚本(不发 npm)。模块安装在 `@sfmc-bds/cli`,脚手架在 `@sfmc-bds/devkit`;作者日常用扩展「SFMC Module」。Watch / 重建见 `packages/devkit/`。

**目录约定:** `packages/*` = 平台包;`modules/packages/*` = 业务模块。`catalog-sync` 扫描的是后者。
`packages/tools/` 为 **monorepo 私有**脚本(不发 npm)。模块安装在 `@sfmc-bds/cli`,脚手架在 `@sfmc-bds/devkit`。

## 常用

| 命令 | 作用 |
|------|------|
| `npm run verify` | 平台集成自检(CI 默认) |
| `npm run catalog-sync` | 扫 `modules/packages` → `catalog.json` |
| `npm run check-modules` | 离线校验 catalog + manifest |
| `sfmc mod search` / `sfmc mod install <id>` | 查注册表 / 安装(`@sfmc-bds/cli`) |
| `npx sfmc-new-module <id>` | 在空目录生成单包根(`@sfmc-bds/devkit`) |

## 平台自检

主仓默认无业务模块。`npm run verify` 一次完成离线检查 + db-server 集成 + 隔离 `SFMC_ROOT` 模拟。

| 脚本 | 何时用 |
|------|--------|
| `packages/tools/verify.mjs` | CI / 本地「平台能不能跑」 |
| `packages/tools/catalog-sync.mjs` | 装包后投影 catalog |
| `packages/tools/check-modules.mjs` | 离线校验(薄封装 → CLI 权威实现) |

约定检查见 [ESLint 约定](./eslint.md)。
| `sfmc mod install <id>` | 安装模块(独立 SFMC 根,非主仓) |
| `npx sfmc-new-module <id>` | 脚手架(`@sfmc-bds/devkit`) |

## fetch-module(CLI)
主仓默认 **不装业务模块**;catalog / lock 由用户环境里的 `mod install` 维护,主仓不再提供 `catalog-sync` / `check-modules` 入口。

```bash
sfmc mod install afk
sfmc mod install foo --from dir:/path --link
sfmc mod uninstall afk
# 等价:node packages/cli/scripts/module-install/fetch-module.mjs …
```
## 发版

默认注册表:`Tanya7z/sfmc-modules` 的 `index.json`(`npm` 字段优先)。

## new-module(devkit)

```bash
mkdir my-mod && cd my-mod
npx sfmc-new-module my-mod --name "我的模块"
# monorepo:node packages/devkit/scripts/new-module.mjs …
```

`--official` → `@sfmc-bds/module-*`。脚手架会写入 `eslint.config.js` 与 `.vscode/`。也可用 [sfmc-module-template](https://github.com/Tanya7z/sfmc-module-template) 或扩展 `SFMC: New Module`。

(作者测试)见 [测试沙箱](./testing.md)(`npm test`)。
日常:`npx changeset` → push `main` → Version Packages PR → 合并后 CI `ci-release-packages`。

## 共享库

- 模块 catalog / lock / install:`packages/cli/scripts/module-install/lib/`
- 仓内自检 / 发版:`packages/tools/lib/`(`paths`、`proc`、`npm-publish-packages` 等)

新脚本优先复用,勿复制 lock/catalog 读写。
- 模块 catalog / lock / install:`packages/cli/scripts/module-install/`
- 仓内自检 / 发版:`packages/tools/lib/`
7 changes: 2 additions & 5 deletions docs/zh/guide/modules.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,9 @@ sfmc mod reload

<ModuleCatalog />

## 相关校验(monorepo
## 相关校验(用户 SFMC 根

```bash
npm run catalog-sync
npm run check-modules
```
模块安装与 catalog 投影由 `sfmc mod install` 完成(主仓不装业务模块)。

官方模块服务清单见 [模块服务目录](../api/modules/index.md)。

4 changes: 1 addition & 3 deletions docs/zh/guide/troubleshooting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

```bash
npm run verify
npm run check-modules
npm run catalog-sync
```

### db-server 起不来
Expand All @@ -31,7 +29,7 @@ curl http://127.0.0.1:3001/api/health

1. 看控制台装载摘要与 `<SFMC_ROOT>/.sfmc/logs/`
2. `mod build` 看 esbuild 是否报错
3. `npm run check-modules`(monorepo)
3. 独立 SFMC 根下确认模块已 `mod install` 且 lock 为 enabled
4. 收件箱冲突是否挡住启动前扫描(见 [附加包](./addons.md))

### 模块已 enable 但游戏里没效果
Expand Down
2 changes: 1 addition & 1 deletion modules/sdk/@sfmc-sdk/schemas/module_catalog.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/DogeLakeDev/ScriptsForMinecraftServer/schemas/module_catalog.schema.json",
"title": "SFMC module catalog",
"description": "modules/catalog.json 本地 mirror;权威源为 github:Tanya7z/sfmc-modules。安装/卸载后请用 catalog-sync 或 fetch-module 投影。",
"description": "modules/catalog.json 本地 mirror;权威源为 github:Tanya7z/sfmc-modules。安装/卸载后由 fetch-module(sfmc mod install)投影。",
"type": "object",
"additionalProperties": false,
"properties": {
Expand Down
42 changes: 20 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,11 @@
"scripts": {
"build": "npm run build --workspaces --if-present",
"build:publishable": "node packages/tools/build-publishable.mjs",
"catalog-sync": "node packages/tools/catalog-sync.mjs",
"changeset": "changeset",
"check-modules": "node packages/tools/check-modules.mjs",
"ci-release-packages": "node packages/tools/run-release.mjs --ci",
"docs": "node packages/tools/docs.mjs",
"lint": "npm run build --workspace @sfmc-bds/eslint-plugin && eslint .",
"pack:verify": "node packages/tools/pack-verify.mjs",
"prerelease-packages": "node packages/tools/run-release.mjs --pre",
"release-packages": "node packages/tools/run-release.mjs --stable",
"start": "node packages/cli/dist/main.js",
"syncpack:fix": "node packages/tools/syncpack-fix.mjs",
"typecheck": "npm run typecheck --workspaces --if-present",
Expand Down
9 changes: 2 additions & 7 deletions packages/tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,11 @@

```bash
npm run verify # 平台集成自检(CI)
npm run catalog-sync
npm run check-modules
npx sfmc-esbuild-transpile # 各包 build
npx tsc7 --noEmit # typecheck
npm run docs -- serve|build
```

构建 bin 经 workspace 链接到根 `node_modules/.bin/`;包内脚本请用 bin 名,勿写 `../../../tools/...`
发版走 Changesets:**push `main` → Version Packages PR → 合并后 CI 自动 `ci-release-packages`**。本地一般不手动发

## 约定

- 脚本一律 `.mjs` + `// @ts-check`
- changeset / docs / pack-verify 等发版基建也在此目录,仅 CI / 维护者使用
构建 bin 经 workspace 链接;包内脚本请用 bin 名,勿写 `../../../tools/...`。
Loading