3
0
Fork 0
mirror of https://gitea.com/actions/setup-node.git synced 2024-11-25 03:29:33 +01:00
setup-node/node_modules/shelljs/scripts/generate-docs.js

22 lines
514 B
JavaScript
Raw Normal View History

2019-08-04 03:49:54 +02:00
#!/usr/bin/env node
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, '');
// Append docs to README
sed('-i', /## Command reference(.|\n)*/, '## Command reference\n\n' + docs, 'README.md');
echo('All done.');