v0.5.0: 重新组织目录结构,按职责拆分
- Shrimp.ts (875 行) 按类拆分到 Shrimp/(7 文件: Shrimp, ShrimpModule, ShrimpTableModule, ShrimpPower, ShrimpCrud, UserRoleModule, OperationLogModule) - forMongo/: MongoShrimpCrud + MongoShrimp(原 ShrimpServer 的 mongo 装配部分,无 express) - forExpress/: buildShrimpRouter + jwtAuth + types - main/: index(0 依赖核心) + expmon(express+mongo 整合,导出 ShrimpServer) + types(纯协议) - 入口子路径 server → expmon(express+mongo 整合方案命名更准确) - 删除冗余的 index.ts / core.ts(合并为 main/index.ts)
This commit is contained in:
+2
-2
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect } from "vitest"
|
||||
import { ShrimpError, ShrimpCode } from "../src"
|
||||
import type { ILabel } from "../src"
|
||||
import { ShrimpError, ShrimpCode } from "../src/main"
|
||||
import type { ILabel } from "../src/main"
|
||||
|
||||
describe("ILabel", () => {
|
||||
it("ShrimpError 接受字面量 string", () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect, beforeEach } from "vitest"
|
||||
import { MemoryShrimpCrud } from "../src"
|
||||
import { MemoryShrimpCrud } from "../src/main"
|
||||
|
||||
interface IItem {
|
||||
_id: string
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, beforeEach, afterEach } from "vitest"
|
||||
import { Shrimp, plainHasher, bcryptHasher, UserModule, MemoryShrimpCrud, ShrimpFieldTypes } from "../src"
|
||||
import type { IPasswordHasher } from "../src"
|
||||
import { Shrimp, plainHasher, bcryptHasher, UserModule, MemoryShrimpCrud, ShrimpFieldTypes } from "../src/main"
|
||||
import type { IPasswordHasher } from "../src/main"
|
||||
|
||||
describe("PasswordHasher 抽象", () => {
|
||||
const original = Shrimp.passwordHasher
|
||||
|
||||
@@ -20,10 +20,10 @@ import {
|
||||
RoleModule,
|
||||
OperationLogModule,
|
||||
plainHasher,
|
||||
} from "../src/core"
|
||||
import { buildShrimpRouter } from "../src/server/buildShrimpRouter"
|
||||
import type { ITokenAuth, IUserAccessor } from "../src/server/types"
|
||||
import type { WithId, IUser, IRole } from "../src/core"
|
||||
} from "../src/main"
|
||||
import { buildShrimpRouter } from "../src/forExpress/buildShrimpRouter"
|
||||
import type { ITokenAuth, IUserAccessor } from "../src/forExpress/types"
|
||||
import type { WithId, IUser, IRole } from "../src/main"
|
||||
|
||||
function makeFakeTokenAuth(): ITokenAuth {
|
||||
const store = new Map<string, Record<string, any>>()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect } from "vitest"
|
||||
import { Shrimp, ShrimpTableModule, MemoryShrimpCrud, ShrimpFieldTypes } from "../src"
|
||||
import type { IFieldConfig } from "../src"
|
||||
import { Shrimp, ShrimpTableModule, MemoryShrimpCrud, ShrimpFieldTypes } from "../src/main"
|
||||
import type { IFieldConfig } from "../src/main"
|
||||
|
||||
describe("crudRegistry 自动登记", () => {
|
||||
it("ShrimpTableModule 构造时自动把 dataSource 登记到 root.crudRegistry", () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect } from "vitest"
|
||||
import { Shrimp, ShrimpTableModule, MemoryShrimpCrud, UserModule, RoleModule } from "../src"
|
||||
import { Shrimp, ShrimpTableModule, MemoryShrimpCrud, UserModule, RoleModule } from "../src/main"
|
||||
|
||||
describe("Shrimp.getMenuTree", () => {
|
||||
it("返回的 label 等于模块注册时声明的 label", () => {
|
||||
|
||||
Reference in New Issue
Block a user