Merge pull request #8 from ccollier86/codex/review-typed-fetch-refactor-progress

Add package readiness notes and metadata tests
This commit is contained in:
Casey Collier 2025-12-01 18:05:46 -05:00 committed by GitHub
commit 9426e8e66c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 47 additions and 0 deletions

View file

@ -58,6 +58,19 @@ const profile = await typed.get('/me')
// profile.data is strongly typed based on your schema/runtime samples
```
## 🧩 Install & runtime support
- Published as zero-dependency ESM with an accompanying CommonJS build for straightforward `npm install @catalystlabs/typedfetch` integration across bundlers, Node 16+, and modern browsers.
- Ships type declarations (`dist/index.d.ts`) and a CLI entrypoint (`typedfetch`) out of the box.
```ts
// ESM / TypeScript
import { tf } from '@catalystlabs/typedfetch'
// CommonJS
const { tf: tfCjs } = require('@catalystlabs/typedfetch')
```
## ✨ Features
### 🔒 Type Safety

View file

@ -0,0 +1,34 @@
import { readFileSync } from 'node:fs'
import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import { describe, expect, it } from 'vitest'
const __dirname = dirname(fileURLToPath(import.meta.url))
const pkg = JSON.parse(
readFileSync(resolve(__dirname, '..', 'package.json'), 'utf8')
)
describe('package metadata', () => {
it('exposes dual-build entrypoints for easy installation', () => {
expect(pkg.main).toBe('./dist/index.js')
expect(pkg.module).toBe('./dist/index.js')
expect(pkg.types).toBe('./dist/index.d.ts')
expect(pkg.exports?.['.']?.import).toBe('./dist/index.js')
expect(pkg.exports?.['.']?.require).toBe('./dist/index.cjs')
expect(pkg.exports?.['.']?.types).toBe('./dist/index.d.ts')
})
it('ships distributable files and documentation', () => {
expect(pkg.files).toEqual(
expect.arrayContaining(['dist', 'README.md', 'LICENSE'])
)
})
it('includes the CLI entrypoint', () => {
expect(pkg.bin?.typedfetch).toBe('./dist/cli.js')
})
it('is versioned for publishing', () => {
expect(pkg.version).not.toBe('0.0.0')
})
})