diff options
author | isaacs <i@izs.me> | 2011-09-08 22:57:19 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2011-09-08 22:57:19 +0400 |
commit | a79d8804f1a205cdaf73bb84f7b06a0112c73085 (patch) | |
tree | 5b88d7b7a56a3ad0526a6a9113cdcf221ea58fdc /html | |
parent | b67d8774b27bf4d0a3482220e13cafc8513650ff (diff) |
Remove all reference to activate/deactivate from docs and comments
Diffstat (limited to 'html')
-rw-r--r-- | html/doc/json.html | 29 | ||||
-rw-r--r-- | html/doc/scripts.html | 5 |
2 files changed, 14 insertions, 20 deletions
diff --git a/html/doc/json.html b/html/doc/json.html index 610779357..7e7e27ade 100644 --- a/html/doc/json.html +++ b/html/doc/json.html @@ -136,34 +136,29 @@ install into the PATH. npm makes this pretty easy (in fact, it uses this feature to install the "npm" executable.)</p> <p>To use this, supply a <code>bin</code> field in your package.json which is a map of -command name to local file name. On install, npm will link that file into -place right next to wherever node is installed. (Presumably, this is in your -PATH, and defaults to <code>/usr/local/bin</code>.) On activation, the versioned file -will get linked to the main filename (just like how the main.js stuff works, -but with an executable in the PATH.)</p> +command name to local file name. On install, npm will symlink that file into +<code>prefix/bin</code> for global installs, or <code>./node_modules/.bin/</code> for local +installs.</p> <p>For example, npm has this:</p> <pre><code>{ "bin" : { "npm" : "./cli.js" } }</code></pre> <p>So, when you install npm, it'll create a symlink from the <code>cli.js</code> script to -<code>/usr/local/bin/npm-version</code>. Then, when you activate that version, it'll -create a symlink from <code>/usr/local/bin/npm-version</code> to <code>/usr/local/bin/npm</code>.</p> +<code>/usr/local/bin/npm</code>.</p> -<p>Notice that if the executable file is interpreted by node (i.e., specifying -node in the shebang line), npm actually installs a shim instead of symlinking -it, which causes expressions <code>require.main === module</code> and <code>module.id === "."</code> -evaluate to <code>false</code> within the file. This seems unable to be resolved until -node provides a "flexible <code>require()</code>".</p> +<p>If you have a single executable, and its name should be the name +of the package, then you can just supply it as a string. For example:</p> -<p>Shortcut: If you have a single executable, and its name is already what you -want it to be, then you can just supply it as a string. For example:</p> - -<pre><code>{ "bin" : "./path/to/program" }</code></pre> +<pre><code>{ "name": "my-program" +, "version": "1.2.5" +, "bin": "./path/to/program" }</code></pre> <p>would be the same as this:</p> -<pre><code>{ "bin" : { "program" : "./path/to/program" } }</code></pre> +<pre><code>{ "name": "my-program" +, "version": "1.2.5" +, "bin" : { "my-program" : "./path/to/program" } }</code></pre> <h2 id="man">man</h2> diff --git a/html/doc/scripts.html b/html/doc/scripts.html index 0aa8b87e0..6c9df44c9 100644 --- a/html/doc/scripts.html +++ b/html/doc/scripts.html @@ -103,13 +103,12 @@ in the script:</p> <pre><code>{ "scripts" : { "install" : "scripts/install.js" , "postinstall" : "scripts/install.js" - , "activate" : "scripts/install.js" , "uninstall" : "scripts/uninstall.js" } }</code></pre> <p>then the <code>scripts/install.js</code> will be called for the install, post-install, -and activate stages of the lifecycle, and the <code>scripts/uninstall.js</code> would be +stages of the lifecycle, and the <code>scripts/uninstall.js</code> would be called when the package is uninstalled. Since <code>scripts/install.js</code> is running for three different phases, it would be wise in this case to look at the <code>npm_lifecycle_event</code> environment variable.</p> @@ -148,7 +147,7 @@ they are in a separate child process, with the env described above.</p> <h2 id="BEST-PRACTICES">BEST PRACTICES</h2> <ul><li>Don't exit with a non-zero error code unless you <em>really</em> mean it. -Except for uninstall/deactivate scripts, this will cause the npm action +Except for uninstall scripts, this will cause the npm action to fail, and potentially be rolled back. If the failure is minor or only will prevent some optional features, then it's better to just print a warning and exit successfully.</li><li>Try not to use scripts to do what npm can do for you. Read through |