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

@imoverlord/yamlfmt

v0.3.0

Published

google yamlfmt sdk for node.js

Downloads

82

Readme

Project license

Pull Requests welcome code with love by ImOverlord


About

When building tools that manipulate YAML files, I would encounter issues where they wouldn't respect the formatting rules. Instead of building another YAML formatter, I wanted to try to include the formatter directly from JS. Using WASM, this tool calls yamlfmt directly with the specified config.

Getting Started

Prerequisites

Explain what is needed to run the project

Installation

npm i @imoverlord/yamlfmt

Usage

import { formatYAML } from "./index.ts"

const yaml = `
app:
  versions:
    - name: cake
      version: 1.0.0
    - name: cookie
      version: 2.0.0
`

await formatYAML(yaml)

formatYAML will start the Go wasm if needed and the directly pass the string to yamlfmt go formatter.

You can specify a config if needed. The config should support all options from yamlfmt config.

import { formatYAML } from "./index.ts"

const yaml = `
app:
  versions:
    - name: cake
      version: 1.0.0
    - name: cookie
      version: 2.0.0
`

await formatYAML(yaml, { indentlessArrays: true })

Config

| Name | Type | Default | Description | |:----------------------------|:---------------|:--------|:------------| | indent | int | 2 | The indentation level in spaces to use for the formatted yaml. | | includeDocumentStart | bool | false | Include --- at document start. | | lineEnding | lf or crlf | crlf on Windows, lf otherwise | Parse and write the file with "lf" or "crlf" line endings. This setting will be overwritten by the global line_ending. | | retainLineBreaks | bool | false | Retain line breaks in formatted yaml. | | retainLineBreaksSingle | bool | false | (NOTE: Takes precedence over retain_line_breaks) Retain line breaks in formatted yaml, but only keep a single line in groups of many blank lines. | | disallowAnchors | bool | false | If true, reject any YAML anchors or aliases found in the document. | | maxLineLength | int | 0 | Set the maximum line length (see note below). if not set, defaults to 0 which means no limit. | | scanFoldedAsLiteral | bool | false | Option that will preserve newlines in folded block scalars (blocks that start with >). | | indentlessArrays | bool | false | Render - array items (block sequence items) without an increased indent. | | dropMergeTag | bool | false | Assume that any well formed merge using just a << token will be a merge, and drop the !!merge tag from the formatted result. | | padLineComments | int | 1 | The number of padding spaces to insert before line comments. | | trimTrailingWhitespace | bool | false | Trim trailing whitespace from lines. | | eofNewline | bool | false | Always add a newline at end of file. Useful in the scenario where retainLineBreaks is disabled but the trailing newline is still needed. | | stripDirectives | bool | false | YAML Directives are not supported by this formatter. This feature will attempt to strip the directives before formatting and put them back. Use this feature at your own risk. |

Table was taken directly from yamlfmt config documentation. The keys were adapted to be typescript friendly camel case instead of pascal case.

License

This project is licensed under the Apache-2.0 license.

See LICENSE for more information.