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

apps

v0.8.3

Published

Create, validate, and render Heroku app.json manifests

Downloads

3,105

Readme

apps

apps is a node module for creating and validating Heroku app.json files. It works in node.js and the browser, and also has a CLI.

Schema

The app.json schema is defined using the JSON Schema specification and is validated with the awesome revalidator node module.

See the schema at schema.js.

Installation and Usage

Programmatic usage with Node.js or Browserify

Download the module from npm and save it to your package.json:

npm install apps --save

Require it in your script:

var App = require("apps")

Usage in the Browser (without Browserify)

If browserify isn't your thing, use the pre-compiled browser-ready bundle in dist/app.js. Include this file in your html page and it will create window.App for you.

Usage on the Command Line

To use this module on the command line, you'll need to install it globally using npm:

npm install apps --global

Now you can run app or apps from any directory:

$ app

  Usage: app [options] [command]

  Commands:

    schema [options]       Write the app.json schema to STDOUT

  Options:

    -h, --help     output usage information
    -V, --version  output the version number

  Use 'app <command> --help' to get more information about a specific command.

Class Methods

App.new(payload)

Instantiate with a JSON filename:

var app = App.new(__dirname + "/path/to/app.json")

Instantiate with a JSON string:

var json = "{name: \"small-sharp-tool\", description: \"This app does one little thing, and does it well.\"}"
var app = App.new(json)

Instantiate with a JavaScript object:

var app = App.new({
  name: "small-sharp-tool",
  description: "This app does one little thing, and does it well."
})

App.fetch(url, callback)

You can fetch app manifests straight from GitHub. The github-raw-cors-proxy service is used to make the app.json file downloadable from browsers.

url can be a fully qualified GitHub URL, or a shorthand user/repo string:

App.fetch('zeke/harp-slideshow-template', function(err, manifest) {
  console.log(err, manifest)
})

App.example

Generates an example manifest from example content in the schema.

App.example

Instance Methods

app.valid

A getter method that validates the app manifest and returns true or false

app.errors

Returns null if app manifest is valid.

Returns an array of error objects if invalid:

[
  {property: "name", message: "is required"},
  {property: "website", message: "is not a valid url"}
]

app.toJSON()

Return a pretty JSON string representation of the manifest, without any superfluous properties.

app.getAddonPrices(callback)

Fetch pricing data about the app's required addons by hitting the Heroku Platform API.

Tests

npm install
npm test

Bundle

To prepare a browser-ready bundle, run the following:

npm run build

# Wrote dist/app.js
# Wrote dist/app.min.js

Docs

Genarate human-friendly docs from the schema

npm run docs

# Wrote dist/schema.md
# Wrote dist/schema.html

License

MIT