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

kinder

v1.0.2

Published

Easily create simple shell commands with a local config file.

Downloads

9

Readme

kinder

Easily create simple shell commands with a local config file.

Installation

Run this in your project folder:

npm install --save kinder

Usage

Here is an example for a shell command called mycommand, configured via kinder:

const Kinder = require("kinder");

Kinder({
  name: "mycommand",
  commands: {
    default: {
      description: "The default command which runs when you simply enter `mycommand` in your shell.",
      execute: ({ info, hostname, users, repos} = config) -> { /* do something with config argument */ }
    },
    custom: {
      description: "A custom command which runs when you enter `mycommand custom` in your shell.",
      execute: ({ info, hostname, users, repos} = config) -> { /* do something with config argument */ }
    }
  },
  props: {
    info: {
      description: "Essential information",
      required: true
    },
    hostname: {
      description: "Your website hostname",
      default: "my.website.com"
    }
  },
  lists: {
    users: {
      description: "Users to query"
    },
    repos: {
      description: "Repos to query"
    }
  }
});

Assuming this is an index.js file, in order to make it a shell command, add a bin property to your project's package.json, like so:

"bin": {
  "mycommand": "./index.js"
}

Assuming the above configuration, you'll now have these shell commands at you disposal:

  • mycommand - Executes the function under the commands.default.execute. The function will receive your persisted configuration object as its first argument.
  • mycommand custom - Executes the function under the commands.custom.execute. The function will receive your persisted configuration object as its first argument.
  • mycommand reset - Resets your local config.
  • mycommand get info - Shows the saved info value in your local config.
  • mycommand set info <info> - Sets as the saved info property in your local config.
  • mycommand get hostname - Shows the saved hostname value in your local config. Defaults to my.website.com.
  • mycommand set hostname <hostname> - Sets as the saved hostname property in your local config.
  • mycommand list users - Lists all the users in your local config.
  • mycommand add users <users, command separated> - Adds (command separated) to the users list in your local config.
  • mycommand remove users <users, command separated> - Removes (command separated) from the saved users list in your local config.
  • mycommand list repos - Lists all the saved repos in your local config.
  • mycommand add repos <repos, command separated> - Adds (command separated) to the repos list in your local config.
  • mycommand remove repos <repos, command separated> - Removes (command separated) from the saved repos you in your local config.
  • mycommand help - Shows an help message with all the above commands.

Tips

  • required properties which are not set in your local config, will trigger entering their values whenever you run the default or a custom command.
  • Kinder validates your config object for any missing essential keys, typos or unsupported keys.