npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@amritk/mjst

v0.4.0

Published

Generate TypeScript parsers and type definitions from JSON Schemas.

Readme

@amritk/mjst

Generate TypeScript parsers and type definitions from JSON Schemas.

status  version  license  JSON Schema  node  vibe coded


Overview

@amritk/mjst is the command-line entry point for mjst. Point it at a JSON Schema and it produces TypeScript parsers, validators, and type definitions in the directory of your choice.

Options can be supplied via CLI flags or a JSON config file. CLI flags always take precedence over config file values.


Installation

npm install --save-dev @amritk/mjst
# or
pnpm add -D @amritk/mjst
# or
yarn add -D @amritk/mjst
# or
bun add -d @amritk/mjst

The package ships a mjst bin that runs under Node ≥ 20 (or Bun), so you can invoke it via npx mjst, pnpm dlx mjst, yarn dlx mjst, bunx mjst, or as a script in package.json.


Usage

CLI

npx mjst --schema ./schema.json --outDir ./generated

Config file

npx mjst --config ./mjst.config.json

[!NOTE] Validate your config against the bundled JSON Schema: config.schema.json


Configuration reference

| | Property | CLI Flag | Type | Required | Default | Description | |:---:|:---|:---|:---:|:---:|:---:|:---| | 📄 | schema | --schema <path> | string | ✅ | — | Path to the JSON Schema file to process. The schema is read, parsed, and used to generate TypeScript source files. | | 📁 | outDir | --outDir <dir> | string | ✅ | — | Output directory for generated TypeScript files. The directory is created automatically if it does not exist. Subdirectories are created as needed when a generated file includes a nested path. | | 🏷️ | typesOnly | --types-only | boolean | — | false | Generate only TypeScript type definitions without parser functions. Useful when you only need the type shapes and do not need runtime validation. | | 🔨 | build | --build | boolean | — | false | Compile the generated TypeScript files to .js and .d.ts output. A temporary tsconfig is written to the output directory, tsc is invoked, and the intermediate .ts source files are removed when compilation succeeds. | | ⚠️ | logWarnings | --log-warnings | boolean | — | false | Emit a console.warn in the generated parsers for every input key that is not declared in the schema's properties. Useful for detecting schema drift or unexpected data shapes at runtime. | | 🚫 | strict | --strict | boolean | — | false | Generate parsers that throw on type/shape mismatches (wrong type, missing required property, enum/pattern/min/max violations) instead of coercing invalid input to default values. Unknown extra keys are still allowed. | | 🧰 | helpers | --helpers <mode> | string | — | — | Controls how generated parsers reference their runtime helpers. 'package' emits imports from @amritk/helpers (requires it to be installed in the consumer project). 'embedded' ships the helper source under outDir/_helpers/ so the output is self-contained. When omitted, the CLI auto-detects: it picks 'package' if @amritk/helpers resolves from outDir, otherwise 'embedded'. | | ⚙️ | config | --config <path> | string | — | — | Path to a JSON config file. Keys match the option names in this schema (schema, outDir, typesOnly, build, logWarnings, strict, helpers). CLI flags take precedence over config file values. |


Config file examples

Minimal — generate parsers and types

{
  "schema": "./schema.json",
  "outDir": "./generated"
}

Types only — skip parser functions

{
  "schema": "./schema.json",
  "outDir": "./generated",
  "typesOnly": true
}

Build — emit .js and .d.ts instead of .ts

{
  "schema": "./schema.json",
  "outDir": "./generated",
  "build": true
}

Log warnings — warn on unknown input properties

{
  "schema": "./schema.json",
  "outDir": "./generated",
  "logWarnings": true
}

Scripts

| Script | Command | |:---|:---| | bun run dev | bun run --conditions=development ./src/cli.ts | | bun run start | bun run ./src/cli.ts | | bun run build | bun run build:code && bun run build:types | | bun run generate-readme | bun run generate-readme |


License

MIT