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

toml-x

v0.1.1

Published

CLI tool and library to merge TOML files with deep merge strategy

Readme

toml-x

CLI tool and library to merge TOML files using deep merge strategy.

This simple project uses smol-toml to parse and stringify TOML files and defu to merge them.

Installation

# Install globally for CLI usage
npm i -g toml-x

# Or use with npx
npx toml-x [...]

# Install as a library
npm i toml-x

CLI Usage

toml-x <command> [flags] [...files]

Commands

merge

Merge multiple TOML files where later files override earlier ones.

# Merge two files and output to stdout
toml-x merge base.toml overrides.toml

# Save merged output to a new file
toml-x merge base.toml overrides.toml > new_config.toml

# Merge multiple files
toml-x merge base.toml overrides1.toml overrides2.toml > final.toml

# Format numbers as floats
toml-x merge --numbers-as-float base.toml overrides.toml

# Don't add the auto-generated comment at the top
toml-x merge --skip-comment base.toml overrides.toml

Flags

  • --numbers-as-float - Preserve float formatting (e.g., 1.0 instead of 1)
  • --skip-comment - Skip adding the auto-generated comment at the top
  • --help, -h - Show help message

How it works

The tool:

  1. Parses all TOML files using smol-toml
  2. Merges them using defu with deep merge strategy
  3. Outputs the merged TOML to stdout

Library Usage

You can also use toml-x as a library in your Node.js projects:

import { merge } from 'toml-x'

const base = `
[server]
host = "localhost"
port = 8080
`

const override = `
[server]
port = 3000
debug = true
`

// Merge configs
const result = merge([base, override])
console.log(result)
// Output:
// # This file is autogenerated by toml-x
//
// [server]
// host = "localhost"
// port = 3000
// debug = true

// With options
const result2 = merge([base, override], {
  numbersAsFloat: true      // Format numbers as floats
})

API

merge(configs: string[], options?: { numbersAsFloat?: boolean }): string

Merge multiple TOML file contents using deep merge strategy.

Parameters:

  • configs - Array of TOML file contents as strings
  • options - Optional merge options
    • numbersAsFloat?: boolean - Format numbers as floats (default: false)

Returns: Merged TOML as a string

Throws: Error if configs array is empty or if any config has invalid TOML syntax

Development

# Install dependencies
pnpm install

# Build
pnpm run build

# Run tests
pnpm test

# Run tests once
pnpm test:run

License

ISC