News for hackers. Stuff that matters.
Re:Modern JavaScript for Ancient Web Developers by ktRolster on Thursday March 23, 2017 @02:29PM (#13942646)
Makefiles 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.

Re:Modern JavaScript for Ancient Web Developers by komali2 on Thursday March 23, 2017 @02:40PM (#13942753)
vim 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?

Re:Modern JavaScript for Ancient Web Developers by hoorayimhelping on Thursday March 23, 2017 @03:40PM (#13943424)
I 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
Re:Modern JavaScript for Ancient Web Developers by Klathmon on Thursday March 23, 2017 @03:53PM (#13943578)
we 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"
Re:Modern JavaScript for Ancient Web Developers by ktRolster on Thursday March 23, 2017 @04:39PM (#13944031)
Maybe you missed this paragraph, it talks about your point:

Makefiles are more versatile

Re:Modern JavaScript for Ancient Web Developers by jacobr on Friday March 24, 2017 @02:07AM (#13947017)
Do you generally run long running tasks such as a dev server with Make?
Re:Modern JavaScript for Ancient Web Developers by andreareina on Friday March 24, 2017 @11:09AM (#13949387)
Not 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).
Re:Modern JavaScript for Ancient Web Developers by ktRolster on Friday March 24, 2017 @03:05PM (#13951367)
A 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.

Re:Modern JavaScript for Ancient Web Developers by smonff on Sunday March 26, 2017 @03:16AM (#13959626)
It 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.