Building LW4 binaries in 2024

TL;DR I’ve got LaserWeb4 binaries building for Win, Mac, and LInux with Nodejs 20 and yarn.

Hello Laserwebbers!

I’ve been on a little bit of a journey for the last few weeks and wanted to share the results of my work and gauge community interest. I initially started out attempting to add a basic feature to LaserWeb4 (pen-plotter control) for my own purposes, and that turned out to be fairly straight-forward, even as someone who’s never programmed any javascript. Getting things building, however, was pretty ugly. So I went down the rabbit hole.

I initially started from the latest versions of the repos, pulled everything that looked useful from the EDMWeb fork by Anders Rottschafer, changed anything that said “edm” back to “laser” and got to work. I also used some of the electron_bundler branch of lw.comm-server for reference.

I’m sure there were shorter routes to a working build pipeline, but I was also learning Node and git along the way. So after fumbling my way through the process, I got everything building with Nodejs 20. I targeted that version since it’s officially still maintained and supported. This might be an overreach, but I also completely did away with npm in favor of yarn. Yarn just felt faster and and more helpful during debugging.

My repos are messy and still need cleanup, but I wanted to share this with anyone who’s interested. If it’s something the dev team would like merged in, I’d love to submit some pull requests.

Best starting point to take a look is here:

Current high level state of things as of this post:

  • Everything is configured to be initially checked out and built locally
  • package.json files depend on local lw.comm-server instead of git repos
  • Binaries project drops its original index.js and changes the app’s entry point to “node_modules/lw.comm-server/server.js”, and electron code is moved into server.js there
  • App versions are still at 1.0.0, not in line with the 4.0.999-138 (I think?) versioning of the project
  • Various cruft from trying weird stuff to get things working along the way

What I’m working on next:

  • Clean up the build scripts
  • Fine tune build configs for each platform
  • Trim out anything that doesn’t need to be included in the binaries to cut the size down
  • Remove leftover junk from this whole endeavor
  • Cleanup commit history, possibly via a new branch if I can’t figure out commit squashing

Ideas I’d love to try and tackle when I’m happy with the state of things above:

  • Togglable dark mode based on the EDMWeb fork’s css
  • Internationalization support
  • ???

I think that covers the gist of it. I’m sure I’m forgetting relevant details, but this post is already long enough.

I’d love to hear any feedback that anyone reading this might have!