Skip to content

Commit

Permalink
automatically update cli doc on every version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed May 22, 2019
1 parent fc312d1 commit fdd4723
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -452,4 +452,5 @@ Config Files:
Run 'tap --dump-config' for a listing of what can be set in that file. Each of
the keys corresponds to one of the options above.
```
7 changes: 7 additions & 0 deletions docs/cli/index.template.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env node
const fs = require('fs')
const template = fs.readFileSync(__dirname + '/index.template.md', 'utf8')
const {spawnSync} = require('child_process')
const bin = require.resolve('../../bin/run.js')
const usage = spawnSync(process.execPath, [bin, '-h']).output.join('')
fs.writeFileSync(__dirname + '/index.md', template.replace(/\$\{USAGE\}/, usage))
12 changes: 12 additions & 0 deletions docs/cli/index.template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
layout: layout
title: CLI
---

# CLI

You can get help on tap's command line interface by running `tap -h`.

```
${USAGE}
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"posttest": "rm -rf cli-tests-*",
"postunit": "npm run posttest",
"t": "node bin/run.js test -J -sfails.txt",
"preversion": "npm test",
"preversion": "npm test && node docs/cli/index.template.js",
"postversion": "npm publish",
"postpublish": "git push origin --follow-tags"
},
Expand Down

0 comments on commit fdd4723

Please sign in to comment.