Skip to content

Commit f0fa5ea

Browse files
ymc9claude
andcommitted
chore: run test:generate during build for orm/schema/zod
Adds `pnpm test:generate` to the build scripts of @zenstackhq/orm, @zenstackhq/schema, and @zenstackhq/zod so test fixtures are regenerated as part of `pnpm build`. Includes the resulting regeneration of packages/schema/test/schema/schema.ts. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 2ef5a99 commit f0fa5ea

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

packages/orm/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"license": "MIT",
1717
"scripts": {
18-
"build": "tsc --noEmit && tsdown",
18+
"build": "tsc --noEmit && tsdown && pnpm test:generate",
1919
"watch": "tsdown --watch",
2020
"lint": "eslint src --ext ts",
2121
"pack": "pnpm pack",

packages/schema/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"license": "MIT",
1717
"scripts": {
18-
"build": "tsc --noEmit && tsdown",
18+
"build": "tsc --noEmit && tsdown && pnpm test:generate",
1919
"watch": "tsdown --watch",
2020
"lint": "eslint src --ext ts",
2121
"test": "vitest run",

packages/schema/test/schema/schema.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
/* eslint-disable */
77

8-
import { type SchemaDef, ExpressionUtils } from "@zenstackhq/schema";
8+
import { type SchemaDef, type AttributeApplication, type FieldDefault, ExpressionUtils } from "@zenstackhq/schema";
99
export class SchemaType implements SchemaDef {
1010
provider = {
1111
type: "sqlite"
@@ -18,14 +18,14 @@ export class SchemaType implements SchemaDef {
1818
name: "id",
1919
type: "String",
2020
id: true,
21-
attributes: [{ name: "@id" }, { name: "@default", args: [{ name: "value", value: ExpressionUtils.call("cuid") }] }],
22-
default: ExpressionUtils.call("cuid")
21+
attributes: [{ name: "@id" }, { name: "@default", args: [{ name: "value", value: ExpressionUtils.call("cuid") }] }] as readonly AttributeApplication[],
22+
default: ExpressionUtils.call("cuid") as FieldDefault
2323
},
2424
email: {
2525
name: "email",
2626
type: "String",
2727
unique: true,
28-
attributes: [{ name: "@unique" }]
28+
attributes: [{ name: "@unique" }] as readonly AttributeApplication[]
2929
},
3030
name: {
3131
name: "name",
@@ -40,7 +40,7 @@ export class SchemaType implements SchemaDef {
4040
name: "address",
4141
type: "Address",
4242
optional: true,
43-
attributes: [{ name: "@json" }]
43+
attributes: [{ name: "@json" }] as readonly AttributeApplication[]
4444
},
4545
posts: {
4646
name: "posts",
@@ -62,8 +62,8 @@ export class SchemaType implements SchemaDef {
6262
name: "id",
6363
type: "String",
6464
id: true,
65-
attributes: [{ name: "@id" }, { name: "@default", args: [{ name: "value", value: ExpressionUtils.call("cuid") }] }],
66-
default: ExpressionUtils.call("cuid")
65+
attributes: [{ name: "@id" }, { name: "@default", args: [{ name: "value", value: ExpressionUtils.call("cuid") }] }] as readonly AttributeApplication[],
66+
default: ExpressionUtils.call("cuid") as FieldDefault
6767
},
6868
title: {
6969
name: "title",
@@ -73,7 +73,7 @@ export class SchemaType implements SchemaDef {
7373
name: "owner",
7474
type: "User",
7575
optional: true,
76-
attributes: [{ name: "@relation", args: [{ name: "fields", value: ExpressionUtils.array("String", [ExpressionUtils.field("ownerId")]) }, { name: "references", value: ExpressionUtils.array("String", [ExpressionUtils.field("id")]) }] }],
76+
attributes: [{ name: "@relation", args: [{ name: "fields", value: ExpressionUtils.array("String", [ExpressionUtils.field("ownerId")]) }, { name: "references", value: ExpressionUtils.array("String", [ExpressionUtils.field("id")]) }] }] as readonly AttributeApplication[],
7777
relation: { opposite: "posts", fields: ["ownerId"], references: ["id"] }
7878
},
7979
ownerId: {
@@ -82,7 +82,7 @@ export class SchemaType implements SchemaDef {
8282
optional: true,
8383
foreignKeyFor: [
8484
"owner"
85-
]
85+
] as readonly string[]
8686
}
8787
},
8888
idFields: ["id"],

packages/zod/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"license": "MIT",
1717
"scripts": {
18-
"build": "tsc --noEmit && tsdown",
18+
"build": "tsc --noEmit && tsdown && pnpm test:generate",
1919
"watch": "tsdown --watch",
2020
"lint": "eslint src --ext ts",
2121
"test": "vitest run",

0 commit comments

Comments
 (0)