Closed increpare closed 3 years ago
Interesting suggestion!
I'm really wary about using node's module system for browser apps. My understanding (I ended up doing this once and kind of regretting it) is that you end up having to module-ify everything and suddenly you're not writing browser-compatible javascript anymore (Which for this project is just something I want). I'm basically correct in this assessment, right?
(OTOH I understand the benefits of having a nice smooth pipeline for people looking to do the compile process without having to install lots of random things, but I prefer the current system overall)
Oh sure. I got your idea and understand the trade-off. (it’s also interesting that a friend of mine who made a Tetris game running in the browser, and has the very same opinion. (aha his repo: https://github.com/farteryhr/tetr.js)). Anyway, it’s good to keep it as it is.
If you are interested in this, webpack is the current gold standard for the OSS JS community. You're writing modules and code that won't run as-is in the browser, but it makes it easy to set up compilation pipelines with niceties like source maps that link your stack traces back to actual file/line numbers, a watch server that live-reloads your browser while doing development, the ability to use new ES6 language features or compile-to-JS languages like TypeScript, etc.
Totally understand why you might prefer to stick with the current system, but also happy to walk you with through the (slightly more annoying than it should be) process of getting webpack set up initially if you have any interest.
@lazerwalker nope nope nope not for this, but thank you for offering :)
I remade my build script in node (it was bash before) so now it crashes when there are problems.
A suggestion: could try to make all these processes (build, versioning, test, commit, etc.) work more like a typical JS project (with Node/NPM tools), more controllable than bash scripts.
I think https://parceljs.org might be the best choice for projects like PuzzleScript and Flickgame. Basically it can help to concat and bundle/minify CSS, JS and HTML files. And the Node tool chain brings some other benefits.
But it also means a lot of code refactoring (such as shared global variables). So, just an idea. If you’re interested in I think I can help.