Merge pull request #310 from nfischer/fix-gen-docs

fix(gen-docs): fix issue where docs are generated wrong
This commit is contained in:
Ari Porad 2016-01-25 18:17:12 -08:00
commit f224776ff7
2 changed files with 9 additions and 3 deletions

View File

@ -21,3 +21,5 @@ os:
- osx
script:
- npm test
- node scripts/generate-docs.js
- git diff --quiet # make sure no files have changed

View File

@ -1,5 +1,5 @@
#!/usr/bin/env node
/* globals cd, echo, grep, sed */
/* globals cat, cd, echo, grep, sed */
require('../global');
echo('Appending docs to README.md');
@ -16,7 +16,11 @@ docs = docs.replace(/\/\/\@include (.+)/g, function(match, path) {
// Remove '//@'
docs = docs.replace(/\/\/\@ ?/g, '');
// Append docs to README
sed('-i', /## Command reference(.|\n)*/, '## Command reference\n\n' + docs, 'README.md');
// Wipe out the old docs
cat('README.md').replace(/## Command reference(.|\n)*/, '## Command reference').to('README.md');
// Append new docs to README
sed('-i', /## Command reference/, '## Command reference\n\n' + docs, 'README.md');
echo('All done.');