So I know js2py is a thing but I'm not entirely sure if you can convert an entire folder? I only know how to use python and being able to convert the language would be extremely helpful for me, I'm trying to make a twitch chat bot however moderation commands and configuration is difficult for me and the destinygg chat bot is insanely good and being able to use it would be amazing. https://github.com/destinygg/chat-bot If this is not possible I understand however its worth a shot to ask how/if I guess :)
Asked
Active
Viewed 416 times
1 Answers
0
No, it supports translating a file but not a folder.
But you can enumerate the files in your folder and translate them one-by-one, using:
js2py.translate_file('example.js', 'example.py')

jarmod
- 71,565
- 16
- 115
- 122
-
https://i.imgur.com/xTJJP6l.png Does this mean that its not possible to use js2py to translate the js file? Is there another way to do this or am I screwed? – Ryan Mclaughlin Dec 01 '20 at 14:14
-
Related: https://github.com/PiotrDabkowski/Js2Py/issues/225. As a general rule, translating from one programming language to another is very rarely done and hence the tooling around this is likely to be immature and not bullet-proof. If it's a modest amount of code, it's better to rewrite it natively. – jarmod Dec 01 '20 at 14:58
-
its not a modest amount of code its an entire folder like I said – Ryan Mclaughlin Dec 01 '20 at 15:36
-
Then find out what the tool's plans are for supporting es6, or rewrite the non-es5.1 parts in es5.1, or use babel to transpile to es5.1 so the tool *does* work. – jarmod Dec 01 '20 at 15:42