onury / docma

A powerful tool to easily generate beautiful HTML documentation from JavaScript (JSDoc), Markdown and HTML files.
https://onury.io/docma
MIT License
334 stars 34 forks source link

forcing `:js` on TypeScript files is not working. Is it supported? #81

Closed trusktr closed 5 years ago

trusktr commented 5 years ago

I tried configuring docma.json with

{
    "src": "./src/**/*.ts",
    "dest": "./docma"
}

and it results in many messages like

 » Unsupported source ignored: /Users/trusktr/src/trusktr+infamous/src/code/Scene.ts

I tried to force it to use :js on the TS files:

{
    "src": "./src/**/*.ts:js",
    "dest": "./docma"
}

and it said

... omitted ...

 » JSDoc parser will be forced on: "/Users/trusktr/src/trusktr+infamous/src/types/globals.d.ts"
 » JSDoc parser will be forced on: "/Users/trusktr/src/trusktr+infamous/src/utils/getGlobal.ts"
 » JSDoc parser will be forced on: "/Users/trusktr/src/trusktr+infamous/src/utils/three.ts"
Parsing 76 Javascript file(s)...
Error: Output: There are no input files to process.

    at Promise.resolve.then.then.then.json (/Users/trusktr/src/trusktr+infamous/node_modules/jsdoc-x/src/index.js:341:30)
    at tryCatcher (/Users/trusktr/src/trusktr+infamous/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/trusktr/src/trusktr+infamous/node_modules/bluebird/js/release/promise.js:517:31)
    at Promise._settlePromise (/Users/trusktr/src/trusktr+infamous/node_modules/bluebird/js/release/promise.js:574:18)
    at Promise._settlePromise0 (/Users/trusktr/src/trusktr+infamous/node_modules/bluebird/js/release/promise.js:619:10)
    at Promise._settlePromises (/Users/trusktr/src/trusktr+infamous/node_modules/bluebird/js/release/promise.js:699:18)
    at _drainQueueStep (/Users/trusktr/src/trusktr+infamous/node_modules/bluebird/js/release/async.js:138:12)
    at _drainQueue (/Users/trusktr/src/trusktr+infamous/node_modules/bluebird/js/release/async.js:131:9)
    at Async._drainQueues (/Users/trusktr/src/trusktr+infamous/node_modules/bluebird/js/release/async.js:147:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/Users/trusktr/src/trusktr+infamous/node_modules/bluebird/js/release/async.js:17:14)
    at processImmediate (internal/timers.js:443:21)

Is that supposed to work?

onury commented 5 years ago

.ts files are not supported by JSDoc core. So Docma cannot generate docs out of them. I also write TypeScript mostly and generate docs from the transpiled .js files.

If that's not working for you maybe check if there are any jsdoc plugins for .ts files and use it within your docma.json under jsdoc config.

trusktr commented 5 years ago

Oh I see. So you mean, the jsdoc parser can not parse jsdoc comments when they are among TypeScript code? It won't simply ignore the code and parse only the comments (which are plain regular jsdoc comments)?

Good idea to parse the output file docs! Thanks!

Might be cool to document this. Maybe in the future an extension for Docma could compile TS to JS, then generate from there.

trusktr commented 5 years ago

Running it on the JS build output works great. Thanks!!!