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

omnistudio-formatter

v1.0.2

Published

Formats Salesforce Omnistudio metadata XML files (Omniscript, Flexcard, Integration Procedure, Data Mapper)

Readme

omnistudio-formatter

CI npm version npm downloads License: GPL-3.0

Node.js library that formats and minifies Salesforce Omnistudio metadata XML files.

  • Pretty-prints embedded JSON inside OmniScript, FlexCard, Integration Procedure, and Data Mapper XML fields
  • Sorts Data Mapper items by globalKey for deterministic diffs
  • Minifies JSON before deploy to keep payloads small

Installation

npm install omnistudio-formatter

CLI

# Install globally to use the CLI
npm install -g omnistudio-formatter
Usage: omnistudio-formatter <command> [options] <path>

Commands:
  format <path>   Format a file or all Omnistudio files in a directory
  minify <path>   Minify a file or all Omnistudio files in a directory

Options:
  --indent, -i <n>   Indentation: tab (default), 2, or 4 spaces

Examples

# Format all files in a directory
omnistudio-formatter format force-app/main/default/omnistudio

# Format a single file with 2-space indent
omnistudio-formatter format MyScript.os-meta.xml --indent 2

# Minify a single file before deploying
omnistudio-formatter minify MyScript.os-meta.xml

# Minify all files in a directory
omnistudio-formatter minify force-app/ --indent 4

API

const { formatFile, formatFileContent, formatDirectory, minifyFile } = require("omnistudio-formatter");

All functions are synchronous.

formatFileContent(filePath, content, indent?)

Pure in-memory formatter — reads nothing, writes nothing. Returns a result object.

const result = formatFileContent(
    "MyOmniScript.os-meta.xml",
    xmlString,
    "\t", // optional: "\t" (default), "  ", or "    "
);

console.log(result.changed); // true if formatting changed the content
console.log(result.formatted); // formatted XML string (only present when changed)
console.log(result.message); // human-readable status message

formatFile(filePath, indent?)

Reads a file, formats it, and writes it back if changed.

const result = formatFile("path/to/MyFlexCard.ouc-meta.xml", "\t");
console.log(result.message); // "Formatted: ..." or "Already formatted: ..."

formatDirectory(dirPath, indent?)

Formats all Omnistudio XML files under a directory recursively.

const results = formatDirectory("force-app/main/default", "\t");
results.forEach((r) => console.log(r.message));

minifyFile(filePath, indent?)

Compacts embedded JSON in the file (for use before deploying to an org). Reads and writes the file on disk.

const result = minifyFile("path/to/MyScript.os-meta.xml", "\t");
console.log(result.changed); // true if the file was changed

Return values

All functions return a result object:

| Field | Type | Description | | ----------- | --------- | -------------------------------------------------------------- | | filePath | string | Path passed to the function | | changed | boolean | Whether the content was modified | | formatted | string | The formatted/minified content (only when changed is true) | | message | string | Human-readable status message |

Supported metadata types

| File extension | Metadata type | JSON fields formatted | | --------------- | ------------------------------- | ------------------------------------------------------------------------------------------- | | .os-meta.xml | OmniScript | propertySetConfig | | .oip-meta.xml | OmniIntegrationProcedure | customJavaScript, elementTypeComponentMapping, propertySetConfig | | .ouc-meta.xml | OmniUiCard (FlexCard) | dataSourceConfig, propertySetConfig, sampleDataSourceResponse, stylingConfiguration | | .rpt-meta.xml | OmniDataTransform (Data Mapper) | expectedInputJson, expectedOutputJson, previewJsonData, transformValuesMappings |

License

GPL-3.0