Hacker News new | past | comments | ask | show | jobs | submit login

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.




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?


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


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"


Maybe you missed this paragraph, it talks about your point:

Makefiles are more versatile


Do you generally run long running tasks such as a dev server with Make?


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).


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.


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.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: