Skip to content

Instantly share code, notes, and snippets.

@rowanmanning
Created December 18, 2011 15:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rowanmanning/1493665 to your computer and use it in GitHub Desktop.
Save rowanmanning/1493665 to your computer and use it in GitHub Desktop.
Familiarising myself with npm's package.json specification
{
//-----------------------------------------------------------
// Important information
// Name and version are required and together are treated as
// a unique identifier for a particular build. Name
// [http://npmjs.org/doc/json.html#name] and version
// [http://npmjs.org/doc/json.html#version] are strings.
"name": "mypackage",
"version": "0.1",
// Meta information for the package. Description is a string,
// keywords should be an array of strings.
"description": "This is my package.",
"keywords": [ "my", "package" ],
//-----------------------------------------------------------
// People
// The principal or initial author of the package. The email
// and URL are both optional.
"author": {
"name": "My Name",
"email": "me@myname.com",
"url": "http://myname.com/"
},
// An array of contributors to the package.
"contributors": [
{
"name": "Other Name",
"email": "me@othername.com",
"url": "http://othername.com/"
},
{
"name": "Yet Another Name",
"email": "me@yetanothername.com",
"url": "http://yetanothername.com/"
}
],
//-----------------------------------------------------------
// URLs and Resources
// The project home page.
"homepage": "http://mypackage.com/",
// The URL to the package issue tracker and/or email address
// for bug reports. This can be a string (URL) or an object
// with `url` and `email` fields.
"bugs": "http://github.com/myname/mypackage/issues",
// or
"bugs": {
"url": "http://github.com/myname/mypackage/issues",
"email": "bugreport@mypackage.com"
},
// The repository where the code for this package lives.
"repository": {
"type": "git",
"url" : "https://github.com/myname/mypackage.git"
},
//-----------------------------------------------------------
// Scripts
// The main entry-point for your program - used in node's
// `require`. This should be a module.
"main": "./lib/mypackage.js",
// Executables for the package. These will be symlinked into
// a directory onto the system path.
"bin": {
"mypackage": "./bin/mypackage.js"
},
// Manual files for the package.
"man": [
"./man/doc.1"
],
// Indicate the structure of the package.
"directories": {
"bin": "./bin",
"lib": "./lib",
"man": "./man"
},
// Package scripts. See http://npmjs.org/doc/scripts.html
// for info on all of the package scripts available.
"scripts": {
// If the package provides a server, these are the
// scripts used to start, stop and restart the server.
// used to start it.
"start": "node server.js",
"stop": "",
"restart": "",
// Test the package.
"test": "myunittester ./test/*"
},
// Package dependencies. See
// http://npmjs.org/doc/json.html#dependencies for details
// on how to specify dependency versions.
"dependencies": {
"myusefullibrary": ">=1.0",
"myotherpackage": "2.3"
},
// Package development dependencies. This should be used to
// indicate packages which are required for things like
// testing or documentation generation.
"devDependencies": {
"myunittester": "1.2.3"
},
// The versions of Node and npm that the package depends on.
"engines": {
"node" : ">=0.1.2"
},
// The package is primarily used globally - if this is true
// then the user will be warned while installing locally.
"preferGlobal": true,
// The package should never be published to npm.
"private": true
//-----------------------------------------------------------
}
@arlopezg
Copy link

So how'd it go? Did you ever get familiar with package.jsons? 😆

(this gist showed up on an unrelated google search)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment