diff --git a/.github/.keep b/.github/.keep new file mode 100644 index 0000000..e69de29 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 23b08da..758bf7f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,7 +1,7 @@ name: Build on: [push, pull_request] jobs: - TypeBox-Remix: + TypeBox-Adapter: runs-on: ${{ matrix.os }} strategy: matrix: diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index a59af70..5daa5e5 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -3,7 +3,7 @@ on: schedule: - cron: '0 18 * * *' # 6pm Daily jobs: - TypeBox-Remix-Nightly: + TypeBox-Adapter-Nightly: runs-on: ${{ matrix.os }} strategy: matrix: diff --git a/benchmark/index.ts b/benchmark/index.ts index bb5c7be..2386cb5 100644 --- a/benchmark/index.ts +++ b/benchmark/index.ts @@ -1,6 +1,6 @@ import { TypeCompiler } from '@sinclair/typebox/compiler' import { Value } from '@sinclair/typebox/value' -import { Box } from '@sinclair/typebox-remix' +import { Box } from '@sinclair/typebox-adapter' import * as v from 'valibot' import * as z from 'zod' diff --git a/design/typebox-remix.blend b/design/typebox-adapter.blend similarity index 57% rename from design/typebox-remix.blend rename to design/typebox-adapter.blend index 7bfc4d3..9a5a821 100644 Binary files a/design/typebox-remix.blend and b/design/typebox-adapter.blend differ diff --git a/design/typebox-remix.blend1 b/design/typebox-remix.blend1 deleted file mode 100644 index ddabb30..0000000 Binary files a/design/typebox-remix.blend1 and /dev/null differ diff --git a/example/index.ts b/example/index.ts index a654555..c7c5a86 100644 --- a/example/index.ts +++ b/example/index.ts @@ -1,4 +1,4 @@ -import { Box } from '@sinclair/typebox-remix' +import { Box } from '@sinclair/typebox-adapter' import * as v from 'valibot' import * as z from 'zod' diff --git a/hammer.mjs b/hammer.mjs index 14058dc..67517cf 100644 --- a/hammer.mjs +++ b/hammer.mjs @@ -38,7 +38,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-remix-${version}.tgz --ignore-rules unexpected-module-syntax`) + await shell(`cd ${target} && attw sinclair-typebox-adapter-${version}.tgz --ignore-rules unexpected-module-syntax`) } export async function build(target = 'target/build') { await test() @@ -56,7 +56,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-remix-${version}.tgz --access=public --otp ${otp}`) + await shell(`cd ${target} && npm publish sinclair-typebox-adapter-${version}.tgz --access=public --otp ${otp}`) await shell(`git tag ${version}`) await shell(`git push origin ${version}`) } @@ -66,5 +66,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-remix-${version}.tgz --access=public --otp ${otp} --tag dev`) + await shell(`cd ${target} && npm publish sinclair-typebox-adapter-${version}.tgz --access=public --otp ${otp} --tag dev`) } \ No newline at end of file diff --git a/license b/license index 1ce8df6..6a4960c 100644 --- a/license +++ b/license @@ -1,4 +1,4 @@ -@sinclair/typebox-remix +@sinclair/typebox-adapter The MIT License (MIT) diff --git a/package-lock.json b/package-lock.json index 60de87a..1efaecd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "@sinclair/typebox-remix", + "name": "@sinclair/typebox-adapter", "version": "0.8.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "@sinclair/typebox-remix", + "name": "@sinclair/typebox-adapter", "version": "0.8.0", "license": "MIT", "devDependencies": { diff --git a/package.json b/package.json index eee3466..1638cef 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,13 @@ { - "name": "@sinclair/typebox-remix", + "name": "@sinclair/typebox-adapter", "version": "0.8.0", "description": "Integrate Valibot and Zod with TypeBox", "author": "sinclairzx81", "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sinclairzx81/typebox-adapter" + }, "scripts": { "benchmark": "hammer task benchmark", "clean": "hammer task clean", diff --git a/readme.md b/readme.md index 1107752..6c37333 100644 --- a/readme.md +++ b/readme.md @@ -1,17 +1,17 @@
-

TypeBox Remix

+

TypeBox Adapter

Integrate Valibot and Zod with TypeBox

- +

-[![npm version](https://badge.fury.io/js/%40sinclair%2Ftypebox-remix.svg)](https://badge.fury.io/js/%40sinclair%2Ftypebox-remix) -[![Downloads](https://img.shields.io/npm/dm/%40sinclair%2Ftypebox-remix.svg)](https://www.npmjs.com/package/%40sinclair%2Ftypebox-remix) -[![Build](https://github.com/sinclairzx81/typebox-remix/actions/workflows/build.yml/badge.svg)](https://github.com/sinclairzx81/typebox-remix/actions/workflows/build.yml) +[![npm version](https://badge.fury.io/js/%40sinclair%2Ftypebox-adapter.svg)](https://badge.fury.io/js/%40sinclair%2Ftypebox-adapter) +[![Downloads](https://img.shields.io/npm/dm/%40sinclair%2Ftypebox-adapter.svg)](https://www.npmjs.com/package/%40sinclair%2Ftypebox-adapter) +[![Build](https://github.com/sinclairzx81/typebox-adapter/actions/workflows/build.yml/badge.svg)](https://github.com/sinclairzx81/typebox-adapter/actions/workflows/build.yml) [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
@@ -19,15 +19,15 @@ ## Install ```bash -$ npm install @sinclair/typebox-remix --save +$ npm install @sinclair/typebox-adapter --save ``` ## Example -TypeBox Remix converts Valibot and Zod Types into TypeBox compatible schematics +TypeBox Adapter converts Valibot and Zod Types into TypeBox compatible schematics ```typescript -import { Box } from '@sinclair/typebox-remix' +import { Box } from '@sinclair/typebox-adapter' import * as v from 'valibot' import * as z from 'zod' @@ -55,9 +55,7 @@ const Z = Box(z.object({ // const Z: TObject<{ ## Overview -TypeBox Remix is a library that makes Zod and Valibot compatible with TypeBox. It works by structurally remapping the types provided by these libraries into Json Schema schematics, enabling them to integrate with the TypeBox infrastructure and making them compatible with Ajv. - -This library can be used to integrate Valibot and Zod into server infrastructures that standardize on the Json Schema specification. By transforming these libraries to Json Schema, they can benefit from accelerated type checking and achieve better interoperability with non-JavaScript based systems. +TypeBox Adapter is a library that transforms Zod and Valibot types into TypeBox compatiable schematics. It works by structurally remapping the types provided by these libraries both statically and at runtime, enabling them to integrate with TypeBox infrastructure as well as making them compatible with industry standard Json Schema validators like Ajv. License MIT @@ -73,14 +71,14 @@ License MIT ## Usage -TypeBox Remix provides a singular Box function to transform Valibot and Zod types into TypeBox schematics. The top-level export is capable of transforming both Valibot and Zod, but you should use the appropriate submodule depending on which library you are using. +TypeBox Adapter provides a singular Box function to transform Valibot and Zod types into TypeBox schematics. The top-level export is capable of transforming both Valibot and Zod, but you should use the appropriate submodule depending on which library you are using. ### Valibot Use the `/valibot` submodule if you only have Valibot installed. ```typescript -import { Box } from '@sinclair/typebox-remix/valibot' // Transform Valibot Only +import { Box } from '@sinclair/typebox-adapter/valibot' // Transform Valibot Only import * as v from 'valibot' @@ -94,7 +92,7 @@ Refer to the Valibot [documentation](https://valibot.dev/) for more information Use the `/zod` submodule if you only have Zod installed. ```typescript -import { Box } from '@sinclair/typebox-remix/zod' // Transform Zod Only +import { Box } from '@sinclair/typebox-adapter/zod' // Transform Zod Only import * as z from 'zod' diff --git a/src/box.ts b/src/box.ts index 3e4bb75..eddfd7d 100644 --- a/src/box.ts +++ b/src/box.ts @@ -1,6 +1,6 @@ /*-------------------------------------------------------------------------- -@sinclair/typebox-remix +@sinclair/typebox-adapter The MIT License (MIT) diff --git a/src/index.ts b/src/index.ts index 70949b9..a89712c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,6 @@ /*-------------------------------------------------------------------------- -@sinclair/typebox-remix +@sinclair/typebox-adapter The MIT License (MIT) diff --git a/src/typebox.ts b/src/typebox.ts index ad70196..d931335 100644 --- a/src/typebox.ts +++ b/src/typebox.ts @@ -1,6 +1,6 @@ /*-------------------------------------------------------------------------- -@sinclair/typebox-remix +@sinclair/typebox-adapter The MIT License (MIT) diff --git a/src/valibot.ts b/src/valibot.ts index 85ed9c0..a4d4159 100644 --- a/src/valibot.ts +++ b/src/valibot.ts @@ -1,6 +1,6 @@ /*-------------------------------------------------------------------------- -@sinclair/typebox-remix +@sinclair/typebox-adapter The MIT License (MIT) diff --git a/src/zod.ts b/src/zod.ts index 641db42..8ad36b0 100644 --- a/src/zod.ts +++ b/src/zod.ts @@ -1,6 +1,6 @@ /*-------------------------------------------------------------------------- -@sinclair/typebox-remix +@sinclair/typebox-adapter The MIT License (MIT) diff --git a/test/valibot.ts b/test/valibot.ts index 6b7bc2e..b0e3052 100644 --- a/test/valibot.ts +++ b/test/valibot.ts @@ -1,4 +1,4 @@ -import { Box } from '@sinclair/typebox-remix' +import { Box } from '@sinclair/typebox-adapter' import * as Types from '@sinclair/typebox' import { TypeGuard } from '@sinclair/typebox' import { Assert } from './assert' diff --git a/test/zod.ts b/test/zod.ts index 7d5e03f..78607bd 100644 --- a/test/zod.ts +++ b/test/zod.ts @@ -1,4 +1,4 @@ -import { Box } from '@sinclair/typebox-remix' +import { Box } from '@sinclair/typebox-adapter' import * as Types from '@sinclair/typebox' import { TypeGuard } from '@sinclair/typebox' import { Assert } from './assert' diff --git a/tsconfig.json b/tsconfig.json index 05179a8..62f2d9d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,10 +5,10 @@ "moduleResolution": "Node", "baseUrl": ".", "paths": { - "@sinclair/typebox-remix/typebox": ["src/typebox.ts"], - "@sinclair/typebox-remix/valibot": ["src/valibot.ts"], - "@sinclair/typebox-remix/zod": ["src/zod.ts"], - "@sinclair/typebox-remix": ["src/index.ts"] + "@sinclair/typebox-adapter/typebox": ["src/typebox.ts"], + "@sinclair/typebox-adapter/valibot": ["src/valibot.ts"], + "@sinclair/typebox-adapter/zod": ["src/zod.ts"], + "@sinclair/typebox-adapter": ["src/index.ts"] } } } \ No newline at end of file diff --git a/typebox-adapter.png b/typebox-adapter.png new file mode 100644 index 0000000..cbabf55 Binary files /dev/null and b/typebox-adapter.png differ diff --git a/typebox-remix.png b/typebox-remix.png deleted file mode 100644 index 9ffc060..0000000 Binary files a/typebox-remix.png and /dev/null differ