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

confstash

v0.1.5

Published

Standardized project configuration loading — config files, rc files, presets, and layered merge with provenance

Readme

confstash

Standardized project configuration loading for CLI tools — the project-level complement to appstash (user-level directories).

Give it a tool name and it discovers mytool.config.{ts,js,mjs,cjs}, .mytoolrc{,.json,.yaml,.yml,.js}, mytool.json, and package.json keys via walk-up search, resolves extends/preset chains, and merges layered configuration with per-key provenance:

defaults -> presets (extends) -> user stash -> project file -> env vars -> runtime overrides

Installation

npm install confstash

Features

  • Walk-up discovery: finds config in the current directory or any parent
  • Every format: .config.ts/js/mjs/cjs modules, rc files (JSON/YAML), JSON, package.json keys
  • Presets & extends: named presets, relative paths, or npm packages — recursively, with cycle detection
  • Layered merge: deterministic precedence with replace or concat array strategies
  • Provenance: explainSync() tells you which layer supplied every value (--print-config UX)
  • Sync and async: fully synchronous path for CLIs (ESM configs require load())
  • User layer: optional ~/.<tool>/config/config.json layer via appstash
  • Typed: defineConfig<T>() + generic loader for full type safety

Usage

Basic Usage

import { createConfigLoader } from 'confstash';

interface MyConfig {
  level: string;
  rules: Record<string, string>;
}

const loader = createConfigLoader<MyConfig>({
  tool: 'mytool',
  defaults: { level: 'medium', rules: {} }
});

const { config, filepath, layers, isEmpty } = loader.loadSync();
// or: await loader.load()  — also supports .mjs / ESM configs

Presets and extends

const loader = createConfigLoader<MyConfig>({
  tool: 'mytool',
  presets: {
    'mytool:recommended': { level: 'medium', rules: { A1: 'error' } },
    'mytool:strict': { extends: 'mytool:recommended', level: 'high' }
  }
});
// .mytoolrc.json
{
  "extends": "mytool:strict",     // or "./team-preset.js", or "some-npm-pkg"
  "rules": { "A1": "off" }
}

Typed config authoring

// mytool.config.ts
import { defineConfig } from 'confstash';

export default defineConfig({
  extends: 'mytool:recommended',
  level: 'high'
});

Environment and CLI layers

const loader = createConfigLoader<MyConfig>({
  tool: 'mytool',
  envLayer: (env) => (env.MYTOOL_LEVEL ? { level: env.MYTOOL_LEVEL } : {}),
  userStash: true // include ~/.mytool/config/config.json (via appstash)
});

const { config } = loader.loadSync({
  overrides: parsedCliFlags // highest precedence
});

Provenance / print-config

for (const entry of loader.explainSync()) {
  console.log(`${entry.path} = ${JSON.stringify(entry.value)}  (${entry.source}: ${entry.origin})`);
}
// level = "high"        (file: /repo/mytool.config.ts)
// rules.A1 = "error"    (preset: mytool:recommended)

Custom search places

// pgpm-compatible discovery
const loader = createConfigLoader({
  tool: 'pgpm',
  searchPlaces: ['pgpm.config.js', 'pgpm.json'],
  arrayMerge: 'replace'
});

API

createConfigLoader<T>(options)

Options:

  • tool (string): tool name; drives default search places and the user stash directory
  • searchPlaces (SearchPlace[]): filenames or { packageJson: key } entries, in precedence order
  • defaults (Partial): lowest-precedence layer
  • presets (Record<string, Partial>): named presets resolvable via extends
  • envLayer ((env) => Partial): map environment variables into a layer
  • userStash (boolean): include ~/.<tool>/config/config.json (default false)
  • arrayMerge ('replace' | 'concat'): array strategy (default 'replace')
  • validate ((config: T) => T | void): validate/normalize the merged result
  • walkUp (boolean): search parent directories (default true)

Returns: ConfigLoader<T> with load(params), loadSync(params), explainSync(params), searchPlaces.

Load params: cwd, overrides, configFile (skip discovery), env.

Utilities

  • defineConfig<T>(config) — identity helper for typed config files
  • defaultSearchPlaces(tool) — the derived search place list
  • findConfigSync(startDir, searchPlaces, walkUp?) / findUpDir(startDir, filename) — discovery primitives
  • loadFileSync(found) / loadFile(found) — format-aware file loading
  • deepMerge(target, source, arrayMerge?) / mergeLayers(layers) / explainLayers(layers) — merge primitives
  • ConfigLoadError — thrown for unreadable/invalid config files

Related

  • appstash — user-level directories (~/.<tool>/{config,cache,data,logs}) and the optional userStash layer

Development

Setup

  1. Clone the repository:
git clone https://github.com/constructive-io/dev-utils.git
  1. Install dependencies:
cd dev-utils
pnpm install
pnpm build
  1. Test the package of interest:
cd packages/<packagename>
pnpm test:watch

Credits

🛠 Built by the Constructive team — creators of modular Postgres tooling for secure, composable backends. If you like our work, contribute on GitHub.

Disclaimer

AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.

No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.