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 🙏

© 2024 – Pkg Stats / Ryan Hefner

sentaku

v0.2.0

Published

A simple, minimalist config manager

Downloads

3

Readme

Sentaku

sentaku (Japanese) -- noun -- selection; choice; option

A simple, minimalist config manager for Node.js projects.

Installing

$ npm i --save sentaku

Why Sentaku

One of the simplest ways to use a config in a Node.js project is to require a config.js file that exports a JS object:

// config.js
module.exports = {
  key: 'value',
  simple: true
}
// app.js
var conf = require('./config.js')

console.log(conf.simple)

Sentaku is that, plus support for NODE_ENV-specific configs and a little pathing goodness.

This approach has numerous benefits:

  • Configuration as code -- configs are JS objects, so you can do javascript-y things like generating keys with getters
  • No synchronous filesystem reads to find and access configs
  • No parsing libraries to turn your configs into a native javascript object for consumption... because your configs are already a native javascript object

Sentaku is intentionally minimalist. If you would like more features in your config manager, I encourage you to check out the many great configuration modules out there.

Using Sentaku

// node_modules/sentakuConfs/default.js
module.exports = {
  key: 'val'
}
// any file in app
var conf = require('sentaku')
  • Put configs in node_modules/sentakuConfs (or symlink that path to your config dir)
  • Default config values in default.js
  • Env-specific overrides in {env}.js -- no fuzzy-matching, so NODE_ENV=dev matches dev.js not development.js
    • Sentaku assumes NODE_ENV is dev unless otherwise specified
  • Access config values with property accessors

If you've ignored the entire node_modules directory with .gitignore, you'll likely want to amend that so sentakuConfs gets committed:

# .gitignore
node_modules/*
!node_modules/sentakuConfs

Regarding Security, Configs, and Version Control

Don't put private info (e.g. your AWS Secret Key) in version-controlled configs that might end up in public repos.

If you commit sensitive info to any public repo, consider it compromised. If this happens, you should always generate a new key or password. You can mitigate the damage by following GitHub's instructions here, but even then you should still probably generate a new key or password.

For open-source projects that interact with private apis/keys/passwords, consider creating a default.js.example in your config dir with blank values and committing that file while adding your actual default.js to your .gitignore.

License

Mit. See license.