create-koishi-ce 1.6.1 → 1.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/bin.mjs
CHANGED
package/lib/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as renderManifest, i as readNpmrcRegistry, n as detectAgent, r as getLocalRegistry, t as start } from "./src-
|
|
1
|
+
import { a as renderManifest, i as readNpmrcRegistry, n as detectAgent, r as getLocalRegistry, t as start } from "./src-C4V0N-Vc.mjs";
|
|
2
2
|
export { detectAgent, getLocalRegistry, readNpmrcRegistry, renderManifest, start };
|
|
@@ -9,7 +9,7 @@ import { downloadTemplate } from "giget";
|
|
|
9
9
|
var package_default = {
|
|
10
10
|
name: "create-koishi-ce",
|
|
11
11
|
description: "Setup a Koishi application",
|
|
12
|
-
version: "1.6.
|
|
12
|
+
version: "1.6.3",
|
|
13
13
|
type: "module",
|
|
14
14
|
main: "./lib/index.mjs",
|
|
15
15
|
module: "./lib/index.mjs",
|
|
@@ -235,12 +235,17 @@ function baseManifest() {
|
|
|
235
235
|
return {
|
|
236
236
|
type: "module",
|
|
237
237
|
packageManager: `bun@${Bun.version}`,
|
|
238
|
-
workspaces: [
|
|
238
|
+
workspaces: [
|
|
239
|
+
"plugins/*",
|
|
240
|
+
"external/**",
|
|
241
|
+
"!external/**/node_modules/**"
|
|
242
|
+
],
|
|
239
243
|
scripts: {
|
|
240
244
|
start: "koishi start",
|
|
241
245
|
dev: "NODE_ENV=development koishi start",
|
|
242
246
|
new: "koishi-scripts setup",
|
|
243
247
|
clone: "koishi-scripts clone",
|
|
248
|
+
update: "koishi-scripts update",
|
|
244
249
|
build: "koishi-scripts build",
|
|
245
250
|
"release:version": "koishi-scripts version",
|
|
246
251
|
"release:dryrun": "bun run release:version && bun run build && koishi-scripts publish --dry-run",
|
package/package.json
CHANGED
|
@@ -231,9 +231,12 @@ function expectTemplateFiles(dir: string): void {
|
|
|
231
231
|
) as Record<string, unknown>;
|
|
232
232
|
expect(manifest["private"]).toBe(true);
|
|
233
233
|
expect(manifest["version"]).toBe("0.0.0");
|
|
234
|
+
// globstar + 负向排除形态:external 任意深度(含克隆的 monorepo
|
|
235
|
+
// 子包)都是成员,node_modules 残留被排除(与 template.test.ts 同步)
|
|
234
236
|
expect(manifest["workspaces"]).toEqual([
|
|
235
237
|
"plugins/*",
|
|
236
|
-
"external
|
|
238
|
+
"external/**",
|
|
239
|
+
"!external/**/node_modules/**",
|
|
237
240
|
]);
|
|
238
241
|
}
|
|
239
242
|
|
|
@@ -56,6 +56,8 @@ test("内置模板提供插件开发全链脚本入口(koishi-scripts 子命
|
|
|
56
56
|
// new 用主命令名 setup(new/create/init 是 koishi-scripts 的别名)
|
|
57
57
|
expect(scripts["new"]).toBe("koishi-scripts setup");
|
|
58
58
|
expect(scripts["clone"]).toBe("koishi-scripts clone");
|
|
59
|
+
// update 是白名单安全更新(只碰 @koishi-ce/*,替代裸 bun update)
|
|
60
|
+
expect(scripts["update"]).toBe("koishi-scripts update");
|
|
59
61
|
expect(scripts["build"]).toBe("koishi-scripts build");
|
|
60
62
|
expect(scripts["release:version"]).toBe(
|
|
61
63
|
"koishi-scripts version",
|
|
@@ -222,6 +224,14 @@ test("renderManifest 渲染内置模板:常规改写生效,prod 模式保留
|
|
|
222
224
|
expect(output.dependencies.koishi).toBe(
|
|
223
225
|
"npm:@koishi-ce/koishi-shim@^4.18.11",
|
|
224
226
|
);
|
|
227
|
+
// workspaces 是 globstar + 负向排除形态:external 任意深度(含克隆的
|
|
228
|
+
// monorepo 子包)都是成员,node_modules 排除搬迁残留——配置页的
|
|
229
|
+
// 「添加插件」列表按同一份声明展开收录,写法回退即嵌套不可见
|
|
230
|
+
expect(output.workspaces).toEqual([
|
|
231
|
+
"plugins/*",
|
|
232
|
+
"external/**",
|
|
233
|
+
"!external/**/node_modules/**",
|
|
234
|
+
]);
|
|
225
235
|
|
|
226
236
|
const prod = JSON.parse(
|
|
227
237
|
renderManifest(baseManifest(), "my-app", true),
|
package/src/template/README.md
CHANGED
|
@@ -28,6 +28,14 @@ bun run dev # 启动(开发模式,启用 HMR 热更新)
|
|
|
28
28
|
|
|
29
29
|
根依赖中的四行 npm alias——`"koishi": "npm:@koishi-ce/koishi-shim@^4.18.11"`、`"@koishijs/plugin-console": "npm:@koishi-ce/console-shim@^5.30.11"`、`"@koishijs/core": "npm:@koishi-ce/koishi-shim@4.18.11"`、`"@koishijs/loader": "npm:@koishi-ce/koishi-shim@^4.18.11"`——已把上游生态的 peer 依赖全部钉回 @koishi-ce 框架(前两行与后两行分别只涉及 koishi-shim / console-shim 两个包;**请勿删除或改写这四行**),不会形成第二份框架 / console / loader 副本。
|
|
30
30
|
|
|
31
|
+
## 更新依赖
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
bun run update # 安全更新:只更新 @koishi-ce/* 生态位依赖
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**请勿裸跑 `bun update`**:那是全树更新语义,会连带给市场安装的第三方插件与全部传递依赖重新求解,任一上游漂移都可能破坏运行时。`bun run update` 只显式更新 `@koishi-ce/*` 依赖(alias 冻结线不受影响);第三方插件的版本请经控制台「插件市场」操作。
|
|
38
|
+
|
|
31
39
|
## 自定义插件
|
|
32
40
|
|
|
33
41
|
手动在 `plugins/` 目录下创建插件包,或经脚手架进入 `external/` 工作区:
|
|
@@ -35,7 +43,7 @@ bun run dev # 启动(开发模式,启用 HMR 热更新)
|
|
|
35
43
|
- `bun run new <名称>` —— 生成插件骨架到 `external/`(`--console` 附带控制台前端扩展)
|
|
36
44
|
- `bun run clone <仓库>` —— 克隆已有插件源码到 `external/` 本地联动调试
|
|
37
45
|
|
|
38
|
-
两种来源的插件都在 `koishi.yml` 中以相对路径引用(如 `./plugins/my-plugin`、`./external/my-plugin`)即可启用;Bun 直接加载 TypeScript
|
|
46
|
+
两种来源的插件都在 `koishi.yml` 中以相对路径引用(如 `./plugins/my-plugin`、`./external/my-plugin`)即可启用;Bun 直接加载 TypeScript 源码,无需预编译。克隆来的 **monorepo 形态插件仓库**(插件在 `packages/` 等子目录)无需平铺——`workspaces` 声明的 `external/**` 通配任意深度,控制台「添加插件」列表同样按此声明收录,子包直接可见可启用(搬迁自其它包管理器的仓库若带着旧 `node_modules`,负向声明已将其排除,建议顺手删除节省空间)。
|
|
39
47
|
|
|
40
48
|
## 插件构建与发布
|
|
41
49
|
|
package/src/template.ts
CHANGED
|
@@ -92,7 +92,16 @@ export function baseManifest(): Manifest {
|
|
|
92
92
|
type: "module",
|
|
93
93
|
// 本项目只用 Bun:钉住创建时的 Bun 版本(bun run 亦据此选择解释器)
|
|
94
94
|
packageManager: `bun@${Bun.version}`,
|
|
95
|
-
workspaces
|
|
95
|
+
// globstar + 负向排除(Bun workspaces 支持完整 glob 语法):external
|
|
96
|
+
// 下任意深度的插件包(含克隆来的 monorepo 形态 packages/ 子包)都是
|
|
97
|
+
// workspace 成员;node_modules 排除搬迁残留的依赖目录(包管理器
|
|
98
|
+
// 对其另有管理,混入成员会污染解析)。配置页的「添加插件」列表按
|
|
99
|
+
// 同一份声明展开收录,声明写多深列表就能看多深
|
|
100
|
+
workspaces: [
|
|
101
|
+
"plugins/*",
|
|
102
|
+
"external/**",
|
|
103
|
+
"!external/**/node_modules/**",
|
|
104
|
+
],
|
|
96
105
|
scripts: {
|
|
97
106
|
start: "koishi start",
|
|
98
107
|
// bun run 走 Bun Shell,`NODE_ENV=...` 前缀天然跨平台,无需 cross-env
|
|
@@ -101,10 +110,13 @@ export function baseManifest(): Manifest {
|
|
|
101
110
|
// 本工作区 plugins/ 与 external/;纯运行 bot 的项目用不到这些入口,
|
|
102
111
|
// prod 模式删 devDependencies 后它们自然失效):
|
|
103
112
|
// new 生成插件骨架到 external/,clone 克隆已有插件仓库本地联动,
|
|
113
|
+
// update 白名单更新本项目的 @koishi-ce/* 依赖(裸 bun update 是
|
|
114
|
+
// 全树更新语义,会拉动第三方插件与全部传递依赖,勿用),
|
|
104
115
|
// build / release* 构建并发布 external/ 下的插件(version → build
|
|
105
116
|
// → publish 三环,dry-run 为演练形态)
|
|
106
117
|
new: "koishi-scripts setup",
|
|
107
118
|
clone: "koishi-scripts clone",
|
|
119
|
+
update: "koishi-scripts update",
|
|
108
120
|
build: "koishi-scripts build",
|
|
109
121
|
"release:version": "koishi-scripts version",
|
|
110
122
|
"release:dryrun":
|