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

@topoconfig/cmds

v0.2.25

Published

Topoconfig basic cmds preset

Readme

@topoconfig/cmds

topoconfig basic cmds preset

lcov npm (scoped)

Status

Working draft

Install

yarn add @topoconfig/cmds

Usage

import {topoconfig} from 'topoconfig'
import * as cmds from '@topoconfig/cmds'

const config = await topoconfig({
  data: {},
  sources: {},
  cmds
})

get

lodash.get-inspired dot-prop reader.

import {topoconfig} from 'topoconfig'
import {get} from 'topoconfig/cmds'

const config = await topconfig({
  cmds: {get},
  data: '$b',
  sources: {
    a: {
      data: {
        foo: {
          bar: 'baz'
        }
      }
    },
    b: 'get $a .foo.bar' // gives 'baz'
  }
})

file

Reads file.

import {topoconfig} from 'topoconfig'
import {file, json} from 'topoconfig/cmds'

const config = await topoconfig({
  cmds: {
    file,
    json
  },
  data: {
    contents: '$contents'
  },
  sources: {
    contents: 'file file.json > json'
  }
})

json

Parses value as JSON.

import {topoconfig} from 'topoconfig'
import {json} from 'topoconfig/cmds'

const config = await topoconfig({
  cmds: {
    json
  },
  data: {
    contents: '$contents'
  },
  sources: {
    contents: 'json {"foo":"bar"}'
  }
})

yaml

Parses value as YAML.

import {topoconfig} from 'topoconfig'
import {yaml} from 'topoconfig/cmds'

const config = await topoconfig({
  cmds: {
    yaml
  },
  data: {
    contents: '$contents'
  },
  sources: {
    contents: 'yaml "foo: bar"'
  }
})

http

Invokes Fetch API to get data from remotes.

import {topoconfig} from 'topoconfig'
import {http, get, json} from 'topoconfig/cmds'

const config = await topoconfig({
  cmds: {
    http,
    get,
    json
  },
  data: {
    price: '$price',
    title: '$title'
  },
  sources: {
    res: 'http https://dummyjson.com/products > get body > json',
    title: 'get $res products.0.title',
    price: 'get $res products.0.price',
  }
})

// {title: 'iPhone 9', price: 549}

conf

Wraps the value with conf API, to bring dot-prop r/w opts, validation, file sync, etc.

import {topoconfig} from 'topoconfig'
import {conf} from 'topoconfig/cmds'

const config = await topoconfig<ReturnType<typeof conf>>({
  data: '$b',
  sources: {
    a: {
      data: {
        foo: {
          bar: 'baz'
        }
      }
    },
    schema: {
      data: {
        foo: {
          properties: {
            bar: {
              type: 'string'
            }
          }
        }
      }
    },
    b: 'conf $a $schema'
  },
  cmds: {
    conf
  }
})

config.get('foo.bar')     // 'baz'
config.set('foo.bar', 1)  // Error: Config schema violation: `foo/bar` must be string

dot

Applies doT to value resolution. Follow the v2 API guides for details.

import {topoconfig} from 'topoconfig'
import {dot} from 'topoconfig/cmds'

const config = await topoconfig({
  cmds: {dot},
  data: '$filename',
  sources: {
    filename: 'dot {{= "$env.ENVIRONMENT_PROFILE_NAME" || "kube" }}.json',
    env: {
      data: { ENVIRONMENT_PROFILE_NAME: 'prod' }
    }
  }
})
// prod.json

cwd

Returns process.cwd()

import {topoconfig} from 'topoconfig'
import {cwd} from 'topoconfig/cmds'

const config = await topoconfig({
  cmds: {cwd},
  data: '$cwd',
  sources: {
    cwd: 'cwd'
  }
})
// /current/working/dir

ip

Resolves current ip.

import {topoconfig} from 'topoconfig'
import {ip} from 'topoconfig/cmds'

const config = await topoconfig({
  cmds: {ip},
  data: '$ip',
  sources: {
    ip: 'ip'
  }
})

// 10.10.0.12

ajv

Validates values by json-schema via ajv. Extra ajv-formats included.

import {topoconfig} from 'topoconfig'
import {ajv} from 'topoconfig/cmds'

const config = await topoconfig({
  cmds: {ajs},
  data: '$output',
  sources: {
    object: {foo: 'bar'},
    schema: {type: 'object', properties: {foo: {type: 'string'}}},
    output: 'ajv $object $schema'
  }
}) // returns {foo: 'bar'} if it mathes the schema

argv

Returns minimist-parsed argv.

//  app.js
import {topoconfig} from 'topoconfig'
import {argv} from 'topoconfig/cmds'

const config = await topoconfig({
  cmds: {argv},
  data: {
    param: '$argv.foo'
  },
  sources: {
    argv: 'argv'
  }
}) // {param: 'bar'}

// node app.js --foo=bar

env

Refers to process.env.

// app.js
import {topoconfig} from 'topoconfig'
import {env} from 'topoconfig/cmds'

const config = await topoconfig({
  cmds: {env},
  data: '$env.DEBUG',
  sources: {
    env: 'env'
  }
}) // 'true'
// DEBUG=true node app.js

g

Returns a ref to global object.

import {topoconfig} from 'topoconfig'
import {g} from 'topoconfig/cmds'

const config = await topoconfig({
  cmds: {g},
  data: '$global.foo',
  sources: {
    global: 'g'
  }
})
// refers to this.globalThis.foo

pkg

Reads the closest package.json via read-pkg-up

import {topoconfig} from 'topoconfig'
import {pkg} from 'topoconfig/cmds'

const config = await topoconfig({
  cmds: {pkg},
  data: '$pkg.name',
  sources: {
    pkg: 'pkg'
  }
}) // 'toposource'

xtends

Populate extends ref in config files via @topoconfig/extends.

import {topoconfig} from 'topoconfig'
import {file, xtends} from 'topoconfig/cmds'

const config = await topoconfig({
  cmds: {
    xtends
  },
  data: {
    contents: '$contents'
  },
  sources: {
    contents: 'file.json > xtends'
  }
})

License

MIT