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

bake-bash

v1.1.1

Published

Simple bash make utility

Downloads

8

Readme

Bake

Simple Bash build/project utility in the style of rake.

Not trying to reinvent wheel. Most node project Makefiles are just Bash scripts.

Installation

npm install bake-bash

Usage

Display tasks

bake

Run task

bake <task>

Example Bakefile

function private {
    echo in private
}

#. Builds the project
function build {
    # ensures clean is called only once
    bake-invoke "clean"
    bake-ok building ...
    # clean will not run again
    bake-invoke "clean"
}

#. Cleans the project
function clean {
    bake-ok "cleaning ..."
    private
}

#. Renders hello-template.sh
function render-template {
    bake-ok "compiling template ..."
    bake-render-template hello-template.sh | cat
    bake-ok "coffe" "compiled"
}

function on-task-not-found {
    echo "Task not found $1"
}

Rules

  • bake searches the current and parent directories for a Bakefile to run.
  • Tasks are defined as normal Bash functions.
  • A task description is simply a comment that starts with #. and precedes a function.

Functions

Prints a red error message.

bake-error <action> <description>

example: bake-error "compiling" "src/lib/test.coffee"

Prints a plain message.

bake-log <action> <description>

example: bake-log "bake" "Processing bakefile..."

Prints a green ok message.

bake-ok <action> <description>

example: bake-ok "compiling" "compiled src/lib/test.js"

Prints a cyan info message.

bake-info <action> <description>

example: bake-info "bake" "built project in 700ms"

Invokes a task only once.

bake-invoke <function_name>

example: bake-invoke "clean"

Determines if target is older than reference, returning 1 if outdated.

bake-outdated <target> <reference>

examples:

bake-outdated build src || return 1      # skip rest of task
outdated build src && invoke "compile"  # compile if outdated

Renders a heredoc file template

bake-render-template template.sh > newfile.txt

Run a dynamic task when task $1 is not found. For example, to run a test as the first argument to bake, add this to Bakefile

function on-task-not-found {
    [[ -f test/$1.js ]] && mocha test/$1.js && return 0
    return 1
}