mirror of
https://github.com/shelljs/shelljs.git
synced 2026-01-18 16:03:37 +00:00
This fixes an issue where the gen-docs script's sed() command would improperly update the docs. Travis now checks that docs are generated properly.
27 lines
674 B
JavaScript
Executable File
27 lines
674 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
/* globals cat, cd, echo, grep, sed */
|
|
require('../global');
|
|
|
|
echo('Appending docs to README.md');
|
|
|
|
cd(__dirname + '/..');
|
|
|
|
// Extract docs from shell.js
|
|
var docs = grep('//@', 'shell.js');
|
|
|
|
docs = docs.replace(/\/\/\@include (.+)/g, function(match, path) {
|
|
var file = path.match('.js$') ? path : path+'.js';
|
|
return grep('//@', file);
|
|
});
|
|
|
|
// Remove '//@'
|
|
docs = docs.replace(/\/\/\@ ?/g, '');
|
|
|
|
// 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.');
|