Skip to content

Commit ff03691

Browse files
committed
Add NPM badge and update Claude
1 parent 0d7322f commit ff03691

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

CLAUDE.md

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,29 @@
11
# zod-from-json-schema Development Guidelines
22

33
## Commands
4-
- **Build:** `npm run build` (generates CJS and ESM outputs)
5-
- **Test all:** `npm test`
6-
- **Test single file:** `npx vitest run src/path/to/file.test.ts`
7-
- **Test with pattern:** `npx vitest run -t "test pattern"`
8-
- **Clean:** `npm run clean` (removes dist directory)
4+
- **Build**: `npm run build` (generates CJS and ESM outputs)
5+
- **Test all**: `npm test`
6+
- **Test single file**: `npx vitest run src/path/to/file.test.ts`
7+
- **Test with pattern**: `npx vitest run -t "test pattern"`
8+
- **Run specific test**: `npx vitest run src/index.test.ts -t "should extract properties"`
9+
- **Clean**: `npm run clean` (removes dist directory)
10+
- **Prepare for publishing**: `npm run prepublishOnly`
911

1012
## Code Style
11-
- **TypeScript:** Use strict types, avoid `any` except in JSON Schema interfaces
12-
- **Imports:** Use named imports from zod (`import { z } from "zod"`)
13-
- **Formatting:** 4-space indentation, avoid lines > 80 chars
14-
- **Naming:** Use camelCase for functions/variables, PascalCase for types/interfaces
15-
- **Error handling:** Use Zod's built-in validation or custom refinements
16-
- **Comments:** Document functions with JSDoc comments including params, return types
17-
- **Compatibility:** Keep dual-module support (CJS/ESM) for all exported functions
13+
- **TypeScript**: Use strict types with proper JSON Schema interface typing
14+
- **Imports**: Use named imports (`import { z } from "zod"`)
15+
- **Formatting**: 4-space indentation, prefer lines under 80 chars
16+
- **Functions**: Pure functions with no side effects, descriptive names in camelCase
17+
- **Types/Interfaces**: Use PascalCase, export types used in public API
18+
- **Error handling**: Use Zod's built-in validation rather than throwing errors
19+
- **Documentation**: JSDoc comments for all exported functions and types
1820

1921
## Architecture
20-
- Functions should be pure with no side effects
21-
- Keep JSON Schema to Zod conversion logic separate from utility functions
22-
- Write tests for each supported feature and edge case
22+
- Maintain dual module support (CJS/ESM) for all exports
23+
- Keep conversion logic modular with single-responsibility functions
24+
- Write tests for each feature and edge cases, including type validation
25+
- CI runs tests on Node 18, 20, and 22 through GitHub Actions workflow
26+
- Use esbuild for bundling with targeted ES2018 output
27+
- Follow semantic versioning for releases
28+
29+
For release process, see RELEASE.md

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# zod-from-json-schema
22

33
[![CI](https://github.com/glideapps/zod-from-json-schema/actions/workflows/ci.yml/badge.svg)](https://github.com/glideapps/zod-from-json-schema/actions/workflows/ci.yml)
4+
[![npm version](https://img.shields.io/npm/v/zod-from-json-schema.svg)](https://www.npmjs.com/package/zod-from-json-schema)
45

56
A library that creates [Zod](https://github.com/colinhacks/zod) types from [JSON Schema](https://json-schema.org/) at runtime. This is in contrast to [json-schema-to-zod](https://www.npmjs.com/package/json-schema-to-zod), which generates JavaScript source code.
67

0 commit comments

Comments
 (0)