TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Makefiles for Web Work (2022)

101 pointsby crcastle9 months ago

12 comments

augusto-moura9 months ago
The problem that I find with Makefiles, in Node projects, is that node scripts and tools are pretty slow to startup and pretty much all of them have some run-on-all-files type of setup<p>So, for example, instead of running the typescript compiler for a single file<p><pre><code> tsc src&#x2F;index.ts </code></pre> You are better suited to run the compiler to the whole repository:<p><pre><code> tsc --build .&#x2F;tsconfig.json </code></pre> Which implements incremental building and dependency tracking automatically.<p>For this case having make run tsc for each file individually hurts performance pretty bad. Something like this will not scale very well:<p><pre><code> src&#x2F;%.js: src&#x2F;%.ts tsc $&lt; </code></pre> There&#x27;s definitely a overlap where each JS tool implements its own incremental building, cache system and dependency resolver. Eslint, prettier, npm, webpack could all benefit from being more Unixy and forwarding the task management to a tool to rule them all.<p>Things are changing though, and tools like swc and esbuild are getting pretty fast. And there a few attempts for an universal build system on NX and TurboRepo. My dream scenario is where we get a single command interface, similar to gradle or bazel, where you just run `tool build` and everything gets setup for you without fuzz
评论 #41338297 未加载
评论 #41336517 未加载
评论 #41337020 未加载
dig19 months ago
I love make because it has simple syntax, is language-agnostic, and provides consistent builds regardless of the tooling used. This is especially visible if you combine it with multi-language projects (e.g., C&#x2F;Java&#x2F;JS all in one).<p>Instead of running multiple commands, I can type &quot;make prepare ship&quot; and the magic starts. While it has its challenges with language-specific tasks, use language-specific build tools, like true Unix philosophy demands :D. When I need language-agnostic dependency management, make&#x27;s simplicity is still unmatched compared to modern alternatives. And no, bash scripts can&#x27;t match this with ease.
peauc9 months ago
I find that <a href="https:&#x2F;&#x2F;github.com&#x2F;casey&#x2F;just">https:&#x2F;&#x2F;github.com&#x2F;casey&#x2F;just</a> is a great answer to a lot of problems in this thread. I have a justfile in all my projects now and I&#x27;m very happy.
评论 #41339067 未加载
评论 #41339041 未加载
sirsuki9 months ago
The anti-make-reinvent-everything mentality has bugged me for decades. I never understood why every language seems compelled to reinvent the build system. Especially when the output is file based.
评论 #41339081 未加载
评论 #41338571 未加载
评论 #41342324 未加载
评论 #41339007 未加载
评论 #41339196 未加载
评论 #41347451 未加载
throw1567542289 months ago
I like this, package.json starts to look really ugly when you build up lots of scripts that need to run interdependently. For example some stubbed back ends, front end, some auth service, etc. You end up with ugly long npm scripts with &amp;&amp;s everywhere. However for this sort of thing, personally I&#x27;d rather use docker compose, dependencies are explicit and declarative, like this I guess. You can define health checks for services with docker compose too.
nsonha9 months ago
There is an even simpler way, just use a bash file with each function being a task, saves you from the .PHONEY hack and the &quot;bash but not really bash&quot; quirks of makefile.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;adriancooney&#x2F;Taskfile">https:&#x2F;&#x2F;github.com&#x2F;adriancooney&#x2F;Taskfile</a>
评论 #41337021 未加载
评论 #41338906 未加载
8bitme9 months ago
Makefiles also have good support for tab completion of the make targets in most shells.
mikl9 months ago
Why not just use shell scripts instead of trying to work around make’s weirdness to make it do something it wasn’t designed for?<p>If make is available, odds are that a bash-compatible shell is too.
评论 #41338807 未加载
评论 #41338409 未加载
评论 #41337482 未加载
评论 #41337141 未加载
muratsu9 months ago
I like make but I don’t understand the logic here. If you’re going to install node anyway, why be so against using node for scripts? Perhaps less of an issue these days but make also isnt included in windows.
评论 #41336598 未加载
评论 #41336356 未加载
hardwaresofton9 months ago
If you’re going to use make, use just instead:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;casey&#x2F;just">https:&#x2F;&#x2F;github.com&#x2F;casey&#x2F;just</a>
评论 #41338744 未加载
评论 #41338626 未加载
baquero9 months ago
I use <a href="https:&#x2F;&#x2F;taskfile.dev" rel="nofollow">https:&#x2F;&#x2F;taskfile.dev</a> and I love it.
greenie_beans9 months ago
make is cool. we used to use it for ETL, but i dunno if i&#x27;d recommend it for that