Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revision 0.8.0 #9

Merged
merged 1 commit into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed design/typebox-adapter.blend
Binary file not shown.
Binary file added design/typemap.blend
Binary file not shown.
Binary file added design/typemap.blend1
Binary file not shown.
Binary file added design/typescript.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 21 additions & 19 deletions example/index.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
import { Box } from '@sinclair/typebox-adapter'
import * as v from 'valibot'
import * as z from 'zod'
import { TypeBox, Zod, Valibot } from '@sinclair/typemap'

// Valibot to TypeBox (Runtime)
// const T: TObject<{ ... }>

const V = Box(
v.object({
x: v.number(),
y: v.number(),
z: v.number(),
}),
)
const T = TypeBox(`{
x: number,
y: number,
z: number
}`)

// Zod to TypeBox (Static)
// const V: ObjectSchema<{ ... }>

const Z = Box(
z.object({
a: z.string(),
b: z.string(),
c: z.string(),
}),
)
const V = Valibot(`{
x: number,
y: number,
z: number
}`)

// const Z: ZodObject<{ ... }>

const Z = Zod(`{
x: number,
y: number,
z: number
}`)
672 changes: 336 additions & 336 deletions example/prototypes/effect.ts

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion example/prototypes/index.ts

This file was deleted.

8 changes: 3 additions & 5 deletions hammer.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ export async function clean() {
export async function start() {
await shell('hammer run example/index.ts --dist target/example')
}

// -------------------------------------------------------------------------------
// Format
// -------------------------------------------------------------------------------
export async function format() {
await shell('prettier --no-semi --single-quote --print-width 240 --trailing-comma all --write test src example/index.ts')
}

// ------------------------------------------------------------------
// Test
// ------------------------------------------------------------------
Expand All @@ -39,7 +37,7 @@ export async function test(filter = '') {
// ------------------------------------------------------------------
export async function build_check(target = 'target/build') {
const { version } = JSON.parse(Fs.readFileSync('package.json', 'utf8'))
await shell(`cd ${target} && attw sinclair-typebox-adapter-${version}.tgz`)
await shell(`cd ${target} && attw sinclair-typemap-${version}.tgz`)
}
export async function build(target = 'target/build') {
await test()
Expand All @@ -60,7 +58,7 @@ export async function build(target = 'target/build') {
export async function publish(otp, target = 'target/build') {
const { version } = JSON.parse(Fs.readFileSync('package.json', 'utf8'))
if(version.includes('-dev')) throw Error(`package version should not include -dev specifier`)
await shell(`cd ${target} && npm publish sinclair-typebox-adapter-${version}.tgz --access=public --otp ${otp}`)
await shell(`cd ${target} && npm publish sinclair-typemap-${version}.tgz --access=public --otp ${otp}`)
await shell(`git tag ${version}`)
await shell(`git push origin ${version}`)
}
Expand All @@ -70,5 +68,5 @@ export async function publish(otp, target = 'target/build') {
export async function publish_dev(otp, target = 'target/build') {
const { version } = JSON.parse(Fs.readFileSync(`${target}/package.json`, 'utf8'))
if(!version.includes('-dev')) throw Error(`development package version should include -dev specifier`)
await shell(`cd ${target} && npm publish sinclair-typebox-adapter-${version}.tgz --access=public --otp ${otp} --tag dev`)
await shell(`cd ${target} && npm publish sinclair-typemap-${version}.tgz --access=public --otp ${otp} --tag dev`)
}
2 changes: 1 addition & 1 deletion license
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@sinclair/typebox-adapter
@sinclair/typemap

The MIT License (MIT)

Expand Down
Loading
Loading