@longzai-intelligence-bun/config 0.0.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/dist/index.d.ts +84 -0
- package/dist/index.js +1 -0
- package/package.json +32 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* bun test 工具配置类型
|
|
4
|
+
*
|
|
5
|
+
* 定义 lzi-bun-cli 的 test 命令在 lzi-dev.config.ts 中的配置结构。
|
|
6
|
+
* 字段命名对齐 vitest 的 test.* 配置项,便于心智一致与将来可移植。
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* bun test 命令配置
|
|
10
|
+
*
|
|
11
|
+
* 字段命名对齐 vitest 的 test.* 配置项:
|
|
12
|
+
*
|
|
13
|
+
* - passWithNoTests ← vitest test.passWithNoTests
|
|
14
|
+
* - include ← vitest test.include
|
|
15
|
+
*/
|
|
16
|
+
type BunTestConfig = {
|
|
17
|
+
/**
|
|
18
|
+
* 零测试文件时是否放行 exit 0
|
|
19
|
+
*
|
|
20
|
+
* 对齐 vitest 的 test.passWithNoTests。
|
|
21
|
+
*
|
|
22
|
+
* 适配 type-only / facade 包(仅 re-export barrel、无测试源码):
|
|
23
|
+
* 这类包在 turbo test 扇出中必须能干净通过,而非因「没有测试」失败。
|
|
24
|
+
*
|
|
25
|
+
* - true(默认):放行,打印跳过提示后 exit 0
|
|
26
|
+
* - false:报错 exit 1,用于强制要求测试的严格包
|
|
27
|
+
*
|
|
28
|
+
* 默认值在命令实现内用 `?? true` 处理
|
|
29
|
+
* (与 dev-tools defineConfig identity 工厂模式一致,不在工厂层合并默认值)
|
|
30
|
+
*
|
|
31
|
+
* @default true
|
|
32
|
+
*/
|
|
33
|
+
passWithNoTests?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* 测试文件 glob 列表(相对 cwd),用于零测试预检
|
|
36
|
+
*
|
|
37
|
+
* 对齐 vitest 的 test.include。
|
|
38
|
+
*
|
|
39
|
+
* 命令在调用 bun test 前,先用这些 glob 扫描 cwd 下的测试文件,
|
|
40
|
+
* 命中 0 个时按 {@link passWithNoTests} 决策放行或失败。
|
|
41
|
+
*
|
|
42
|
+
* 默认值(命令实现内处理):src 下与 tests 目录下的点 test.ts / test.tsx 文件
|
|
43
|
+
*/
|
|
44
|
+
include?: string[];
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* lzi-bun-cli 配置
|
|
48
|
+
*
|
|
49
|
+
* 定义 lzi-bun.config.ts 配置文件的顶层结构。
|
|
50
|
+
* 仅含 lzi-bun-cli 专属域;dev-cli 的发布等配置见 lzi-dev.config.ts。
|
|
51
|
+
*/
|
|
52
|
+
type LziBunConfig = {
|
|
53
|
+
/**
|
|
54
|
+
* bun test 命令配置
|
|
55
|
+
*/
|
|
56
|
+
test?: BunTestConfig;
|
|
57
|
+
};
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/index.d.ts
|
|
60
|
+
/**
|
|
61
|
+
* 定义 lzi-bun-cli 配置
|
|
62
|
+
*
|
|
63
|
+
* 提供类型推导,用户无需手动 satisfies。
|
|
64
|
+
*
|
|
65
|
+
* 与 dev-tools 的 defineConfig 一致:identity 工厂,仅做类型推导,
|
|
66
|
+
* 不在工厂层合并默认值——默认值由各命令实现内用 `?? fallback` 处理。
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* import { defineConfig } from '@longzai-intelligence-bun/config';
|
|
71
|
+
*
|
|
72
|
+
* export default defineConfig({
|
|
73
|
+
* test: {
|
|
74
|
+
* passWithNoTests: false,
|
|
75
|
+
* },
|
|
76
|
+
* });
|
|
77
|
+
* ```;
|
|
78
|
+
*
|
|
79
|
+
* @param config - lzi-bun-cli 配置对象
|
|
80
|
+
* @returns 原样返回传入的配置对象
|
|
81
|
+
*/
|
|
82
|
+
declare const defineConfig: (config: LziBunConfig) => LziBunConfig;
|
|
83
|
+
//#endregion
|
|
84
|
+
export { type BunTestConfig, type LziBunConfig, defineConfig };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=e=>e;export{e as defineConfig};
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@longzai-intelligence-bun/config",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Longzai Intelligence bun 工具配置类型定义",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"type": "module",
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "lzi-builder",
|
|
20
|
+
"build:prod": "NODE_ENV=production bun run build",
|
|
21
|
+
"prepublishOnly": "bun run build:prod",
|
|
22
|
+
"typecheck": "bun run typecheck:app && bun run typecheck:node && bun run typecheck:test",
|
|
23
|
+
"typecheck:app": "lzi-tsgo typecheck tsconfig/app.json",
|
|
24
|
+
"typecheck:node": "lzi-tsgo typecheck tsconfig/node.json",
|
|
25
|
+
"typecheck:test": "lzi-tsgo typecheck tsconfig/test.json",
|
|
26
|
+
"lint": "oxlint && oxfmt --check",
|
|
27
|
+
"lint:fix": "oxlint --fix && oxfmt",
|
|
28
|
+
"test": "bun test",
|
|
29
|
+
"test:watch": "bun test --watch",
|
|
30
|
+
"test:coverage": "bun test --coverage"
|
|
31
|
+
}
|
|
32
|
+
}
|