typescriptle icon indicating copy to clipboard operation
typescriptle copied to clipboard

add node script

Open patarapolw opened this issue 3 years ago • 2 comments

I don't know how you would feel about having JavaScript in your repo, but every TypeScript users will definitely have Node installed.

You need to randomize a number to make a new game, anyway.

/index.js filename is due to simply running node . works.

patarapolw avatar Mar 16 '22 18:03 patarapolw

Hey, thanks for this! Right now I'm not yet quite sure how I want to handle game randomization. I'm not sure I'm a fan of using regular expressions to parse the array from the definition file in order to get to the length. To me this relies too much on the file layout and is another thing to maintain if changes were made to that file. I also wouldn't want people to have to run the script initially when they just want to load up the project, as well as not having it work in an online sandbox due to having to generate files first.

This is something I want to eventually support but as of now I think that it it's a bit overkill. As for using JS: I would definitely want to stay 100% TS :)

johanneslumpe avatar Mar 16 '22 20:03 johanneslumpe

Another way is getting the location of [ and ] somehow (s.indexOf(']', s.indexOf('[')) in JavaScript).

About avoiding JavaScript, it is also possible via Bash script and Power Shell script. (needs both)

Online sandbox is another problem. Not sure how to handle randomization there.

patarapolw avatar Mar 16 '22 21:03 patarapolw