Live data from Hacker News

The Makefile I use with JavaScript projects

olioapps.com

91–100 of 525 posts

Re: The Makefile I use with JavaScript projects

#91
I’ve had a lot of fun recently writing a Makefile for a Go and Lambda app:

https://github.com/nzoschke/gofaas/blob/master/Makefile

It started very verbose, one target for every Go program, until I figured out target patterns.

I’m also enjoying the -j flag to do things in parallel.

Now it’s 3 lines of Make to build 10 go programs in parallel in seconds.

Parallel is also enough job control to run the development server and to watchexec rebuilding all go programs on code change.

Re: The Makefile I use with JavaScript projects

#92

Tangential, but I cringe everytime I see the word "transpiler". A compiler is a compiler is a compiler. Previous discussion on this: https://news.ycombinator.com/item?id=15154994

A square is a square is a square. But it's also a rectangle.

Re: The Makefile I use with JavaScript projects

#93

We use make for standardizing the way docker containers are built, pushed, tested, and run (debug and production modes). I even prefer it to docker-compose at this point, because it is more programmable.

If you're able, I'd be very interested in seeing some examples.

Not the OP, doing a bit less that it sounds like the OP is doing, but we built out a relatively handy make-based build system for building a set of images in correct dependency order.

Another member of the team subsequently taught make about the reverse dependencies so that you can split jobs across Travis nodes by the top-ish level image they depend on.

My favorite addition was the ability to generate a dependency graph using graphviz straight from the Dockerfiles.

N.B. Project is now moribund, the team was disbanded. May not build at all. Don't know if any of the forks are active.

Re: The Makefile I use with JavaScript projects

#94
post #36

Earlier quoted context omitted.

For that, I don't know what the term is (or if there even is one). Transpiler? Transpiler has been around as a term in CS for a while now. Initially it was used for compilers that compiled from one dialect of assembly to another.

That was retconned. They didn't call it a 'transpiler' at the time.

"Transcompiler" was the older term for assembly -> assembly.

I don't think it's too much of a stretch to shorten that to "transpiler". I think people hate the term because they associate it with JavaScript hipsters who have no sense of CS history and presume they've invented something new. The same as how you cringe when someone refers to the "#" character as "hashtag".

But "transpiler" is a useful term. We're in a world now where source-to-source compilers are much more prevalent than they were ten years ago, and there are real workflow differences between working with a compiler that targets a low-level language versus a high-level one. Things like how you debug the output are very different.

Re: The Makefile I use with JavaScript projects

#95
I think the reason make is both so controversial and also long-lived is that despite how everyone thinks of it, it isn't really a build tool. It actually doesn't know anything at all about how to build C, C++, or any other kind of code. (I know this is obvious to those of us that know make, but I often get the impression that a lot of people think of make as gradle or maven for C, which it really isn't.) It's really a workflow automation tool, and the UX for that is actually pretty close to what you would want. You can pretty trivially just copy tiresome sequences of shell commands that you started out typing manually into a Makefile and automate your workflow really easily without thinking too much. Of course that's what shell scripts are for too, but make has an understanding of file based dependencies that lets you much more naturally express the automated steps in a way that's a lot more efficient to run. A lot of more modern build tools mix up the workflow element with the build element (and in some cases with packaging and distribution as well), and so they are "better than make", but only for a specific language and a specific workflow.

Re: The Makefile I use with JavaScript projects

#96
post #6

After going through a few build systems for Javascript, I realized they were all reinventing the wheel in one way or the other, and pulled out venerable Make from the closet. It turned out to be way more expressive and easy to read. One target to build (prod), another to run with fsevents doing auto-rebuild when a file is saved (instant gratification during dev), then a few targets for cleaup & housekeeping. All said…

Wow if you consider Makefiles easy to read...

Next to a non-toy webpack or gulp configuration, makefiles are pretty clean and simple.

Re: The Makefile I use with JavaScript projects

#97

Tangential, but I cringe everytime I see the word "transpiler". A compiler is a compiler is a compiler. Previous discussion on this: https://news.ycombinator.com/item?id=15154994

Meh:

Compiler: collects sources from various places, assembles the result into machine code.

Transpiler: collects sources from various places, converts the source to another language.

Personally I cringe at the newspeak you seem to imply we should all be applying to our lives. These words mean things - quite different things, it turns out. There's a difference between human-readable source code language, and machine-executable binary code. These tools function in different ways entirely; your optimization to the language is not only un-warranted, but leads to a desultory effect: programmers get stupider when they don't know what their tools are actually doing.

Re: The Makefile I use with JavaScript projects

#98

A long time ago, in a developer's paradise called the 1970's there was an automated build tool called "make". It had this and only this syntax: If a line begins at character 0, that is a list of files whose timestamps should be checked, if any are 'old', then execute the series of command lines beneath, identifying them as starting with a tab character. That was it, the entire syntax of "make", and it was complete. T…

I did not use Make at this time (I wasn't alive!), but it seems that you'd have to declare dependencies too. How did you determine if it was "old"?

"If a line begins at character 0, that is a list of files whose timestamps should be checked"

The list of files would be the declared dependencies.

Re: The Makefile I use with JavaScript projects

#99

A long time ago, in a developer's paradise called the 1970's there was an automated build tool called "make". It had this and only this syntax: If a line begins at character 0, that is a list of files whose timestamps should be checked, if any are 'old', then execute the series of command lines beneath, identifying them as starting with a tab character. That was it, the entire syntax of "make", and it was complete. T…

I did not use Make at this time (I wasn't alive!), but it seems that you'd have to declare dependencies too. How did you determine if it was "old"?

[deleted]

Re: The Makefile I use with JavaScript projects

#100

A long time ago, in a developer's paradise called the 1970's there was an automated build tool called "make". It had this and only this syntax: If a line begins at character 0, that is a list of files whose timestamps should be checked, if any are 'old', then execute the series of command lines beneath, identifying them as starting with a tab character. That was it, the entire syntax of "make", and it was complete. T…

I did not use Make at this time (I wasn't alive!), but it seems that you'd have to declare dependencies too. How did you determine if it was "old"?

[deleted]
Post reply on HN