Socket
Socket
Sign inDemoInstall

app.json

Package Overview
Dependencies
87
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    app.json

Create, validate, and render Heroku app.json manifests


Version published
Maintainers
1
Created

Readme

Source

app.json Build Status

app.json is a manifest format for describing web apps. It's a file in the root directory of an app that describes the app's 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 CLI for creating manifests and producing schema documentation.

Installation and Usage

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.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, install it globally using npm:

npm install app.json --global

Now you can run app.json (or simply app) from any directory:

$ app.json

  Usage: app.json [options] [command]

  Commands:

    init                   Create an app.json for the current directory's app
    validate               Validate the app.json file in the current directory
    schema [options]       Write the app.json schema to STDOUT
    concoct <repo>         Deploy an app from GitHub using a shorthand URL.

  Options:

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

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

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. 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 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()

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.

Contributing

See CONTRIBUTING.md

License

MIT

Keywords

FAQs

Last updated on 05 May 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc