create-koishi-ce 1.1.0 → 1.2.0
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 start, i as renderManifest, n as getLocalRegistry, r as readNpmrcRegistry, t as detectAgent } from "./src-
|
|
1
|
+
import { a as start, i as renderManifest, n as getLocalRegistry, r as readNpmrcRegistry, t as detectAgent } from "./src-BwIHbUAf.mjs";
|
|
2
2
|
export { detectAgent, getLocalRegistry, readNpmrcRegistry, renderManifest, start };
|
|
@@ -11,7 +11,7 @@ import parse from "yargs-parser";
|
|
|
11
11
|
var package_default = {
|
|
12
12
|
name: "create-koishi-ce",
|
|
13
13
|
description: "Setup a Koishi application",
|
|
14
|
-
version: "1.
|
|
14
|
+
version: "1.2.0",
|
|
15
15
|
type: "module",
|
|
16
16
|
main: "./lib/index.mjs",
|
|
17
17
|
module: "./lib/index.mjs",
|
|
@@ -147,7 +147,7 @@ bun run dev # 启动(开发模式,启用 HMR 热更新)
|
|
|
147
147
|
|
|
148
148
|
推荐在控制台「插件市场」页安装(已预配 registry.koishi.chat 镜像源);也可以手动 \`bun add <包名>\` 后在 \`koishi.yml\` 中启用。
|
|
149
149
|
|
|
150
|
-
上游官方 adapter(如 adapter-discord / adapter-telegram)、数据库插件(如 database-sqlite)与社区 koishi-plugin-*
|
|
150
|
+
上游官方 adapter(如 adapter-discord / adapter-telegram)、数据库插件(如 database-sqlite)与社区 koishi-plugin-* 插件均可直接安装:根依赖中的四行 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/core-shim@4.18.11"\`、\`"@koishijs/loader": "npm:@koishi-ce/loader-shim@^4.6.11"\`——已把上游生态的 peer 依赖全部钉回 @koishi-ce 框架(**请勿删除或改写这四行**),不会形成第二份框架 / console / loader 副本。analytics 等依赖数据库的插件请先安装数据库插件,再去掉配置中对应的 \`~\` 前缀启用。
|
|
151
151
|
|
|
152
152
|
## 自定义插件
|
|
153
153
|
|
|
@@ -191,7 +191,10 @@ function baseManifest() {
|
|
|
191
191
|
"@koishi-ce/plugin-sandbox": "^1.0.0",
|
|
192
192
|
"@koishi-ce/plugin-server": "^1.0.0",
|
|
193
193
|
"@koishi-ce/plugin-status": "^1.0.0",
|
|
194
|
-
koishi: "npm:@koishi-ce/koishi-shim@^4.18.11"
|
|
194
|
+
koishi: "npm:@koishi-ce/koishi-shim@^4.18.11",
|
|
195
|
+
"@koishijs/plugin-console": "npm:@koishi-ce/console-shim@^5.30.11",
|
|
196
|
+
"@koishijs/core": "npm:@koishi-ce/core-shim@4.18.11",
|
|
197
|
+
"@koishijs/loader": "npm:@koishi-ce/loader-shim@^4.6.11"
|
|
195
198
|
},
|
|
196
199
|
devDependencies: {
|
|
197
200
|
"@koishi-ce/client": "^1.0.0",
|
package/package.json
CHANGED
|
@@ -4,9 +4,16 @@ import { baseManifest, templateFiles } from "../template.ts";
|
|
|
4
4
|
|
|
5
5
|
test("内置模板依赖纯度:不含任何 @koishijs / koishi-plugin 官方生态包", () => {
|
|
6
6
|
const { dependencies, devDependencies } = baseManifest();
|
|
7
|
+
// 四个上游名是刻意的 npm alias 占位(koishi 裸名 / @koishijs/plugin-console /
|
|
8
|
+
// @koishijs/core / @koishijs/loader),其余必须是 @koishi-ce 作用域
|
|
9
|
+
const guarded = new Set([
|
|
10
|
+
"koishi",
|
|
11
|
+
"@koishijs/plugin-console",
|
|
12
|
+
"@koishijs/core",
|
|
13
|
+
"@koishijs/loader",
|
|
14
|
+
]);
|
|
7
15
|
for (const key of Object.keys(dependencies ?? {})) {
|
|
8
|
-
|
|
9
|
-
expect(key === "koishi" || key.startsWith("@koishi-ce/")).toBe(true);
|
|
16
|
+
expect(guarded.has(key) || key.startsWith("@koishi-ce/")).toBe(true);
|
|
10
17
|
}
|
|
11
18
|
const toolchain = new Set(["bun-types", "cross-env"]);
|
|
12
19
|
for (const key of Object.keys(devDependencies ?? {})) {
|
|
@@ -22,6 +29,22 @@ test("内置模板以 npm alias 钉住 koishi 裸名,版本保持 4.18.x 冻
|
|
|
22
29
|
expect(request ?? "").toMatch(/^npm:@koishi-ce\/koishi-shim@\^4\./);
|
|
23
30
|
});
|
|
24
31
|
|
|
32
|
+
test("内置模板钉住 console / core / loader 上游 peer 名,防 Bun 自动装官方全家桶", () => {
|
|
33
|
+
const { dependencies } = baseManifest();
|
|
34
|
+
// CE webui 插件 peer ^5.30.11:alias 版本冻结 5.30.x 线
|
|
35
|
+
expect(dependencies?.["@koishijs/plugin-console"]).toBe(
|
|
36
|
+
"npm:@koishi-ce/console-shim@^5.30.11",
|
|
37
|
+
);
|
|
38
|
+
// @koishi-ce/loader 的 peer 精确锁 4.18.11:alias 必须逐字相等(不带 ^)
|
|
39
|
+
expect(dependencies?.["@koishijs/core"]).toBe(
|
|
40
|
+
"npm:@koishi-ce/core-shim@4.18.11",
|
|
41
|
+
);
|
|
42
|
+
// config / hmr 插件的 loader peer:alias 版本冻结 4.6.x 线
|
|
43
|
+
expect(dependencies?.["@koishijs/loader"]).toBe(
|
|
44
|
+
"npm:@koishi-ce/loader-shim@^4.6.11",
|
|
45
|
+
);
|
|
46
|
+
});
|
|
47
|
+
|
|
25
48
|
test("内置模板静态文件齐备,koishi.yml 预配 market 镜像源", () => {
|
|
26
49
|
for (const file of [
|
|
27
50
|
".env",
|
|
@@ -52,6 +75,15 @@ test("renderManifest 渲染内置模板:常规改写生效,prod 模式保留
|
|
|
52
75
|
const prod = JSON.parse(renderManifest(baseManifest(), "my-app", true));
|
|
53
76
|
expect("workspaces" in prod).toBe(false);
|
|
54
77
|
expect("devDependencies" in prod).toBe(false);
|
|
55
|
-
//
|
|
78
|
+
// 四个上游名 alias 是运行时依赖,prod 模式下必须原样保留
|
|
56
79
|
expect(prod.dependencies.koishi).toBe("npm:@koishi-ce/koishi-shim@^4.18.11");
|
|
80
|
+
expect(prod.dependencies["@koishijs/plugin-console"]).toBe(
|
|
81
|
+
"npm:@koishi-ce/console-shim@^5.30.11",
|
|
82
|
+
);
|
|
83
|
+
expect(prod.dependencies["@koishijs/core"]).toBe(
|
|
84
|
+
"npm:@koishi-ce/core-shim@4.18.11",
|
|
85
|
+
);
|
|
86
|
+
expect(prod.dependencies["@koishijs/loader"]).toBe(
|
|
87
|
+
"npm:@koishi-ce/loader-shim@^4.6.11",
|
|
88
|
+
);
|
|
57
89
|
});
|
package/src/template.ts
CHANGED
|
@@ -107,7 +107,7 @@ bun run dev # 启动(开发模式,启用 HMR 热更新)
|
|
|
107
107
|
|
|
108
108
|
推荐在控制台「插件市场」页安装(已预配 registry.koishi.chat 镜像源);也可以手动 \`bun add <包名>\` 后在 \`koishi.yml\` 中启用。
|
|
109
109
|
|
|
110
|
-
上游官方 adapter(如 adapter-discord / adapter-telegram)、数据库插件(如 database-sqlite)与社区 koishi-plugin-*
|
|
110
|
+
上游官方 adapter(如 adapter-discord / adapter-telegram)、数据库插件(如 database-sqlite)与社区 koishi-plugin-* 插件均可直接安装:根依赖中的四行 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/core-shim@4.18.11"\`、\`"@koishijs/loader": "npm:@koishi-ce/loader-shim@^4.6.11"\`——已把上游生态的 peer 依赖全部钉回 @koishi-ce 框架(**请勿删除或改写这四行**),不会形成第二份框架 / console / loader 副本。analytics 等依赖数据库的插件请先安装数据库插件,再去掉配置中对应的 \`~\` 前缀启用。
|
|
111
111
|
|
|
112
112
|
## 自定义插件
|
|
113
113
|
|
|
@@ -155,6 +155,14 @@ export function baseManifest(): Manifest {
|
|
|
155
155
|
// 上游裸名占位:npm alias 钉到 @koishi-ce 的 koishi shim(勿删,
|
|
156
156
|
// 语义见文件头注释);版本必须保持 4.18.x 冻结线以满足 ^4 peer
|
|
157
157
|
koishi: "npm:@koishi-ce/koishi-shim@^4.18.11",
|
|
158
|
+
// 上游 console 名占位:CE 插件的 peer 声明上游名,无归属时 Bun
|
|
159
|
+
// 会自动装下 npm 官方 console 全家桶形成双实例;版本冻结 5.30.x
|
|
160
|
+
"@koishijs/plugin-console": "npm:@koishi-ce/console-shim@^5.30.11",
|
|
161
|
+
// 上游 core 名占位:@koishi-ce/loader 的 peer 精确锁 4.18.11,
|
|
162
|
+
// alias 须逐字相等(不带 ^),版本冻结勿 bump
|
|
163
|
+
"@koishijs/core": "npm:@koishi-ce/core-shim@4.18.11",
|
|
164
|
+
// 上游 loader 名占位:config / hmr 插件的 peer;版本冻结 4.6.x
|
|
165
|
+
"@koishijs/loader": "npm:@koishi-ce/loader-shim@^4.6.11",
|
|
158
166
|
},
|
|
159
167
|
devDependencies: {
|
|
160
168
|
"@koishi-ce/client": "^1.0.0",
|