Browse files

Fold the README into the html doc build

Sadly, this means turning off syntax highlighted code blocks,
until ronn has a markdown implementation that supports them.
  • Loading branch information...
1 parent 30d9838 commit ec668256b78d4960f06afafcbbe89bf720cfa296 @isaacs isaacs committed Sep 4, 2011
Showing with 55 additions and 62 deletions.
  1. +19 −1 Makefile
  2. +32 −57 README.md
  3. +2 −2 html/doc/removing-npm.html
  4. +2 −2 html/index.html
View
20 Makefile
@@ -6,7 +6,7 @@ docs = $(shell find doc -name '*.md' \
htmldocs = $(shell find doc -name '*.md' \
|sed 's|.md|.html|g' \
- |sed 's|doc/|html/doc/|g' )
+ |sed 's|doc/|html/doc/|g' ) html/doc/README.html
doc_subfolders = $(shell find doc -type d \
|sed 's|doc/|man1/|g' )
@@ -52,6 +52,22 @@ man1/%.1: doc/%.md
man1/%/: doc/%/
@[ -d $@ ] || mkdir -p $@
+
+html/doc/README.html: README.md html/dochead.html html/docfoot.html
+ @[ -x ./node_modules/.bin/ronn ] || node cli.js install ronn
+ @[ -d html/doc ] || mkdir -p html/doc
+ (cat html/dochead.html && \
+ ./node_modules/.bin/ronn -f $< && \
+ cat html/docfoot.html )\
+ | sed 's|@NAME@|$*|g' \
+ | sed 's|@DATE@|$(shell date -u +'%Y-%M-%d %H:%m:%S')|g' \
+ | perl -pi -e 's/<h1>npm(-?[^\(]*\([0-9]\)) -- (.*?)<\/h1>/<h1>npm\1<\/h1> <p>\2<\/p>/g' \
+ | perl -pi -e 's/npm-?([^\)]+)\(1\)/<a href="\1.html">npm \1<\/a>/g' \
+ | perl -pi -e 's/npm\(1\)/<a href="npm.html">npm<\/a>/g' \
+ | perl -pi -e 's/npm\(1\)/<a href="npm.html">npm<\/a>/g' \
+ | perl -pi -e 's/README/<a href="README.html">README<\/a>/g' \
+ > $@
+
# use `npm install ronn` for this to work.
html/doc/%.html: doc/%.md html/dochead.html html/docfoot.html
@[ -x ./node_modules/.bin/ronn ] || node cli.js install ronn
@@ -65,8 +81,10 @@ html/doc/%.html: doc/%.md html/dochead.html html/docfoot.html
| perl -pi -e 's/npm-?([^\)]+)\(1\)/<a href="\1.html">npm \1<\/a>/g' \
| perl -pi -e 's/npm\(1\)/<a href="npm.html">npm<\/a>/g' \
| perl -pi -e 's/npm\(1\)/<a href="npm.html">npm<\/a>/g' \
+ | perl -pi -e 's/README/<a href="README.html">README<\/a>/g' \
> $@
+
html/doc/%/: doc/%/ html/doc
@[ -d $@ ] || mkdir -p $@
View
89 README.md
@@ -1,4 +1,5 @@
-# npm
+npm(1) -- node package manager
+==============================
This is just enough info to get you up and running.
@@ -11,56 +12,42 @@ Much more info available via `npm help` once it's installed.
To install an old **and unsupported** version of npm that works on node 0.3
and prior:
-```bash
-git clone git://github.com/isaacs/npm.git ./npm
-cd npm
-git checkout origin/0.2
-make dev
-```
+ git clone git://github.com/isaacs/npm.git ./npm
+ cd npm
+ git checkout origin/0.2
+ make dev
## Simple Install
To install npm with one command, do this:
-```bash
-curl http://npmjs.org/install.sh | sh
-```
+ curl http://npmjs.org/install.sh | sh
To skip the npm 0.x cleanup, do this:
-```bash
-curl http://npmjs.org/install.sh | clean=no sh
-```
+ curl http://npmjs.org/install.sh | clean=no sh
To say "yes" to the 0.x cleanup, but skip the prompt:
-```bash
-curl http://npmjs.org/install.sh | clean=yes sh
-```
+ curl http://npmjs.org/install.sh | clean=yes sh
If that fails, try this:
-```bash
-git clone https://github.com/isaacs/npm.git
-cd npm
-sudo make install
-```
+ git clone https://github.com/isaacs/npm.git
+ cd npm
+ sudo make install
If you're sitting in the code folder reading this document in your
terminal, then you've already got the code. Just do:
-```bash
-sudo make install
-```
+ sudo make install
and npm will install itself.
If you don't have make, and don't have curl or git, and ALL you have is
this code and node, you can probably do this:
-```bash
-sudo node ./cli.js install -g
-```
+ sudo node ./cli.js install -g
However, note that github tarballs **do not contain submodules**, so
those won't work. You'll have to also fetch the appropriate submodules
@@ -87,25 +74,19 @@ If you would like to ensure that npm **always** runs scripts as the
"nobody" user, and have it fail if it cannot downgrade permissions, then
set the following configuration param:
-```bash
-npm config set unsafe-perm false
-```
+ npm config set unsafe-perm false
This will prevent running in unsafe mode, even as non-root users.
## Uninstalling
So sad to see you go.
-```bash
-sudo npm uninstall npm -g
-```
+ sudo npm uninstall npm -g
Or, if that fails,
-```bash
-sudo make uninstall
-```
+ sudo make uninstall
## More Severe Uninstalling
@@ -119,17 +100,13 @@ remove them.
To remove cruft left behind by npm 0.x, you can use the included
`clean-old.sh` script file. You can run it conveniently like this:
-```bash
-npm explore npm -g -- sh scripts/clean-old.sh
-```
+ npm explore npm -g -- sh scripts/clean-old.sh
npm uses two configuration files, one for per-user configs, and another
for global (every-user) configs. You can view them by doing:
-```bash
-npm config get userconfig # defaults to ~/.npmrc
-npm config get globalconfig # defaults to /usr/local/etc/npmrc
-```
+ npm config get userconfig # defaults to ~/.npmrc
+ npm config get globalconfig # defaults to /usr/local/etc/npmrc
Uninstalling npm does not remove configuration files by default. You
must remove them yourself manually if you want them gone. Note that
@@ -141,17 +118,15 @@ you have chosen.
If you would like to use npm programmatically, you can do that.
It's not very well documented, but it *is* rather simple.
-```javascript
-var npm = require("npm")
-npm.load(myConfigObject, function (er) {
- if (er) return handlError(er)
- npm.commands.install(["some", "args"], function (er, data) {
- if (er) return commandFailed(er)
- // command succeeded, and data might have some info
- })
- npm.on("log", function (message) { .... })
-})
-```
+ var npm = require("npm")
+ npm.load(myConfigObject, function (er) {
+ if (er) return handlError(er)
+ npm.commands.install(["some", "args"], function (er, data) {
+ if (er) return commandFailed(er)
+ // command succeeded, and data might have some info
+ })
+ npm.on("log", function (message) { .... })
+ })
The `load` function takes an object hash of the command-line configs.
The various `npm.commands.<cmd>` functions take an **array** of
@@ -169,15 +144,15 @@ help config` to learn about all the options you can set there.
## More Docs
-Check out the [docs](http://github.com/isaacs/npm/blob/master/doc/),
+Check out the [docs](http://npmjs.org/doc/),
especially the
-[faq](http://github.com/isaacs/npm/blob/master/doc/faq.md#readme).
+[faq](http://npmjs.org/doc/faq.html).
You can use the `npm help` command to read any of them.
If you're a developer, and you want to use npm to publish your program,
you should
-[read this](http://github.com/isaacs/npm/blob/master/doc/developers.md#readme)
+[read this](http://npmjs.org/doc/developers.html)
## Legal Stuff
View
4 html/doc/removing-npm.html
@@ -376,7 +376,7 @@ <h2 id="More-Severe-Uninstalling">More Severe Uninstalling</h2>
<pre><code>find /usr/local/{lib/node,bin} -exec grep -l npm \{\} \; ;</code></pre>
-<p>(This is also in the README file.)</p>
+<p>(This is also in the <a href="README.html">README</a> file.)</p>
</div>
<script>
els = Array.prototype.slice.call((wrapper = document.getElementById("wrapper"))
@@ -406,4 +406,4 @@ <h2 id="More-Severe-Uninstalling">More Severe Uninstalling</h2>
</script>
</body></html>
-<!-- npm help removing-npm - 2011-35-04 08:09:30 -->
+<!-- npm help removing-npm - 2011-45-04 08:09:05 -->
View
4 html/index.html
@@ -67,14 +67,14 @@
<ol>
<li><a href="https://github.com/isaacs/npm">Get the code.</a>
- <li>Do what <a href="https://github.com/isaacs/npm#readme">the README</a>
+ <li>Do what <a href="http://npmjs.org/doc/README.html">the README</a>
says to do.
</ol>
<h2>Other Cool Stuff</h2>
<ul>
- <li><a href="https://github.com/isaacs/npm#readme">README</a>
+ <li><a href="http://npmjs.org/doc/README.html">README</a>
<li><a href="doc/">Help Documentation</a>
<li><a href="doc/faq.html">FAQ</a>
<li><a href="http://search.npmjs.org/">Search for Packages</a>

0 comments on commit ec66825

Please sign in to comment.