Git Product home page Git Product logo

app.json's Introduction

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

app.json's People

Contributors

appleton avatar javiercejudo avatar ojacobson avatar ryanbrainard avatar zeke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

app.json's Issues

app.json validate reports an error about a valid formation key

Using this app.json, app.json validate reports an error:

$ app.json validate

Found an app.json file, but it's got some issues:

- formation must be of array type

The relevant formation is:

    "formation": {
        "web": {
            "quantity": 1,
          " size": "Free"
        },
        "worker": {
            "quantity": 1,
            "size": "Free"
        }
    }

Despite the error, this appears to be correct -- that is, using the Heroku Button on that repo correctly deploys an app with web and worker dynos correctly set to 1 free each.

Local validation passes but Dashboard validation fails

My app.json file

{
  "name": "DHH Soundboard",
  "description": "Tribute soundboard of the great 'How to Build a Blog Engine in 15 Minutes with Ruby on Rails' which inspired myself and many others to get into Rails.",
  "repository": "https://github.com/hone/dhh-soundboard",
  "logo": "https://raw.githubusercontent.com/jc00ke/dhh-soundboard/master/public/images/dhh.jpeg",
  "keywords": ["DHH", "rails", "soundboard", "lulz"]
}
$> app validate

Your app.json file is valid!

When I clicked the Heroku Button I got an error in the Dashboard:

No valid app.json file found at: https://github.com/jc00ke/dhh-soundboard
- description is too long (maximum is 140 characters)

Feature: allow for (health)check specification

Currently the spec doesn't support any type of procfile definitions nor does it have support for healthcheck specifications. I'd like to address the latter.

Being able to configure the healthcheck itself via a declaration makes this a powerfull tool to centralize and keep all information regarding the app in a single (versioned) place. The spec i'd like to propose looks a lot like the spec from Consul but is more heroku/dokku centric.

In fact i've already proposed this to the dokku team and they pointed my (rightly so) to this repo. As Dokku is very much Heroku-like i would expect other Heroku users to benefit from this addition as well. It would really increase the interoperability between the two platforms (and might even increase adoption of the app.json specification even further to other PaaS like platforms)

I'd be really interested in what you think about this (or do you already have such plans in the works?)

app.json validate requires heroku toolbelt

Got reports of mysterious errors that stopped happening when users installed the heroku toolbelt.

We want to make sure this is heroku-newbie-friendly so it'd be a good idea to either check and fail in a friendly way, or pull in the toolbelt as a dependency.

(I haven't replicated this issue, will soon)

app.json init crashes

OSX Yosemite/Node 0.12.2/[email protected]

$ app.json init
/opt/local/lib/node_modules/app.json/lib/heroku.js:153
        return config[key].url.match(/git@heroku\.com:(.*)\.git/)[1]
                                                                 ^
TypeError: Cannot read property '1' of null
    at /opt/local/lib/node_modules/app.json/lib/heroku.js:153:66
    at Array.map (native)
    at EventEmitter.module.exports.Heroku.deriveAppNamesFromLocalGitConfig (/opt/local/lib/node_modules/app.json/lib/heroku.js:152:8)
    at Command.<anonymous> (/opt/local/lib/node_modules/app.json/bin/cli:60:14)
    at Command.listener (/opt/local/lib/node_modules/app.json/node_modules/commander/index.js:301:8)
    at Command.emit (events.js:110:17)
    at Command.parseArgs (/opt/local/lib/node_modules/app.json/node_modules/commander/index.js:610:12)
    at Command.parse (/opt/local/lib/node_modules/app.json/node_modules/commander/index.js:458:21)
    at Object.<anonymous> (/opt/local/lib/node_modules/app.json/bin/cli:234:9)
    at Module._compile (module.js:460:26)

npm run docs does not work

...but running just bin/docs does. Seems like something wrong with the npm run or how its configured with scripts in package.json.

`app.json update` not working

Summary

$ app.json update command not working.
my git remote url is here

heroku  https://git.heroku.com/notion-nippo.git (fetch)
heroku  https://git.heroku.com/notion-nippo.git (push)

Does anyone else have the same symptoms?

Support in addition to

Usage: init [options]

Options:

-h, --help                   output usage information
-a, --app <heroku-app-name>  Heroku app name from which to derive addons and env

app.json clone fails with requested API endpoint was not found error

When I try to deploy an app to heroku from the command line it fails with a "requested API endpoint was not found error".

Does app.json work for anyone anymore or has it broken and abandoned? How do folks deploy an app via CLI?

$ yarn app.json clone github:zeke/slideshow
yarn run v1.22.17
$ /Users/mpv/dev/tinyhood/tinyhood/node_modules/.bin/app.json clone github:zeke/slideshow

Cloning from https://api.github.com/repos/zeke/slideshow/tarball/master
The requested API endpoint was not found. Are you using the right HTTP verb (i.e. `GET` vs. `POST`), and did you specify your intended version with the `Accept` header?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.