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

enablement-k8s-replacements

v0.7.12

Published

A CLI tool and Node.js library for applying version, replica, resource, and string replacements to Kubernetes YAML files as part of a CI/CD pipeline.

Readme

enablement-k8s-replacements

A CLI tool and Node.js library for applying version, replica, resource, and string replacements to Kubernetes YAML files as part of a CI/CD pipeline.

Installation

pnpm add enablement-k8s-replacements

CLI Usage

npx enablement-k8s-replacements [options]

Options

| Option | Description | Default | |---|---|---| | --searchPatterns <patterns> | Comma-separated glob patterns for YAML files | **/*.yaml | | --versionFile <paths> | Comma-separated paths to version config JSON files | tests/versions.json | | --scanPackage | Scan package.json files to auto-populate versions | false | | --noupdate | Dry-run; do not write changes to disk | false | | --test | Write modified files as <file>.debug instead of overwriting | false | | --debug | Emit verbose logging | false |

Example

# Apply versions from a version file to all YAML files under deploy/
npx enablement-k8s-replacements --searchPatterns deploy/**/*.yaml --versionFile versions.json

# Preview changes without writing
npx enablement-k8s-replacements --test --versionFile versions.json

Version File Format

The version file is JSON. It can be a flat key/value map of name → version, or a structured object with versions, replicas, resources, and strings sections.

{
  "versions": {
    "my-service": "1.4.2",
    "other-service": "2.0.0"
  },
  "replicas": {
    "_default": 0,
    "api": 3,
    "worker": 1
  },
  "resources": {
    "_defaults": {
      "requests": { "cpu": "100m", "memory": "128Mi" },
      "limits":   { "cpu": "500m", "memory": "512Mi" }
    },
    "api": {
      "limits": { "memory": "1Gi" }
    }
  },
  "strings": {
    "_defaults": {
      "CLUSTER_ENV": "production"
    },
    "api": {
      "MY_TOKEN": "abc123"
    }
  }
}

YAML Placeholder Syntax

| Syntax | Type | Example | |---|---|---| | name:REPLACE | Docker image tag | my-service:REPLACEmy-service:1.4.2 | | name==REPLACE | Python/pip pin | my-service==REPLACEmy-service==1.4.2 | | name@REPLACE | npm package | my-service@REPLACE[email protected] |

Programmatic API

import {
  replaceVersions,
  replaceReplicas,
  replaceResources,
  replaceStrings,
  defaultOptions,
  parseArgs,
  main,
} from 'enablement-k8s-replacements/src/lib.js';

replaceVersions(txt, versions)

Replaces all name:REPLACE, name==REPLACE, and name@REPLACE placeholders in txt.

replaceReplicas(txt, replicas, name, options)

Replaces replicas: N in a deployment YAML using the value for name in the replicas map, or _default if not specified.

replaceResources(txt, resources, name, doc)

Merges resource limits and requests into container specs inside a parsed YAML document. Set a resource value to "0" or 0 to delete that key.

replaceStrings(txt, strings, name)

Applies regex-based string substitutions from the strings._defaults and strings[name] maps.

defaultOptions()

Returns the default options object used by the CLI.

parseArgs(argv, options)

Parses process.argv-style arguments into an options object. Throws Error('Expected a known option') for unrecognized flags.

main(options)

Runs the full replacement pipeline and returns 'DONE'. Does not call process.exit.

Development

# Run unit tests
pnpm test

# Watch mode
pnpm test:watch

License

MIT