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

cbf

v2.3.2

Published

A package for creating scripts to store and run your most commonly used CLI commands for a repo or just in general

Downloads

127

Readme

CBF 🦥

cbf sloth

npm version Build Status vulnerabilities

CBF 🦥is a simple CLI tool for developers who can't be f#@!'d learning or remembering all the commands they have to run day to day or just in a specific repo.

demo

Developers build scripts that can either be saved directly to CBF or loaded on the fly from a local cbf.yml file. The script will then serve as living, breathing runnable documentation for new starters, infrequent contributors or just developers who can't be f#@!'d learning or remembering all the commands.

Check out the wiki to get started!

Installation

npm i cbf -g

or

yarn global add cbf

Scripts

Simple scripts

CBF simple scripts can be stored as json or yaml files but must end with either .simple.json or .simple.yml so CBF knows to parse them differently than advanced scripts.

Simple scripts are made up of options and commands.

  1. The first tag is required and is the scripts name
  2. options are stored as keys
  3. commands are stored as values

Note: If you would like to customise directories, messages or variables passed to each command please use advanced scripts.

Example simple yaml script

hello:
  world: "echo 'Hello, world!'"
  mars: "echo 'Hello, mars!'"
  jupiter: "echo 'Hello, jupiter!'"

Example simple json script

{
  "hello": {
    "world": "echo 'Hello, world!",
    "mars": "echo 'Hello, mars!",
    "jupiter": "echo 'Hello, jupiter!"
  }
}

You can fine more example simple scripts here.

Advanced scripts

CBF advanced scripts can be stored as json or yaml files. Advanced scripts are made up of options, command, variables, message and directory tags that are used to construct the layout of the script.

  1. The first tag is required and is the scripts name
  2. options tags are used to store lists of more options or command's
  3. command tags are used to store one or many strings containing shell commands
  4. variables tags are used to prompt the user for variables to be replaced in a command
  5. message tags are used to store messages that are printed to stdout when an option or command is selected
  6. directory tags are used to set where a command should be ran. When a command is ran, CBF recursively searches for the commands set directory or closest set parent directory tag

Example advanced yaml script

example-project:
  message: 'Run, build or test example project?'
  directory: '~/projects/example'
  options:
    run:
      message: 'Running example project...'
      command: 'yarn start'
    build:
      directory: '~/projects/example/src'
      message: 'Building example project...'
      command: 'yarn install'
    test:
      message: 'Run unit or integration tests?'
      options:
        unit:
          message: 'Running example project unit tests'
          command: 'yarn test:unit'
        integration:
          message: 'Running example project integration tests'
          command: 'yarn test:integration'

Example advanced json script

{
  "example-project": {
    "message": "Run, build or test example project?",
    "directory": "~/projects/example",
    "options": {
      "run": {
        "message": "Running example project...",
        "command": "yarn start"
      },
      "build": {
        "directory": "~/projects/example/src",
        "message": "Building example project...",
        "command": "yarn install"
      },
      "test": {
        "message": "Run unit or integration tests?",
        "options": {
          "unit": {
            "message": "Running example project unit tests",
            "command": "yarn test:unit"
          },
          "integration": {
            "message": "Running example project integration tests",
            "command": "yarn test:integration"
          }
        }
      }
    }
  }
}

You can fine more example advanced scripts here.

Local CBF file

Commit a cbf.yml to your repository so developers can run cbf or cbf -d to easily run and view commands related to the repository.

Package.json

Can't be f#@!'d writing a CBF script? Well guess what? You can just run cbf or cbf -d to easily run and view commands saved in the scripts section of your repos package.json file.

Note: If there is a local cbf.yml file it will always instead of a package.json file when just using cbf or cbf -d. However, you can manually choose to run the scripts from a package.json by running cbf -j or cbf -dj.

Additionally, you can filter out props by passing a comma separated list of property keys e.g.

cbf -j preinstall,postinstall

Usage

λ cbf -h

Usage: cbf [options]

cbf is a simple CLI tool for developers who can't be f#@!'d learning or remembering commands.

Go to https://github.com/joshuatvernon/cbf to learn how to make cbf scripts.

Options:
  -V, --version                       output the version number
  -D, --delete [script name]          delete a previously saved script
  -A, --delete-all                    delete all previously saved scripts
  -d, --documented                    prepends the command to the questions when running a script
  -R, --dry-run                       prints the command that would have been run to stdout
  -j, --json [comma separated props]  run scripts in a package json file
  -l, --list                          list previously saved scripts
  -N, --npm-alias                     set an alias that should be ran instead of npm when running scripts in a package json
  -p, --print [script name]           print a saved script
  -r, --run [script name]             run a previously saved script
  -s, --save <path to script file>    process and save a script from a yaml or json file
  -S, --shell                         set which shell commands should be run within
  -h, --help                          output usage information

Copyright

MIT