zodrift 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -2
- package/package.json +20 -4
package/README.md
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
[](https://github.com/greyllmmoder/zodrift/actions/workflows/ci.yml)
|
|
5
5
|
[](https://opensource.org/licenses/MIT)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
ESLint for TypeScript and Zod drift. Catch contract drift before it reaches runtime.
|
|
8
|
+
|
|
9
|
+
Built for teams that already have TS types and Zod schemas and want CI to fail when they drift.
|
|
8
10
|
|
|
9
11
|
```ts
|
|
10
12
|
import { z } from "zod";
|
|
@@ -27,7 +29,16 @@ export const UserSchema = z.object({
|
|
|
27
29
|
npx zodrift check
|
|
28
30
|
```
|
|
29
31
|
|
|
30
|
-

|
|
33
|
+
|
|
34
|
+
Example output:
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
✗ User ↔ UserSchema
|
|
38
|
+
- optional mismatch for email: type=optional, schema=required
|
|
39
|
+
- type mismatch for age: type=number, schema=string
|
|
40
|
+
- extra in schema: role
|
|
41
|
+
```
|
|
31
42
|
|
|
32
43
|
What it catches:
|
|
33
44
|
- missing fields
|
|
@@ -35,6 +46,33 @@ What it catches:
|
|
|
35
46
|
- required vs optional mismatch
|
|
36
47
|
- basic type mismatch
|
|
37
48
|
|
|
49
|
+
CI quick start:
|
|
50
|
+
|
|
51
|
+
```yaml
|
|
52
|
+
- run: npx zodrift check --pattern "src/**/*.{ts,tsx}"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Exit codes:
|
|
56
|
+
- `0`: no drift
|
|
57
|
+
- `1`: drift found
|
|
58
|
+
- `2`: parser/runtime error
|
|
59
|
+
|
|
60
|
+
Useful commands:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Check current project
|
|
64
|
+
npx zodrift check --pattern "src/**/*.{ts,tsx}"
|
|
65
|
+
|
|
66
|
+
# Machine-readable report for CI artifacts
|
|
67
|
+
npx zodrift check --format json --out reports/zodrift.json
|
|
68
|
+
|
|
69
|
+
# SARIF for GitHub code scanning
|
|
70
|
+
npx zodrift check --format sarif --out reports/zodrift.sarif
|
|
71
|
+
|
|
72
|
+
# Safe autofix pass (dry-run first)
|
|
73
|
+
npx zodrift fix --pattern "src/**/*.ts" --dry-run
|
|
74
|
+
```
|
|
75
|
+
|
|
38
76
|
Roadmap:
|
|
39
77
|
- nested support
|
|
40
78
|
- arrays
|
package/package.json
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zodrift",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "ESLint-style CI drift checker for TypeScript types and Zod schemas.",
|
|
5
|
+
"author": "greyllmmoder",
|
|
6
|
+
"homepage": "https://github.com/greyllmmoder/zodrift#readme",
|
|
7
|
+
"bugs": {
|
|
8
|
+
"url": "https://github.com/greyllmmoder/zodrift/issues"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/greyllmmoder/zodrift.git"
|
|
13
|
+
},
|
|
5
14
|
"type": "module",
|
|
6
15
|
"license": "MIT",
|
|
7
16
|
"bin": {
|
|
@@ -24,18 +33,25 @@
|
|
|
24
33
|
"prepublishOnly": "npm run typecheck && npm run build && npm test"
|
|
25
34
|
},
|
|
26
35
|
"keywords": [
|
|
36
|
+
"zodrift",
|
|
37
|
+
"eslint-for-zod",
|
|
27
38
|
"zod",
|
|
28
39
|
"typescript",
|
|
29
40
|
"schema",
|
|
30
41
|
"drift",
|
|
42
|
+
"drift-detection",
|
|
43
|
+
"schema-validation",
|
|
44
|
+
"api-contracts",
|
|
45
|
+
"type-safety",
|
|
46
|
+
"ci",
|
|
31
47
|
"cli"
|
|
32
48
|
],
|
|
33
49
|
"devDependencies": {
|
|
34
50
|
"@types/node": "^22.15.0",
|
|
35
|
-
"tsx": "^4.20.0"
|
|
36
|
-
"typescript": "^5.8.3"
|
|
51
|
+
"tsx": "^4.20.0"
|
|
37
52
|
},
|
|
38
53
|
"dependencies": {
|
|
54
|
+
"typescript": "^5.8.3",
|
|
39
55
|
"zod": "^3.25.76"
|
|
40
56
|
},
|
|
41
57
|
"publishConfig": {
|