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

calzone

v0.0.3

Published

a no-nonsense wrapper around gulp

Downloads

5

Readme

calzone

A command-line, project-based wrapper around gulp in an attempt to make JavaScript builds more fun and less complicated.

Installation

Install with npm:

npm install -g calzone

This will expose a command-line utility that can be run with:

$ calzone --help # for example...

Overview

calzone takes build hints from two sources:

  1. Build configuration defined explicitly in a .builders.json file
  2. An /* @build ... */ annotation in your source file

The program will then create gulp streams and build your files. By default, calzone assumes a directory structure like the following:

src/
	=> all your files...
build/
	=> where calzone directs gulp.dest() to put files

This directory structure can be overridden by options in .builders.json.

Example Usage

Say we have the following directory structure:

src/
	index.js
	util.js

and suppose our index.js is written in ECMAScript 7, and we need to transpile it using Babel:

/* @build babel |> uglify({ preserveComments: false }) */
import util from './util'

async function main() {
	await util.longRunningOperation()
	console.log('Done.')
}
main()

First, you'll notice that our file declaratively defines how it is intended to be built with the @build annotation build-hint. In this example, we declare that our file should be piped through two builders: babel and uglify. Piping is designated using the pipe-operator |>. Furthermore, configuration data can be passed to each builder as is seen with passing { preserveComments: false} to the uglify builder.

Builders

Options (and builders) are defined in your .builders.js file. For example, if you have a LESS file with a build-annotation like /* @build less */, you may define a builder like:

// .builders.js
var autoprefixer = require('gulp-autoprefixer')
var less = require('gulp-less')

module.exports.builders = {
	less: function() {
		return this.pipe(less())
			.pipe(autoprefixer())
	}
}

As demonstrated, builders take the current stream via this, and must return the resulting stream.

@build annotation

The build-annotation's pseudo-grammar can be defined by the following:

@build (builder |>)* builder?
builder: name params?
params: (json-object)

Project settings:

You may also override many of calzone's settings by creating a .builders.json file:

{
	"src": "src/directory",
	"out": "output/directory",
	"files": {
		"src/index.js": [ { type: "babel" }, { type: "uglify", config: { preserveComments: false } } ],
		"src/public/web-app.js": [ { type: "webpack" } ]
	}
}

Default Builders

calzone defines a few default builders for your convenience, assuming their appropriate packages are installed in your local node_modules directory:

  • autoprefixer
  • babel
  • coffee
  • less
  • react
  • uglify
  • webpack

So, if you have gulp-autoprefixer installed in your local node_modules folder, you may make use of this builder (for example, via /* @build less */), without defining it in your .builders.js file.