It's some sort of industry standard for common tasks.
Example: you're working in a polyglot stack (Node, Python, Java, Go). Even when you're experienced in one or two languages, you don't know how to execute some tasks (NPM for Node, Pipenv for Python, Maven/Gradle for Java, so on).
One simple way to solve that is using a common approach to create common tasks using the Makefile, and wrap the language-specific command, like make dev for npm run dev (developer profile to watch and reload changes), make test for npm test, make run for npm start (for production), make deploy, etc.
In the end, you don't need to know the tasks or read all the README.md in the repositories. And better: you can check the Makefile for all available tasks and how its work for all languages :)
As with everything, including computers, there are trade-offs. Don't judge ONLY by the first contact or StackOverflow responses. We need to dig that kind of long term solution by its possibilities.
You can use a folder/file name as a task name and this actually highlights one of the benefits of make that a lot of other systems either don't do, or make difficult.
Now when you run make deploy, npm install will run if the package.json file is newer than the node_modules directory and the .env file will be created if it doesn't exist.
Hi Pacharapol,
I recommend Makefile for some reasons:
Example: you're working in a polyglot stack (Node, Python, Java, Go). Even when you're experienced in one or two languages, you don't know how to execute some tasks (NPM for Node, Pipenv for Python, Maven/Gradle for Java, so on).
One simple way to solve that is using a common approach to create common tasks using the Makefile, and wrap the language-specific command, like
make dev
fornpm run dev
(developer profile to watch and reload changes),make test
fornpm test
,make run
fornpm start
(for production),make deploy
, etc.In the end, you don't need to know the tasks or read all the README.md in the repositories. And better: you can check the Makefile for all available tasks and how its work for all languages :)
Makefile its not hard: cs.colby.edu/maxwell/courses/tutor...
Makefile seems namespace-limited and unpredictable to me.
I cannot use folder name as a task name...
As with everything, including computers, there are trade-offs. Don't judge ONLY by the first contact or StackOverflow responses. We need to dig that kind of long term solution by its possibilities.
About using the folder name, try:
.PHONY: task-with-same-folder-same
task-with-same-folder-same:
You can use a folder/file name as a task name and this actually highlights one of the benefits of make that a lot of other systems either don't do, or make difficult.
Suppose you have the following rules:
Now when you run
make deploy
,npm install
will run if thepackage.json
file is newer than thenode_modules
directory and the.env
file will be created if it doesn't exist.makefile has a lot of things to complain about, unpredictable I simply don't see. It's rock solid, and hasn't changed massively in over a decade.