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 🙏

© 2025 – Pkg Stats / Ryan Hefner

craft

v0.1.0

Published

An HTML5 crafting API.

Readme

craft

An HTML5 crafting API.

example

View this example.

It loads up most (not all) of the Minecraft recipes and items. The textures are completely themeable using existing Minecraft texture packs too.

// create a crafter
var crafter = require('craft')();

// add a recipe for a torch
crafter.recipe({
  have: [
    ['coal'],
    ['stick'],
  ],
  give: ['torch', 4],
});

// craft your item
var item = crafter.craft([
  ['coal'],
  ['stick'],
]);
console.log('You get ' + item.give[1] + 'x ' + item.give[0] + '!');

// item is now a normalized recipe

Minecraft-like Recipe Format

If you specify more than one argument to crafter.recipe() it will assume you're entering a recipe in a Minecraft-like format:

// turn a box of dirt into 2 diamonds
crafter.recipe(['diamond', 2], [
  'DDD',
  'D D',
  'DDD',
], ['D', 'dirt', 2]);
  • The first argument is what the recipe will give and how much.
  • The second argument is a map of the recipe.
  • The following arguments indicate what each of the characters within the map are equivalent to and how much are required.

Popular Mod Recipe Format

crafter.recipe() also accepts a shorthand popular mod format. Enter as strings, a single recipe per line:

crafter.recipe([
  // recipe for a ladder
  'shaped ( log+null+log / log+log+log / log+null+log ) > ( ladder,16 )',
  // planks
  'shaped stick+stick ; stick+stick > planks',
].join('\n'));

web user interface

Also included is a web user interface.

var webui = require('craft/webui')({
  container: document.getElementById('crafting')
});

View the example for a more in depth example.

api

require('craft')(options)

Returns a new craft instance.

crafter.recipe(data[, ...])

Add a new recipe to the crafter.

crafter.craft([when], have)

Input have into the crafter and it will search for a matching recipe then return the matching recipe.

require('craft/webui')(options)

Returns a crafting web UI instance. Specify a container option that contains your crafting grids.

Events: pickup and drop

Events emitted as an item is picked up and dropped:

webui.on('pickup', function(itemSlot, quantityPickedUp) {});
webui.on('drop', function(itemSlot, quantityDropped) {});

install

With npm do:

npm install craft

Use browserify to require('craft').

release history

  • 0.1.0 - initial release

license

Copyright (c) 2013 Kyle Robinson Young Licensed under the MIT license.

Minecraft is property of Mojang AB