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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@rbleattler/omp-ts-typegen

v0.2025.3580004

Published

TypeScript type definitions for Oh My Posh schema

Readme

Oh-My-Posh TypeScript Type Generator

Theme Validation

Oh-my-posh (JanDeDobbeleer oh-my-posh | github) is "A prompt theme engine for any shell." This project generates typescript types from the oh-my-posh schema. These types can then be used in other typescript projects to validate and work with oh-my-posh configuration files.

The typescript/javascript in this directory is used to generate typescript types from the oh-my-posh (oh-my-posh.dev) schema. These types can then be used in other typescript projects to validate and work with oh-my-posh configuration files.

For a detailed explanation of the schema, see schema-explained.md.

Goals

  • Generate typescript types from the oh-my-posh schema
    • Which can be used to:
      • Validate oh-my-posh configuration files
      • Work with oh-my-posh configuration files in typescript projects
      • Generate documentation for oh-my-posh configuration files
      • Build oh-my-posh configuration files programmatically
    • Which are easy to:
      • Understand
      • Use
      • Maintain
      • Extend
  • Generate documentation for oh-my-posh configuration files
    • Which is easy to:
      • Understand
      • Use
      • Maintain
      • Extend

Installation

# Clone the repository
git clone https://github.com/yourusername/omp-ts-typegen.git
cd omp-ts-typegen

# Install dependencies
npm install

How It Works

This project automatically generates TypeScript type definitions from the Oh My Posh JSON schema:

  1. The script fetches the latest schema from the Oh My Posh repository
  2. The schema is cached locally for future reference
  3. quicktype is used to convert the JSON schema into TypeScript types
  4. The generated types are saved to the src/types/omp.ts file
  5. These types are then exported via the main entry point (src/index.ts)

A GitHub workflow runs nightly to check for schema updates and regenerate types if needed.

Usage

Generating Types

# Generate types from the Oh My Posh schema
npm run generate-types

# Test the generated types against all Oh My Posh themes
# This will also generate a theme-validation.md report
npm run test-types

# Build the package
npm run build

Validation Report

When running npm run test-types, the script will:

  1. Clone the Oh My Posh repository and test all themes against the generated types
  2. Generate a markdown report (theme-validation.md) showing which themes are valid or invalid
  3. Create a custom SVG badge showing validation status
  4. Exit with a non-zero code if any themes are invalid

The validation report includes:

  • A summary of validation results (total themes, valid count, invalid count)
  • A table listing all themes with links to their source files
  • Status indicators showing which themes pass validation
  • A custom SVG badge that is displayed in the README

Using the Generated Types

Once you've installed this package in your project, you can use the generated types:

import { Config } from '@rbleattler/omp-ts-typegen';

// Use the types to validate or work with Oh My Posh config files
const myConfig: Config = {
  // Your config here
};

Project Structure

  • /scripts - Contains the TypeScript scripts for generating and testing types
    • generate-types.ts - Fetches the schema and generates types
    • test-types.ts - Tests the generated types against sample configs
    • validator.ts - Provides validation functionality
    • update-changelog.ts - Updates the changelog when the types change
  • /src - Contains the generated TypeScript types
    • types/omp.ts - The generated TypeScript types
    • index.ts - Exports the types for use in other projects
  • /cache - Stores the cached schema for comparison
    • /cache/oh-my-posh - Cached clone of the Oh My Posh repository for validation
  • /temp - Temporary directory used during testing
  • theme-validation.md - Report of theme validation results
  • theme-validation-badge.svg - Visual badge showing theme validation status
  • /.github/workflows - CI/CD workflows, including the nightly type generation

Requirements

  • Node.js 18+
  • ESM-compatible environment (for chalk v5+ and other ESM dependencies)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request