btco / qx82

Tiny Javascript engine for retro games
MIT License
425 stars 20 forks source link

Rewrite to TS, modular #11

Open Runeii opened 4 months ago

Runeii commented 4 months ago

Rewrites codebase to use TS and Vite build process.

While this introduces (fairly minor) overhead for building the project, it gives benefits:

Additional feature:

This also would allow qx82 to be available via npm.

Runeii commented 4 months ago

I tried with this MR to ensure the final library doesn't differ from how it was intended to be used currently, nor change the coding style. But if I've overlooked something, let me know and happy to adjust! This mainly came from my own needs, where it would be ideal to have full typing in a wider project.

btco commented 4 months ago

Thanks for submitting this! I'll take a look asap.

Runeii commented 4 months ago

Good to hear!

Install instructions would depend on need:

To add to a project via npm/dependency

To add via CND The qx82 folder still exposes the same built qx/qxa/qxu js files.

Runeii commented 4 months ago

Something I spotted while doing this, btw – see my comment on line 451 in main.ts. I believe there's a bug, but not sure it would ever happen.

btco commented 3 months ago

It looks like when I install with npm install three Runeii/qx82#vite --save, it creates node_modules/qx82 but inside of it there aren't any JS files, only TS files.

How would people using plain JS use this? Sorry for all the questions, I don't have a lot of experience with npm build systems.

Thanks!

Runeii commented 3 months ago

That was actually my mistake, I forgot to commit the built files. If you reinstall now it should include both types.

If someone is using a build system/npm, this is designed to expose both TS and JS versions and will work with both.

For other users, once merged, they can still just get the JS files from inside /qx82 same as before.