补丁
运行 Koishi 、 Satori 、 Satori 适配器和一些 Cordis 插件的补丁 科尔地斯 4,保存在一个地方,并用一个命令将线接入纱线,pnpm或npm.
每个补丁都针对一个准确的上游版本,列于 patchbay.json。没有重新发布:您的软件包管理器安装上游柏油球并应用此软件包的补丁.
使用
npm i -D @chatluna/patchbay # or yarn add -D / pnpm add -D
npx patchbay sync # writes .patchbay/ and the package-manager config
npm install # or yarn install / pnpm install
提交 .patchbay/ 与配置组合 sync 写作。 运行 patchbay sync 在升级了补丁字后再次出现。 它取代了上一个版本所写的每根针.
| 软件包管理器 | 什麽 sync 写入 | 当补丁适用时 |
|---|---|---|
| 亚伦 2+ | resolutions → patch:<pkg>@npm:<version>#~/.patchbay/<pkg>@<version>.patch | 安装时 |
| 页:1 | pnpm-workspace.yaml数字 : overrides, (中文(简体) ), patchedDependencies, (中文(简体) ), allowUnusedPatches | 安装时 |
| 无 | overrides直接依附于同一种类, postinstall: patchbay apply | 安装后, 设置 |
sync 从 packageManager,然后是锁文件,然后是运行它。 过 --pm yarn|pnpm|npm 自己选择 Yarn 1没有补丁支持,被拒绝.
每个被补丁的包被固定在其被补丁的版本上,连同这些别名:
koishi→@koishijs/coreminato→@cordisjs/plugin-database
一个后来安装其中之一的插件得到补丁构建.
在npm时, patchbay apply 保存它在每个软件包中应用的补丁的副本(.patchbay.patch) (中文(简体) ). 它跳过已经流过的软件包,并在应用更新的软件包之前取消更旧的补丁 .
从代码
import { apply, sync } from '@chatluna/patchbay'
const pm = sync(projectDir) // 'yarn' | 'pnpm' | 'npm'
// ...run the install...
if (pm === 'npm') apply(projectDir)
维护
yarn refresh edit <name> # unpack upstream to .work/<pkg>/{a,b}, current patch applied to b
# edit .work/<pkg>/b
yarn refresh commit <name> # diff a → b into patches/<pkg>@<version>.patch
yarn verify # every patch applies to its upstream tarball
yarn test # unit tests plus real yarn, pnpm and npm installs
要补齐新软件包或版本,请将其条目添加到 patchbay.json运行 yarn refresh edit <name>做出改变,然后承诺.
许可证
麻省理工学院