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

app.json

v1.3.0

Published

Create, validate, and render Heroku app.json manifests

Downloads

268

Readme

app.json Build Status

app.json is a manifest format for describing web apps. It's a file in the root directory of your app that describes build requirements, environment variables, addons, and other information.

This repository contains the source for an npm module called app.json, which has many facets:

  • A JavaScript interface for creating, validating, and producing app.json manifests.
  • A module that is designed to work in browsers and Node.js.
  • A command-line interface (CLI) for cloning apps, creating manifests, and producing schema documentation.

For more info about app.json, see

Command Line Usage

To use the command line tool, install it globally using npm:

npm install app.json --global

Now you can run app.json (or simply app) on the command line.

Cloning apps

You can use the CLI to create new Heroku apps from publicly-accessible .tar.gz or .tgz files (colloquially known as "tarballs"), or from GitHub and Bitbucket URLs. The general form is:

app.json clone <repo> [new-app-name]
  • repo is required.
  • new-app-name is optional.

Here are some examples:

# GitHub shorthand URL
app.json clone github:zeke/slideshow

# GitHub shorthand URL with branch
app.json clone github:zeke/slideshow#master

# Bitbucket shorthand URL
app.json clone bitbucket:sikelianos/slideshow

# Bitbucket shorthand URL with branch
app.json clone bitbucket:sikelianos/slideshow#master

# GitHub full URL
app.json clone https://github.com/zeke/slideshow.git my-slideshow

# Tarball URL
app.json clone http://app.json.s3.amazonaws.com/zeke-slideshow-a95e802.tar.gz

Creating a manifest

The init command will create a new app.json file in your current working directory. If the directory already has a Heroku git remote in .git/config, the CLI will attempt to populate the env and addons properties of the new app.json file with live data from your running Heroku app.

app.json init

Validating a manifest

Use the validate command to ensure that your app.json file conforms to the schema.

app.json validate

Updating a manifest

Use the update command to fetch the latest addons and env properties from a running Heroku app.

app.json update

Programmatic usage with Node.js or Browserify

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

npm install app.json --save

Require it in your script:

var App = require("app.json")

Usage in the Browser (without Browserify)

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

You can also use Bower if that's your thing:

bower install app.json

Schema

The app.json schema is defined using the JSON Schema specification and is validated with the revalidator node module. View the raw schema or the auto-generated app.json Schema Documentation on Heroku Dev Center.

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 or Bitbucket. The app-json-fetcher service is used to make the app.json file downloadable from browsers.

url can be a fully qualified repository URL or a shorthand string in the form github:user/repo or bitbucket:user/repo

App.fetch("github:zeke/slideshow", function(err, manifest) {
  console.log(err, manifest)
})

App.example

Generates an example manifest from example properties 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 an array of error objects:

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

If the manifest is valid, an empty array is returned.

app.toJSON

Returns a pretty JSON string of the manifest, minus any undocumented properties.

app.getAddonPrices(callback)

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

Contributing

See CONTRIBUTING.md

License

MIT