futurGH / ts-to-jsdoc

Transpile TypeScript code to fully compatible JavaScript + JSDoc comments.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

the whole library is broken

Kokujou opened this issue · comments

when trying to run the command i get dozens of javascript errors, most of them telling that the property?. notation is invalid, so i'm spending all my time now to fix those javascript errors.

commented

Yeah, this was very much an untested personal project I decided to open source; there's no doubt that it's broken in a number of ways. If you can share an example where I can reproduce any issue you're facing with this project, though, I would be happy to try and help out.

i would love to but i would like to know how this ever was to work... i mean i did nothing extra-ordinary. it fails even at the stage of recognizing the command line options.

you know i literally just downloaded the npm package as global, and ran it in the command line. no matter if i run it without any options, or with --output --out or -o option, it just crashes, telling me the exact line where the error is

commented
C:\Users\Kokujou\AppData\Roaming\npm\node_modules\ts-to-jsdoc\bin\ts-to-jsdoc:30
if (args.help || Object.keys(args).every((arg) => !args[arg]?.length)) {
                                                             ^

SyntaxError: Unexpected token .
    at new Script (vm.js:84:7)
    at createScript (vm.js:264:10)
    at Object.runInThisContext (vm.js:312:10)
    at Module._compile (internal/modules/cjs/loader.js:694:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:745:10)
    at Module.load (internal/modules/cjs/loader.js:626:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:566:12)
    at Function.Module._load (internal/modules/cjs/loader.js:558:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:797:12)
    at executeUserCode (internal/bootstrap/node.js:526:15)
commented

Ah, sorry about that! I had originally only planned for this to be used as an import in other code, so I thought that the engines field in package.json would be enough to ensure Node version compatibility. I've published v1.1.1 which should hopefully fix that; let me know if it works for you or if you encounter any other issues!

okay... now with the new version i can't even run the command anymore... i think there is some backslash issue
it tries to find C:\Users\Kokujou\AppData\Roaming\npm\\node_modules\ts-to-jsdoc\bin\ts-to-jsdoc
emphasis on the \ after npm

btw. can you run the cli command yourself?

commented

There's not much ts-to-jsdoc can do there, unfortunately, as it's more likely an issue with your Node.js/NPM configuration or something going wrong on NPM's end when installing the package. You can try reinstalling it, installing it as a project dependency, or using it via npx as a CLI, but I can't really help you out beyond that.

that's what i also thought first so i checked it and tried runnning both the global and the local version...
but the strange thing is: it worked before. so something must've changed...

i will try checking your repo out and see if i can find some points in code

i found the issue... or at least the very must basic issue... because i have no idea what part in your code caused it.
when installing a module in your npm path (app data roaming) there is a *.cmd file generated. and for some reason it changed from

@IF EXIST "%~dp0\node.exe" (
  "%~dp0\node.exe"  "%~dp0\node_modules\ts-to-jsdoc\bin\ts-to-jsdoc" %*
) ELSE (
  @SETLOCAL
  @SET PATHEXT=%PATHEXT:;.JS;=;%
  node  "%~dp0\node_modules\ts-to-jsdoc\bin\ts-to-jsdoc" %*
)

to

@"%~dp0\node_modules\ts-to-jsdoc\bin\ts-to-jsdoc" %*

which is bad. i could hack around it now but i think you as the project owner should investigate why this change was made.