diff options
author | isaacs <i@izs.me> | 2011-03-24 03:31:04 +0300 |
---|---|---|
committer | isaacs <i@izs.me> | 2011-03-24 03:31:04 +0300 |
commit | ee66ba9082bb7425bef44973a2306ca1d6c5df64 (patch) | |
tree | b8ec9e43c0021b48c4db97a8d38e786f7d7a1889 /man1 | |
parent | ae9a5b093518ded073d75f182c4629deca1e0607 (diff) |
Better developers doc for 1.0
Diffstat (limited to 'man1')
-rw-r--r-- | man1/developers.1 | 65 |
1 files changed, 18 insertions, 47 deletions
diff --git a/man1/developers.1 b/man1/developers.1 index c9ee1dbf7..620ff82e6 100644 --- a/man1/developers.1 +++ b/man1/developers.1 @@ -94,7 +94,9 @@ Take some credit\. .IP "\(bu" 4 scripts: If you have a special compilation or installation script, then you -should put it in the \fBscripts\fR hash\. See npm\-scripts(1)\. +should put it in the \fBscripts\fR hash\. You should definitely have at +least a basic smoke\-test command as the "scripts\.test" field\. +See npm\-scripts(1)\. . .IP "\(bu" 4 main: @@ -115,33 +117,17 @@ You can use \fBnpm init\fR in the root of your package in order to get you started with a pretty basic package\.json file\. See \fBnpm\-init(1)\fR for more info\. . -.SH "Bundling Dependencies" -If you depend on something that is not published (but has a package\.json -file) then you can \fBbundle\fR that dependency into your package\. -. -.IP "\(bu" 4 -Add the \fB"name":"version"\fR to your dependency hash, as if it was a -published package\. -. -.IP "\(bu" 4 -Do \fBnpm bundle install <pkg>\fR where \fB<pkg>\fR is the path/tarball/url to -the unpublished package\. -. -.IP "" 0 -. -.P -To bundle dependencies that ARE published (perhaps, if you will not have -access to the registry when it is installed, or if you would like to -make some modifications to them), you can use \fBnpm bundle\fR (with no -other arguments) to bundle\-install all your dependencies\. -. -.P -More info at \fBnpm\-bundle(1)\fR\|\. +.SH "Keeping files *out* of your package" +Use a \fB\|\.npmignore\fR file to keep stuff out of your package\. If there\'s +no \.npmignore file, but there \fIis\fR a \.gitignore file, then npm will +ignore the stuff matched by the \.gitignore file\. If you \fIwant\fR to +include something that is excluded by your \.gitignore file, you can +create an empty \.npmignore file to override it\. . .SH "Link Packages" \fBnpm link\fR is designed to install a development package and see the changes in real time without having to keep re\-installing it\. (You do -need to either re\-link or \fBnpm rebuild\fR to update compiled packages, +need to either re\-link or \fBnpm rebuild \-g\fR to update compiled packages, of course\.) . .P @@ -162,7 +148,7 @@ In the root of your package, do this: .IP "" 4 . .nf -npm install +npm install \. \-g . .fi . @@ -182,42 +168,27 @@ npm link .IP "" 0 . .P -Use \fBnpm ls installed\fR to see if it\'s there\. +Use \fBnpm ls \-g\fR to see if it\'s there\. . .P -Then go into the node\-repl, and try using require() to bring in your module\'s -main and libs things\. Assuming that you have a package like this: +To test a local install, go into some other folder, and then do: . .IP "" 4 . .nf -node_foo/ - lib/ - foo\.js - bar\.js +cd \.\./some\-other\-folder +npm install \.\./my\-package . .fi . .IP "" 0 . .P -and you define your package\.json with this in it: -. -.IP "" 4 -. -.nf -{ "name" : "foo" -, "directories" : { "lib" : "\./lib" } -, "main" : "\./lib/foo" -} -. -.fi -. -.IP "" 0 +to install it locally into the node_modules folder in that other place\. . .P -then you\'d want to make sure that require("foo") and require("foo/bar") both -work and bring in the appropriate modules\. +Then go into the node\-repl, and try using require("my\-thing") to +bring in your module\'s main module\. . .SH "Create a User Account" Create a user with the adduser command\. It works like this: |