Created
December 18, 2011 15:11
-
-
Save rowanmanning/1493665 to your computer and use it in GitHub Desktop.
Familiarising myself with npm's package.json specification
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
//----------------------------------------------------------- | |
// 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": "[email protected]", | |
"url": "http://myname.com/" | |
}, | |
// An array of contributors to the package. | |
"contributors": [ | |
{ | |
"name": "Other Name", | |
"email": "[email protected]", | |
"url": "http://othername.com/" | |
}, | |
{ | |
"name": "Yet Another Name", | |
"email": "[email protected]", | |
"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": "[email protected]" | |
}, | |
// 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 | |
//----------------------------------------------------------- | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So how'd it go? Did you ever get familiar with package.jsons? 😆
(this gist showed up on an unrelated google search)