Socket
Book a DemoInstallSign in
Socket

typebox-cli

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typebox-cli

CLI tool for various TypeBox and JSON Schema operations

1.0.5
latest
Source
npmnpm
Version published
Weekly downloads
329
22.76%
Maintainers
1
Weekly downloads
 
Created
Source

TypeBox CLI

Test Package Publication

Description

CLI tool for various TypeBox and JSON Schema operations.

Install

npm install -g typebox-cli

Usage

Convert TypeScript types to TypeBox Schema

Input file (i.e. types.ts):

export type T = "test";

Run TypeBox Codegen:

typebox codegen TypeBox --source types.ts

Outputs:

import { Type, Static } from '@sinclair/typebox'

export type T = Static<typeof T>
export const T = Type.String()

Convert TypeBox Schema into JSON schema

Input file (i.e. typebox.ts):

import { Type } from "@sinclair/typebox";
export const T = Type.String();

Run JSON Schema extraction:

typebox extract json --module typebox.ts -e T

Outputs:

{
  "$id": "T",
  "type": "string"
}

Reference

Commands

# Extract - Extract JSON schema from exported TypeBox variables:
typebox extract json --module <module path>

# Codegen -- Generate Schema from either TypeScript types (using --source) or TypeBox schema (using --module):
typebox codegen <model-name> --source <source file> # Generate from TypeScript Types.
typebox codegen <model-name> --module <module path> # Generate from exported TypeBox Schema values.

# List available Codegen models:
typebox list

# Misc
typebox --version # Display current typebox version.
typebox --help # Help

Dependencies

typebox-cli is based on these packages:

  • TypeBox - Json Schema Type Builder with Static Type Resolution for TypeScript
  • TypeBox Codegen - Code Generation Tools for TypeBox
  • jiti - Module Loading
  • Commander - CLI Interface

License

MIT

Keywords

typebox

FAQs

Package last updated on 09 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.