Software build automation

Can someone please tell me which book should I follow to understand about build automation?

In what way? What are you trying to build? What are you trying to do? It’s dependent upon that to a great extent, and build automation is a very broad subject (just writing/using code that automatically runs common tasks), and most of the tooling is aimed at managing large codebases.

Learning to use Linux, learn Bash, they are a major core things. Lots of the automation stuff expands on that, basically a way to run command line programs in specified sequences.

See specifically I want to learn it regarding web development. How the build tools are actually created?
So I thought having a broader knowledge on it won’t hurt.

So for JS, the build tools use Node. Node allows you to run JS outside the browser, so the tools are a program that is execute using Node. It has a standard library of methods, and the ones the tools generally make use of are those that deal with talking to the operating system, things like reading/writing files. The normal path is: you write a small program that lets you specify an input & output file. The program passes that input file to some program that modifies it, then it goes to the output file.

The programs you pass it to all do this anyway, but the point of the automation is to maybe glue a load of those programs together, so a file gets passed through a few things - maybe you check the JS for errors using ESLint, then you format the file using Prettier, then you do some compiling using Babel, then you put the output in a different directory. And maybe you want all this to happen automatically when you save a file, so you need a program that watches your files for changes running and so on.

They aren’t terribly complex (the main problem with them is how to make them quick, because reading/writing files is slow). But learning how to do that isn’t too difficult. I guess most of the underlying knowledge doesn’t really fall under build automation per se, it’s just pretty basic scripting & learning to use Node, learning how to read/write from/to the filesystem and call external programs/scripts, and learning how to use pipes/streams (which is bit finicky in Node)

Okay?! So I need to just practice it, and not separate book to follow?

Maybe! I’d get used to using the tools, so say use ESlint and Babel and various other things, and figure out how to pass files in, get files out etc, which you can just do with the command line.

Then look at how you use them with NPM scripts (so defining like "build": "babel app.js" or whatever in you package.json, then running npm run build to execute it).

Then look at how you could move that into a script file, so a JS file that does those things, which you then call like node my-script.js. You’re going to want to know how to do that, so learning Node is useful here - there are good books on this, though they mostly focus on web development, so I don’t really have any great recommendations. I’d Google Node command line applications and you should get a load of fairly detailed articles