Chris J. Lee

Dallas Drupal Developer

You are here

What goes in a package.json file?

I wanted to know what properties a package.json file accepts.

Here's a good example of an extended package.json file:

{
  "name": "Foo bar project",
  "preferGlobal": true,
  "version": "0.1.0",
  "author": "Chris Lee <iam@chrisjlee.net>",
  "description": "Foo project. My awesome description",
  "contributors": [
    {
      "name": "Contributor example",
      "email": "contributor@chrisjlee.net"
    }
  ],
  "bin": {
    "http-server": "./bin/http-server"
  },
  "scripts": {
    "start": "node ./bin/http-server",
    "test": "vows --spec --isolate",
    "predeploy": "echo Before running this message will appear",
    "postdeploy": "echo This is the post deploy message"
  },
  "main": "./lib/http-server",
  "repository": {
    "type": "git",
    "url": "https://github.com/chrisjlee/example.git"
  },
  "keywords": [
    "cli",
    "http",
    "server"
  ],
  "dependencies" : {
    "colors"   :  "*",
    "flatiron" :  "0.1.x",
    "optimist" :  "0.2.x",
    "union"    :  "0.1.x",
    "ecstatic" :  "0.1.x",
    "plates"   :  "https://github.com/chrisjlee/foo-dependencies/tarball/master"
  },
  "analyze": false,
  "devDependencies": {
    "vows"    :  "0.5.x",
    "request" :  "2.1.x"
  },
  "bundledDependencies": [
    "union",
    "ecstatic"
  ], 
  "license": "MIT",
  "engines": {
    "node": ">=0.6"
  }
}

Source: http://package.json.nodejitsu.com/

Tags: 
node
© 2017 Chris J. Lee