-
Notifications
You must be signed in to change notification settings - Fork 434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate README Doc #200
Comments
This npm module ( Example: var esprima = require('esprima');
var program = `
const answer = 42
console.log('hi');
commander
.command('create [scriptTitle] [scriptParentId]')
.description('Create a script')
.action(create);
/**
* Fetches a project and saves the script id locally.
*/
commander
.command('clone [scriptId] [versionNumber]')
.description('Clone a project')
.action(clone);
`;
var p = esprima.parse(program);
console.log(JSON.stringify(p, null, 2)); But it does not parse comments. |
The problem is most tools assume |
OK, so I think we can generate a README if we just parse the ts comments in one file. https://github.com/jonschlinkert/parse-comments Example: const str = `
/**
* Read in source files from file paths or glob patterns.
*
* js
* verb.src('src/*.hbs', {layout: 'default'});
*
*
* **Example usage**
*
* js
* verb.task('site', function() {
* verb.src('src/*.hbs', {layout: 'default'})
* verb.dest('dist');
* });
*
*
* @param {String|Array} \`glob\` Glob patterns or file paths to source files.
* @param {Object} \`options\` Options or locals to merge into the context and/or pass to \`src\` plugins
* @api public
*/
function foo() {
}
/**
* Bat bat
*/
`;
var comments = require('parse-comments');
var s = comments(str);
console.log(s); |
Expected Behavior
The README methods should be generated from the TypeScript file.
Actual Behavior
The README is slightly out of date, duplicates jsdoc comments, and must be hand edited.
Solution
generateDocs.ts
.tsc generateDocs.ts && node generateDocs.js
should build the README without modifications needed.The text was updated successfully, but these errors were encountered: