hiulit / GDScriptify

A magical documentation tool for GDScript.
MIT License
48 stars 5 forks source link

Problem with gdscriptify #3

Open AnidemDex opened 2 years ago

AnidemDex commented 2 years ago

I'm kinda new to Node.js and its modules. I've just tried to download it, install all of its dependencies. Then I installed gdscriptify through writing npm install gdscriptify -g in the command line.

Finally, went to my project folder and tried to use gdscriptify. It failed because that name was not registered in global space (but gdscriptify.cmd and gdscriptify.sp1 are).

I used gdscriptify.cmd instead, it tried to do something in background and then fails somehow? I can't understand this traceback so I don't know what I should be looking at to be more helpful debugging this: image

Also tried with other project: image

Note: What I tried to document was this repository https://github.com/AnidemDex/Godot-DialogPlugin and https://github.com/AnidemDex/Godot-EventSystem repectively

AnidemDex commented 2 years ago

Seems (according to #2 ) that the first error is because none of the files are not documented. Gonna document at least one file to see if was something that I did wrong 😅

Edit: There were some ## comments in the code for some functions, so no clue

hiulit commented 2 years ago

Thanks for the feedback! Seems like you are on Windows. I don't know much because I don't use that platform but you should only install Node.js and then install GDScriptify npm install gdscriptify -g. It's weird that you can't use gdscriptify because when you install it with -g it installs it globally, so you you should be able to use it. As for gdscriptify.cmd and gdscriptify.sp1, I don't even know what those files are. I didn't make them :P

The first error seems related to #2, yeah. The second one, I haven no idea :) But I think it might be because it's a plugin and it doesn't have a project.godot file, which GDScriptify needs in order to work properly. So, accidentally, I might have left out plugins!

AnidemDex commented 2 years ago

@hiulit Seems like the npm install creates two files to execute your module, a kind of bash file (cmd) and a script file (ps1). Being not able to call gdscriptify directly is related to <https:/go.microsoft.com/fwlink/?LinkID=135170> according to: image

The workaround is to set the execution policy to Bypass (since the script is not signed), this can be done using: Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process in a Powershell terminal with administrative privilegies. Process makes the execution policy applies only to that terminal, you can replace it with CurrentUser if you want that change be permanent (but is not something that I would recommend, since you're enabling script execution from untrusted sources)

After updating the execution policy, you can use gdscriptify directly: image

Note: This only applies if you're using powershell, using old cmd works withouth problem

AnidemDex commented 2 years ago

Anyway, gdscriptify is unable to create documentation. I include my console log with the folder files:

PS C:\Users\Lenovo-pc\Documents\Godot-EventSystem> gdscriptify
node:internal/fs/utils:344
    throw err;
    ^

Error: ENOENT: no such file or directory, mkdir 'C:\Users\Lenovo-pc\Documents\Godot-EventSystem\docs\C:\Users\Lenovo_pc\Documents\Godot_EventSystem\addons\event_system_plugin\core'
    at Object.mkdirSync (node:fs:1334:3)
    at module.exports (C:\Users\Lenovo-pc\AppData\Roaming\npm\node_modules\gdscriptify\src\utils\mkdirpSync.js:5:8)
    at module.exports (C:\Users\Lenovo-pc\AppData\Roaming\npm\node_modules\gdscriptify\src\core\generateMarkdownFile.js:236:3)
    at module.exports (C:\Users\Lenovo-pc\AppData\Roaming\npm\node_modules\gdscriptify\src\core\generateCodeReferenceFile.js:83:9)
    at module.exports (C:\Users\Lenovo-pc\AppData\Roaming\npm\node_modules\gdscriptify\src\index.js:82:3)
    at Object.<anonymous> (C:\Users\Lenovo-pc\AppData\Roaming\npm\node_modules\gdscriptify\bin\gdscriptify:3:18)
    at Module._compile (node:internal/modules/cjs/loader:1097:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12) {  errno: -4058,
  syscall: 'mkdir',
  code: 'ENOENT',
  path: 'C:\\Users\\Lenovo-pc\\Documents\\Godot-EventSystem\\docs\\C:\\Users\\Lenovo_pc\\Documents\\Godot_EventSystem\\addons\\event_system_plugin\\core'
}

Node.js v17.1.0
PS C:\Users\Lenovo-pc\Documents\Godot-EventSystem> ls

    Directorio: C:\Users\Lenovo-pc\Documents\Godot-EventSystem

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----        06/11/2021     16:44                .github
d-----        16/11/2021     21:43                .import
d-----        06/11/2021     16:44                addons
d-----        18/11/2021      0:22                docs
-a----        06/11/2021     16:44            447 .gitattributes
-a----        06/11/2021     16:44             13 .gitbook.yaml
-a----        06/11/2021     16:44            651 .gitignore
-a----        06/11/2021     16:44           1087 LICENSE
-a----        16/11/2021     22:25           2278 project.godot
-a----        06/11/2021     16:44           2016 README.md
hiulit commented 2 years ago

Thanks for the clarification about those files. I didn't know that happened on Windows and I don't know if there's anything I can do about that.

Anyway, I just noticed you have a weird path path: 'C:\\Users\\Lenovo-pc\\Documents\\Godot-EventSystem\\docs\\C:\\Users\\Lenovo_pc\\Documents\\Godot_EventSystem\\addons\\event_system_plugin\\core'.

Are you running gdscriptify in the folder? Or are you pasing the path using -d?

AnidemDex commented 2 years ago

@hiulit gdscript is being executed in the folder (as you can see in the first line in the previous reply)

No idea why is using that path, I just ran gdscriptify directly in the folder.

Note that using gdscriptify with -d and -o with the complete path gives the same result

hiulit commented 2 years ago

Ok, thanks! That's weird :P I'll see what I can find! BTW, I'm using your projects to test in locally and I can see documentation being generated ;) Let's hope we can fix those bugs for you!

AnidemDex commented 2 years ago

@hiulit If it's there anything that I can do to help to track this and solve it, let me know. If you had discord and need me to do some experiments with the console you can send me a DM AnidemDex#6740

hiulit commented 2 years ago

I've just released v1.1.0. Let's see if I could fix those bugs 🤞 You should just need to run npm update -g gdscriptify.

AnidemDex commented 2 years ago

Just tried, still getting the weird error

C:\Users\Lenovo-pc>gdscriptify -v
v1.1.0

C:\Users\Lenovo-pc>cd Documents/Godot-EventSystem

C:\Users\Lenovo-pc\Documents\Godot-EventSystem>gdscriptify
C:\Users\Lenovo-pc\AppData\Roaming\nvm\v17.1.0\node_modules\gdscriptify\src\core\parsers\parseFile.js:326
            return word[0].toUpperCase() + word.substring(1)
                           ^

TypeError: Cannot read properties of undefined (reading 'toUpperCase')
    at C:\Users\Lenovo-pc\AppData\Roaming\nvm\v17.1.0\node_modules\gdscriptify\src\core\parsers\parseFile.js:326:28
    at Array.map (<anonymous>)
    at module.exports (C:\Users\Lenovo-pc\AppData\Roaming\nvm\v17.1.0\node_modules\gdscriptify\src\core\parsers\parseFile.js:325:12)
    at module.exports (C:\Users\Lenovo-pc\AppData\Roaming\nvm\v17.1.0\node_modules\gdscriptify\src\core\generateCodeReferenceFile.js:78:18)
    at module.exports (C:\Users\Lenovo-pc\AppData\Roaming\nvm\v17.1.0\node_modules\gdscriptify\src\index.js:93:3)
    at Object.<anonymous> (C:\Users\Lenovo-pc\AppData\Roaming\nvm\v17.1.0\node_modules\gdscriptify\bin\gdscriptify:3:18)
    at Module._compile (node:internal/modules/cjs/loader:1097:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)

Node.js v17.1.0
C:\Users\Lenovo-pc\Documents\Godot-DialogPlugin>gdscriptify
node:internal/fs/utils:344
    throw err;
    ^

Error: ENOENT: no such file or directory, mkdir 'C:\Users\Lenovo-pc\Documents\Godot-DialogPlugin\docs\C:\Users\Lenovo_pc\Documents\Godot_DialogPlugin\addons\textalog\nodes\dialogue_base_node'
    at Object.mkdirSync (node:fs:1334:3)
    at module.exports (C:\Users\Lenovo-pc\AppData\Roaming\nvm\v17.1.0\node_modules\gdscriptify\src\utils\mkdirpSync.js:5:8)
    at module.exports (C:\Users\Lenovo-pc\AppData\Roaming\nvm\v17.1.0\node_modules\gdscriptify\src\core\generateMarkdownFile.js:256:3)
    at module.exports (C:\Users\Lenovo-pc\AppData\Roaming\nvm\v17.1.0\node_modules\gdscriptify\src\core\generateCodeReferenceFile.js:103:9)
    at module.exports (C:\Users\Lenovo-pc\AppData\Roaming\nvm\v17.1.0\node_modules\gdscriptify\src\index.js:93:3)
    at Object.<anonymous> (C:\Users\Lenovo-pc\AppData\Roaming\nvm\v17.1.0\node_modules\gdscriptify\bin\gdscriptify:3:18)
    at Module._compile (node:internal/modules/cjs/loader:1097:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
  errno: -4058,
  syscall: 'mkdir',
  code: 'ENOENT',
  path: 'C:\\Users\\Lenovo-pc\\Documents\\Godot-DialogPlugin\\docs\\C:\\Users\\Lenovo_pc\\Documents\\Godot_DialogPlugin\\addons\\textalog\\nodes\\dialogue_base_node'
}

Node.js v17.1.0

This time tried in a clean install through NVM

AnidemDex commented 2 years ago

Update: Experimenting a little, setting the directory path for the plugin did the trick to generate documentation

C:\Users\Lenovo-pc\Documents\Godot-DialogPlugin>gdscriptify --directory "./addons/textalog/"

GDScriptify
-----------

Markdown files created: 6 out of 11.

The documentation files can be found in 'addons\textalog\docs'.

No idea about why it worked to be honest.