create-koishi-ce 1.6.0 → 1.6.1

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
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bun
2
- import { t as start } from "./src-C3GEQDVG.mjs";
2
+ import { t as start } from "./src-Dekgnxqt.mjs";
3
3
  //#region src/bin.ts
4
4
  /**
5
5
  * create-koishi-ce 的 CLI 可执行入口:shebang 由 rolldown 原样保留到
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-C3GEQDVG.mjs";
1
+ import { a as renderManifest, i as readNpmrcRegistry, n as detectAgent, r as getLocalRegistry, t as start } from "./src-Dekgnxqt.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.0",
12
+ version: "1.6.1",
13
13
  type: "module",
14
14
  main: "./lib/index.mjs",
15
15
  module: "./lib/index.mjs",
@@ -279,6 +279,7 @@ function baseManifest() {
279
279
  "@koishi-ce/plugin-server-temp": "^1.0.0",
280
280
  "@koishi-ce/plugin-status": "^1.0.0",
281
281
  "@koishi-ce/plugin-theme-vanilla": "^1.0.0",
282
+ "@koishi-ce/plugin-welcome": "^1.0.0",
282
283
  koishi: "npm:@koishi-ce/koishi-shim@^4.18.11",
283
284
  "@koishijs/plugin-console": "npm:@koishi-ce/console-shim@^5.30.11",
284
285
  "@koishijs/core": "npm:@koishi-ce/koishi-shim@4.18.11",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-koishi-ce",
3
3
  "description": "Setup a Koishi application",
4
- "version": "1.6.0",
4
+ "version": "1.6.1",
5
5
  "type": "module",
6
6
  "main": "./lib/index.mjs",
7
7
  "module": "./lib/index.mjs",
@@ -143,6 +143,7 @@ test("koishi.yml 预写策略:sqlite 默认启用开箱数据库,非必需
143
143
  "status",
144
144
  "sandbox",
145
145
  "theme-vanilla",
146
+ "welcome",
146
147
  ]) {
147
148
  expect(yml).toContain(name);
148
149
  expect(yml).not.toContain(`~${name}`);
@@ -172,6 +173,43 @@ test("koishi.yml 预写策略:sqlite 默认启用开箱数据库,非必需
172
173
  );
173
174
  });
174
175
 
176
+ test("koishi.yml 预写条目与模板依赖对账:CE 插件必须在册,官方 adapter 只预写不预装", () => {
177
+ const yml = templateFiles["koishi.yml"] ?? "";
178
+ // 配置页导出形态:插件条目在分组内 4 空格缩进,键形如 name:uid:
179
+ const entries = [
180
+ ...yml.matchAll(
181
+ /^[ ]{4}(~?)([a-z][a-z0-9-]*):[a-z0-9]{6}:/gm,
182
+ ),
183
+ ].map((match) => ({ name: match[2]! }));
184
+ expect(entries.length).toBeGreaterThan(40);
185
+ const manifest = baseManifest();
186
+ const installed = {
187
+ ...manifest.dependencies,
188
+ ...manifest.devDependencies,
189
+ };
190
+ for (const { name } of entries) {
191
+ const pkg = `@koishi-ce/plugin-${name}`;
192
+ if (name.startsWith("adapter-")) {
193
+ // 未再分发的官方 adapter:占位条目而已,预装反成死依赖
194
+ expect(installed[pkg]).toBeUndefined();
195
+ continue;
196
+ }
197
+ // 启用与否都随模板预装——缺依赖则新项目开箱 failed to resolve
198
+ //(welcome 独立插件化时曾漏装依赖,此对账即为防再犯)
199
+ expect(installed[pkg]).toBe("^1.0.0");
200
+ }
201
+ // 反向对账:生产依赖里的 CE 插件都必须有 yml 条目,不许装而未预写
202
+ for (const key of Object.keys(
203
+ manifest.dependencies ?? {},
204
+ )) {
205
+ if (!key.startsWith("@koishi-ce/plugin-")) continue;
206
+ const name = key.slice("@koishi-ce/plugin-".length);
207
+ expect(
208
+ entries.some((entry) => entry.name === name),
209
+ ).toBe(true);
210
+ }
211
+ });
212
+
175
213
  test("renderManifest 渲染内置模板:常规改写生效,prod 模式保留 koishi alias", () => {
176
214
  const output = JSON.parse(
177
215
  renderManifest(baseManifest(), "my-app", false),
package/src/template.ts CHANGED
@@ -145,6 +145,7 @@ export function baseManifest(): Manifest {
145
145
  "@koishi-ce/plugin-server-temp": "^1.0.0",
146
146
  "@koishi-ce/plugin-status": "^1.0.0",
147
147
  "@koishi-ce/plugin-theme-vanilla": "^1.0.0",
148
+ "@koishi-ce/plugin-welcome": "^1.0.0",
148
149
  // 上游裸名占位:npm alias 钉到 @koishi-ce 的 koishi shim(勿删,
149
150
  // 语义见文件头注释);版本必须保持 4.18.x 冻结线以满足 ^4 peer
150
151
  koishi: "npm:@koishi-ce/koishi-shim@^4.18.11",