TSDoc
TSDoc copied to clipboard
Doesn't work for me :(
Looks like it's trying to parse TypeScript as if it was Javascript. (since as I go about changing the file replacing the typescript syntax by js syntax, it complains about the next typescript specific token).
tsdoc.json
{
"tags":
{
"allowUnknownTags" : true
},
"plugins":[
"plugins/markdown"
,"/usr/local/lib/node_modules/tsdoc/template/plugins/TSDoc.js"
],
"opts":
{
"template" :"/usr/local/lib/node_modules/tsdoc/template",
"recurse" :"false"
},
"templates" : {
"cleverLinks" : false,
"monospaceLinks" : false
},
"source":
{
"includePattern": "docs(\\.d)?\\.ts$"
},
"markdown" : {
"parser" : "gfm",
"hardwrap" : true
},
"tsdoc":{
"source" : "/projects/theblacksmith/tsm/lib/tsm/",
"destination" : "/projects/theblacksmith/tsm/docs/",
"tutorials" : "",
"systemName" : "TSM",
"footer" : "",
"copyright" : "TSM Copyright © 2013 TheBlacksmith - Licensed under MIT License",
"outputSourceFiles" : true,
"commentsOnly": true
}
}
docs.ts
/// <reference path="../typings/colors.d.ts" />
class Docs {
// @todo improve name to url conversion
static link(page: string);
static link(name: string, page?: string) {
if(arguments.length == 1)
page = name;
return name + " >> ".green + "https://github.com/theblacksmith/tsm/wiki/" + page.replace(' ', '-');
}
}
output
TSDOC v0.0.4
TSDoc Generating doc...
TSDoc Done.
exec error: Error: Command failed:
/usr/local/lib/node_modules/jsdoc/node_modules/esprima/esprima.js:3872
throw e;
^
Error: Line 3: Unexpected reserved word
at throwError (/usr/local/lib/node_modules/jsdoc/node_modules/esprima/esprima.js:1156:21)
at throwUnexpected (/usr/local/lib/node_modules/jsdoc/node_modules/esprima/esprima.js:1204:17)
at parsePrimaryExpression (/usr/local/lib/node_modules/jsdoc/node_modules/esprima/esprima.js:1567:16)
at /usr/local/lib/node_modules/jsdoc/node_modules/esprima/esprima.js:3609:38
at trackLeftHandSideExpressionAllowCall (/usr/local/lib/node_modules/jsdoc/node_modules/esprima/esprima.js:3504:61)
at parsePostfixExpression (/usr/local/lib/node_modules/jsdoc/node_modules/esprima/esprima.js:1703:20)
at /usr/local/lib/node_modules/jsdoc/node_modules/esprima/esprima.js:3609:38
at parseUnaryExpression (/usr/local/lib/node_modules/jsdoc/node_modules/esprima/esprima.js:1784:16)
at /usr/local/lib/node_modules/jsdoc/node_modules/esprima/esprima.js:3609:38
at parseMultiplicativeExpression (/usr/local/lib/node_modules/jsdoc/node_modules/esprima/esprima.js:1790:20)
After I looked at the dependencies from your tsdoc's package.json
and discovered it asks for jsdoc >= 3.2.0, I checked my jsdoc (globally installed) version, it was 3.3.0-alpha1. I removed it and installed version 3.2.0.
It still gives me an error which indicates that it is trying to parse TS as if it was JS. But the output is quite differente and can be seen on this gist
Me again, long time no see, huh? I think I found the issue. It's here. The problem is: when using commentsOnly: true
, if there is no comment in a file, it leaves the source as is. I think, in this case, the source should be set to an empty string.