Skip to content

Commit 8d6a710

Browse files
authored
chore: exclude IDE packages from regular build (#1911)
1 parent 4c8b86f commit 8d6a710

File tree

10 files changed

+22
-15
lines changed

10 files changed

+22
-15
lines changed

.github/workflows/build-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
gradle-home-cache-cleanup: true
8787

8888
- name: Build
89-
run: DEFAULT_NPM_TAG=latest pnpm run build
89+
run: DEFAULT_NPM_TAG=latest pnpm run build-ci
9090

9191
- name: Lint
9292
run: pnpm lint

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"version": "2.10.0",
44
"description": "",
55
"scripts": {
6-
"build": "pnpm -r build",
6+
"build": "pnpm -r --filter=\"!./packages/ide/*\" build",
7+
"build-ci": "pnpm -r build",
78
"lint": "pnpm -r lint",
89
"test": "pnpm -r --parallel run test --silent --forceExit",
910
"test-ci": "pnpm -r --parallel run --filter=\"./packages/**\" test --silent --forceExit",

packages/plugins/openapi/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"ts-pattern": "^4.3.0",
3737
"upper-case-first": "^2.0.2",
3838
"yaml": "^2.2.2",
39-
"zod": "^3.22.4",
39+
"zod": "^3.22.4",
4040
"zod-validation-error": "^1.5.0"
4141
},
4242
"devDependencies": {

packages/plugins/trpc/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@
3131
"lower-case-first": "^2.0.2",
3232
"ts-morph": "^16.0.0",
3333
"tslib": "^2.4.1",
34-
"upper-case-first": "^2.0.2",
35-
"zod": "^3.22.4"
34+
"upper-case-first": "^2.0.2"
35+
},
36+
"peerDependencies": {
37+
"zod": "^3.22.4"
3638
},
3739
"devDependencies": {
3840
"@trpc/next": "^10.32.0",

packages/plugins/trpc/tests/projects/nuxt-trpc-v10/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"trpc-nuxt": "^0.10.22",
1818
"vue": "latest",
1919
"vue-router": "latest",
20-
"zod": "^3.23.8"
20+
"zod": "^3.22.4"
2121
},
2222
"devDependencies": {
2323
"esbuild": "^0.24.0",

packages/plugins/trpc/tests/projects/nuxt-trpc-v11/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"trpc-nuxt": "^0.11.0-beta.1",
1818
"vue": "latest",
1919
"vue-router": "latest",
20-
"zod": "^3.23.8"
20+
"zod": "^3.22.4"
2121
},
2222
"devDependencies": {
2323
"esbuild": "^0.24.0",

packages/plugins/trpc/tests/projects/t3-trpc-v10/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"react": "18.2.0",
2525
"react-dom": "18.2.0",
2626
"superjson": "^2.2.1",
27-
"zod": "^3.22.4"
27+
"zod": "^3.22.4"
2828
},
2929
"devDependencies": {
3030
"@types/eslint": "^8.44.7",

packages/plugins/trpc/tests/projects/t3-trpc-v11/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"react-dom": "^18.3.1",
2929
"server-only": "^0.0.1",
3030
"superjson": "^2.2.1",
31-
"zod": "^3.23.3"
31+
"zod": "^3.22.4"
3232
},
3333
"devDependencies": {
3434
"@types/eslint": "^8.56.10",

packages/runtime/src/zod-utils.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ import { z as Z } from 'zod';
99
* accidentally matching a less-ideal schema candidate.
1010
*
1111
* The helper uses a custom schema to find the candidate that results in the fewest unrecognized keys when parsing the data.
12+
*
13+
* The function uses `any` for parameter and return type to be compatible with various zod versions.
1214
*/
13-
export function smartUnion(z: typeof Z, candidates: Z.ZodSchema[]) {
15+
export function smartUnion(z: any, candidates: any[]): any {
1416
// strip `z.lazy`
15-
const processedCandidates = candidates.map((candidate) => unwrapLazy(z, candidate));
17+
const processedCandidates: Z.ZodSchema[] = candidates.map((candidate) => unwrapLazy(z, candidate));
1618

1719
if (processedCandidates.some((c) => !(c instanceof z.ZodObject || c instanceof z.ZodArray))) {
1820
// fall back to plain union if not all candidates are objects or arrays
@@ -22,11 +24,13 @@ export function smartUnion(z: typeof Z, candidates: Z.ZodSchema[]) {
2224
let resultData: any;
2325

2426
return z
25-
.custom((data) => {
27+
.custom((data: any) => {
2628
if (Array.isArray(data)) {
2729
const { data: result, success } = smartArrayUnion(
2830
z,
29-
processedCandidates.filter((c) => c instanceof z.ZodArray),
31+
processedCandidates.filter((c) => c instanceof z.ZodArray) as Array<
32+
Z.ZodArray<Z.ZodObject<Z.ZodRawShape>>
33+
>,
3034
data
3135
);
3236
if (success) {
@@ -36,7 +40,7 @@ export function smartUnion(z: typeof Z, candidates: Z.ZodSchema[]) {
3640
} else {
3741
const { data: result, success } = smartObjectUnion(
3842
z,
39-
processedCandidates.filter((c) => c instanceof z.ZodObject),
43+
processedCandidates.filter((c) => c instanceof z.ZodObject) as Z.ZodObject<Z.ZodRawShape>[],
4044
data
4145
);
4246
if (success) {

script/test-scaffold.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ function run(cmd: string) {
1919
}
2020

2121
run('npm init -y');
22-
run('npm i --no-audit --no-fund typescript [email protected] @prisma/[email protected] zod decimal.js @types/node');
22+
run('npm i --no-audit --no-fund typescript [email protected] @prisma/[email protected] zod@^3.22.4 decimal.js @types/node');
2323

2424
console.log('Test scaffold setup complete.');

0 commit comments

Comments
 (0)