Welcome to mirror list, hosted at ThFree Co, Russian Federation.

index-build.js « scripts - github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 412711a460e5a6cc89f1062b7ee4ee0f6d92e069 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env node
var fs = require("fs")
  , path = require("path")
  , docdir = path.resolve(__dirname, "..", "doc")

console.log(
  "npm-index(1) -- Index of all npm documentation\n" +
  "==============================================\n")
fs.readdir(docdir, function (er, docs) {
  if (er) throw er
  ;["../README.md"].concat(docs.filter(function (d) {
    return d !== "index.md"
         && d.charAt(0) !== "."
         && d.match(/\.md$/)
  })).forEach(function (d) {
    var doc = path.resolve(docdir, d)
      , s = fs.lstatSync(doc)
      , content = fs.readFileSync(doc, "utf8").split("\n")[0].split("--")[1]

    if (s.isSymbolicLink()) return

    console.log(d.replace(/^.*?([^\/]*)\.md$/, "## npm-$1(1)") + "\n")
    console.log(content + "\n")
  })
})