TypeScript! Tooling! Linting! Refactoring!
Hello there, long time no see :D
When folks ask about how to make webgames, I always point them to Shaku, which keeps being the best framework for making webgames: asset loading, input handling, & .drawSprite without the constraints & opinionated designs of an engine.
However, the tooling is not so ideal. The typescript support isn't (and can't be) complete, and requires fiddling on the project settings. The library produces a global object, which doesn't play well with modern import style projects. In fact, I'm currently unable to build new Shaku projects using TypeScript - my old workflow was broken somewhere along the line.
While asking around looking for a quick fix, @Ascor8522 got in touch with a much better solution: update the whole library to typescript, with modern standards and better tooling. This improves the QoL of using (and maintaining!) the library; autocomplete alone is already a game changer, and it's just the tip of the iceberg.
@Ascor8522 has already done all the work of setting up everything. As a result, Shaku can now be used in a Vite project: https://github.com/knexator/shaku-template. They have also done a ton of work adding typings and fixing existing bugs. However, full typescript compatibility is still far from done, and we could really use extra hands 😄
There are also some refactoring decisions that break compatibility but improve the library, and before commiting to them we would like your input. We're opening this PR as a place to discuss them and work together on bringing Shaku to modern standards 🤖 Tell us what you think!
Hi @knexator and @Ascor8522 Sorry for only replying now, I wanted to write to you several times and each time something came up and I forgot until the next time you pushed some changes and I got notified again :D
First, let me say it's extremely awesome that you took this project and did so much work on it! Its quite exciting to see your passion to improve this project :)
Now about the future of Shaku and Shaku ts:
- I'm pulling back from web for a little bit, which is why I haven't pushed any changes to Shaku recently. It's not forever, it's only until I'll get an itch to do web stuff again ;)
- While I have a lot of experience with JS, I haven't really worked with TS. I know its not very different, but still.
- Personally I don't view the transition of JS to TS as necessarily an upgrade, nor a downgrade, I view it more as a change in language flavor and a personal preference. And I'm on the JS side (but got nothing against TS no worries :))
- And WOW you did a lot of changes! I don't know if I have the capacity to dive into all of them at this time.. And the amount of typos I now see I had makes me cringe lol
So due to 3 and 4, I wonder if we should maybe keep this project in its own git, that you guys will manage, instead of merging it into Shaku.
We can add links from this git and NPM to the Shaku-ts git (or whatever you want to call it) and you'll have the freedom to continue evolving it to your heart desire, without me holding you back with PR approvals.
To be honest if we take this approach I assume your version of Shaku will continue to grow for as long as you invest in it, while the original Shaku will slowly decay until becoming deprecated, unless me or someone else decide to pick it up and revive it, in which case it will be a different flavor of Shaku. But I think this is the right way to approach this.
What do you think?
Also regarding "There are also some refactoring decisions that break compatibility but improve the library, and before commiting to them we would like your input." - do you want to talk about them here or is it too complicated and you want to schedule a quick chat?
Thanks :)
To merge, or not to merge, that is the question... I agree that it makes sense to keep it in a separate repo, due to the magnitude of the changes. However, before making a decision, let's wait until the port is complete (or almost), giving you the opportunity to use the TS library properly ~~and maybe get converted to the TS cult 😁~~
I haven't kept a list of breaking changes (oops). Most of them are just renaming stuff or changing class organization, nothing too serious. Once it's working, I can try porting some of my old Shaku games, to see any major breaking points.