5 ms·
How does that differ from saying the same thing about say webpack -- ie, "the build is documented in the webpack config"?
by slmyers 10y ago
How does that differ from saying the same thing about say webpack -- ie, "the build is documented in the webpack config"?
- ktRolster 10y agoMakefiles are more stable, webpack just went through a breaking change to 2.0. Makefiles are more versatile, they can be used not just for Javascript files, but for anything. I have a django project that uses lib-fann on the backend, and Selenium for data collection. I wish I had put that into a makefile because I can't remember the commands I used to build it, and now I have to take the time to go figure it out. Makefiles have conventions for not just building, but also running: "make all" to build, "make run" to run, and if you have an unusual project, you can get plain "make" to print out out some documentation explaining what to do. Webpack has webpack-dev-server but then you have to remember that command. Ultimately a lot of that could be had by a README file, of course, but Makefiles are easier.
- komali2 10y agovim readme.md "To run, use 'npm run'. To develop, use 'npm run dev'. To test, use 'npm test'." Or, open up package.json and see what scripts are there... I don't get how that's any different? Why wouldn't you have scripted all that?
- hoorayimhelping 10y agoI script it that way and then add a makefile on top of it so that it's conventional and handles things like envvar setting. build: NODE_ENV=production yarn build:server NODE_ENV=production yarn build:client test: NODE_ENV=test yarn test
- Klathmon 10y agowe do the same, but the npm scripts are just the "entry point". one of them was this: "build:dist": "NODE_ENV=production babel ./src --out-dir ./dist"
- ktRolster 10y agoMaybe you missed this paragraph, it talks about your point: Makefiles are more versatile
- jacobr 10y agoDo you generally run long running tasks such as a dev server with Make?
- andreareina 10y agoNot the GP, but if I'm going to use make anyway, sure. init/systemd/upstart scripts for a system install, make run for a local install. It's exactly the same idea as running "node start" (apologies if I have the invocation wrong, I'm not really familiar with the node ecosystem).
- ktRolster 10y agoA makefile is just a way to group commands together conveniently (at least, that's one aspect of it). So you can just type "make run-server" or whatever you want and it's just like running a script. It's probably not something I would do on a production server, but it wouldn't hurt either.
- smonff 10y agoIt is also a way to write down and share very complicated command lines that you want to generate only one time because it is a pain to type it each time. So, a kind of self-documentation.
- chriswarbo 10y agoNot a JS dev, but if I run "ls" or "tar xf foo.tar.gz" and I see "Makefile", I instinctively run "make". Ditto for "./configure", although I'd probably despair if autotools were needed for a JS project ;)
- flukus 10y agoIt works with the outside world and it's been stable for decades.
- ktRolster 10y agoI feel like stability is underrated.
- divanvisagie 10y agoBecause make is human readable and webpack reads like some sort of regex gone wild example.