Skip to content

Commit 291c1ca

Browse files
committed
Add should-build script
1 parent 4e7a3ef commit 291c1ca

File tree

4 files changed

+22
-38
lines changed

4 files changed

+22
-38
lines changed

.configs/tsconfig.base.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"compilerOptions": {
33
"target": "es2020",
4-
"lib": ["es6", "es2020"],
54
"module": "NodeNext",
65
"moduleResolution": "NodeNext",
76
"jsx": "react",

packages/zod/src/v4/classic/tests/file.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// @ts-ignore
21
import { File as WebFile } from "@web-std/file";
32

43
import { afterEach, beforeEach, expect, test } from "vitest";

play.ts

Lines changed: 8 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,14 @@ import * as z from "zod/v4";
22

33
z;
44

5-
function foo<T extends z.ZodType>(subSchema: T) {
6-
fetch("example/api")
7-
.then((res) => res.json())
8-
.then((json) => {
9-
const resSchema = makeSchema(subSchema);
10-
11-
const parsed = resSchema.safeParse(json);
12-
13-
if (parsed.success) {
14-
if (parsed.data.passed) {
15-
console.log(parsed.data.value);
16-
}
17-
}
18-
});
19-
}
20-
21-
function makeSchema<const T extends z.ZodType>(subSchema: T) {
22-
const resSchema = z.union([
23-
z.object({
24-
passed: z.literal(true),
25-
value: subSchema,
26-
}),
27-
z.object({
28-
passed: z.literal(false),
29-
msg: z.string(),
30-
}),
31-
]);
32-
33-
return resSchema;
5+
function myThing() {
6+
const schema = z.custom<string>((val) => typeof val === "string");
7+
schema._zod.toJSONSchema = () => ({
8+
type: "string",
9+
});
10+
return schema;
3411
}
3512

36-
const schema = makeSchema(z.number());
13+
console.log(z.toJSONSchema(myThing()));
3714

38-
const result = schema.parse({ passed: true, value: 1 });
39-
if (result.passed) {
40-
result.value;
41-
} else {
42-
result.msg;
43-
}
15+
z.file().parse({}).text;

scripts/should-build-site.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
echo "VERCEL_GIT_COMMIT_REF: $VERCEL_GIT_COMMIT_REF"
4+
5+
if [[ "$VERCEL_GIT_COMMIT_REF" == "v3" ]] ; then
6+
# don't build
7+
echo "🛑 - Build cancelled"
8+
exit 0;
9+
10+
else
11+
# proceed
12+
echo "✅ - Build can proceed"
13+
exit 1
14+
fi

0 commit comments

Comments
 (0)