3 Commits

Author SHA1 Message Date
xiaoju af23c3dce8 chore: 测试框架从 bun:test 迁移到 vitest
- 36 个 test 文件 bun:test → vitest
- Bun.spawn() → execFileSync('tsx', ...)
- Bun.file() → readFileSync
- import.meta.dir → import.meta.dirname (tests) / __dirname (CLI source)
- 删除 bun-types devDep
- 添加 vitest + tsx devDep
- CLI shebang bun → node
- 30/36 test files pass, 558/617 tests pass

Refs #62
2026-06-03 03:52:56 +00:00
xiaomo 3cfcf6db89 Merge pull request 'feat: cli 包完整 build 支持(tsc emit + Node 兼容)' (#61) from feat/58-cli-build into main 2026-06-03 03:28:31 +00:00
xiaoju 5f562cbc5a feat: cli 包完整 build 支持(tsc emit + Node 兼容)
- tsconfig: 启用 emit (rootDir/outDir/composite), 添加 project references
- shebang: bun → node
- bin: src/index.ts → dist/index.js
- import.meta.dir → import.meta.dirname (去掉 Bun 专有 API)
- prompts 目录移到包根, src/dist 路径统一
- 修复 exactOptionalPropertyTypes 类型错误

Fixes #58
2026-06-03 02:29:01 +00:00
8 changed files with 15 additions and 9 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
"packages/*"
],
"devDependencies": {
"@shazhou/proman": "0.1.1",
"@shazhou/proman": "0.2.0",
"tsx": "^4.22.4",
"ulidx": "^2.4.1",
"vitest": "^4.1.8"
+1 -1
View File
@@ -3,7 +3,7 @@
"version": "0.2.0",
"type": "module",
"bin": {
"ocas": "src/index.ts"
"ocas": "dist/index.js"
},
"dependencies": {
"@ocas/core": "workspace:*",
+1 -1
View File
@@ -13,7 +13,7 @@ const pkgPath = resolve(import.meta.dirname, "../package.json");
describe("ocas binary", () => {
test("T1: ocas bin entry exists in package.json", async () => {
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
expect(pkg.bin.ocas).toBe("src/index.ts");
expect(pkg.bin.ocas).toBe("dist/index.js");
});
test("T2: no legacy bin entries (json-cas, ucas)", async () => {
@@ -2,7 +2,7 @@ import { describe, expect, test } from "vitest";
import { readFileSync } from "node:fs";
import { join } from "node:path";
const usagePath = join(import.meta.dirname, "usage.md");
const usagePath = join(import.meta.dirname, "..", "prompts", "usage.md");
describe("usage.md doc cleanup (D)", () => {
test("D3. usage.md does not reference legacy openStoreAndVarStore / createVariableStore", () => {
+8 -5
View File
@@ -1,10 +1,13 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"composite": false,
"declaration": false,
"declarationMap": false,
"noEmit": true
"rootDir": "src",
"outDir": "dist"
},
"include": ["src"]
"include": ["src"],
"exclude": ["src/**/*.test.ts"],
"references": [
{ "path": "../core" },
{ "path": "../fs" }
]
}
+3
View File
@@ -3,10 +3,13 @@ runtime: bun
packages:
- name: "@ocas/core"
path: packages/core
type: lib
- name: "@ocas/fs"
path: packages/fs
type: lib
- name: "@ocas/cli"
path: packages/cli
type: cli
changeset:
fixed: true
release: