Comment

Comment by snprbob86

I'm not sure I understand the value of this project at all.

He says that maintaining a monolithic Makefile doesn't scale, but that seems unlikely considering how far BSD stretches Makefiles for it's ports system. Sure, Make has some rough edges, but I don't see how Javascript is possibly preferable for gluing together build processes.

The fundamental problem here is that "task based build system" is a silly idea. Make isn't a programming language, you don't define function names. Make is a dependency graph with files for nodes and command lines for edges. We already have a system for "tasks": stick things in ./script or add things to PATH!

By all means, make a metapackage for your test, lint, etc scripts, but define your concatonation like this:

    out/foo.js: banner src/foo.js
        cat $^ > $@
And generalize your minification using a pattern rule, here's ours:

    %.min.js: %.js
        $(yui) --type js --nomunge < $< > $@
Then add in a gzipping rule:

    %.gz: %
        gzip --best < $< > $@
You could trivially stick that sort of thing into `grunt.mk`...

And here's how you'd use that:

    include grunt.mk

    my-app.min.js.gz: my-app.min.js

    my-app.min.js: $(find src -name '*.js')
That said, sometimes it is nice to add some "tasks" for discoverability & encouraging their usage:

    include grunt.mk

    .PHONY: all lint test

    all: my-app.min.js.gz lint test

    my-app.min.js.gz: my-app.min.js

    my-app.min.js: $(find src -name '*.js')

    test:
        ./test/run

    lint:
        ./script/lint src
What if you want to run a subset of tests? Or lint with particular flags? Run a shell command like this one:

    $ grep test: -A1 Makefile
Then copy paste and edit the output!

Simpler is better.

parent snprbob86 14 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton