Skip to content
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

Doesn't work for me :( #4

Open
svallory opened this issue Nov 11, 2013 · 2 comments
Open

Doesn't work for me :( #4

svallory opened this issue Nov 11, 2013 · 2 comments

Comments

@svallory
Copy link

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)
@svallory
Copy link
Author

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

@svallory
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant