Beakerboy / OSMBuilding

render an individual OSM building
MIT License
41 stars 5 forks source link

Improving architecture around codebase #57

Open Venefilyn opened 1 month ago

Venefilyn commented 1 month ago

Hey I'm thinking of contributing to this repo and also making it more approachable and in my opinion a bit easier to manage

To what degree do you want to handle this repository? My contribution would be to make a more standardized workflow and also transpile the JavaScript code into something that works in most browsers without needing special polyfills and so on

I was thinking of adding these things, but wanted to run them by you first @Beakerboy

Beakerboy commented 1 month ago

My goal is to have something that runs as is from a GitHub.io. I am not a javascript expert and do not know the pros and cons of Typescript. Feel free to break these down into individual tasks/issues in the queue.

Venefilyn commented 1 month ago

@Beakerboy So with something like Vite we would be able to use modules and still publish to github.io without any issues. It also allows us to use more modern features and still make it work with a bit older browsers, and reduce the filesize of the final JS and CSS files.

Then with TypeScript, it's basically just making types for JavaScript, So instead of

let my_var = null // default to null
my_var = "name"

we would do this

let my_var: string|null = null // default to null
my_var = "name"

Main pro of that is that we reduce mistakes, makes it easier to code (IMO), and encourages better design Main con is that it is a bit more work as you need to think about types, you can't mix and match types without safely type checking

But overall it means potential mistakes are caught in development rather than live on the github.io page

I can spin up an example on my fork of how it would look and show you if you are interested in using any of these?

Primarily I just want to contribute to make the tool better but the tooling could use a glow-up :D

Beakerboy commented 1 month ago

I’m a fan of static analysis. When I use python and php I always go above and beyond to ensure all my typing is fully annotated.

I am not a javascript coder…or really a professional programmer. I kind of used this project to learn javascript to some extent, and some of it is still confusing to me, like the different flavors, importing properly, etc. A lot of this project has been assembled with the help of Google, Stack Overflow, and Reddit.

Venefilyn commented 1 month ago

Okay, I'll set something up when I have time and you can try it out :pray: