Starting a TypeScript Project in 2021
I really recommend getting comfortable with make -- if you know just enough to be dangerous (PHONY targets, regular targets, ifeq, ?=), it can be an incredibly useful tool, and unify control&#x2F;operations across projects.<p>The complexity&#x2F;required reading that comes with integrating ~5+ individual tools and libraries you have to be aware of across one language can be made a lot easier by using make to do the plumbing between these tools.<p>Often I find that I need to do some of the following:<p>- do just a <i>tiny</i> bit of pre-processing<p>- use two disparate tools which might interact&#x2F;have an ordering requirement<p>- alias a simple command for a repetitive task<p>And it&#x27;s the case that:<p>- The tools&#x2F;libraries I&#x27;m using don&#x27;t have the functionality built in<p>- I&#x27;m not excited about writing a bash script<p>- A &lt;programming language&gt; script&#x2F;build-hook feels too heavy<p>I find that Makefiles are a really good way to boil down and standardize my builds across projects.<p>Here&#x27;s a chunk from a somewhat recent project:<p><pre><code>    psql: export DB_CONTAINER_NAME=$(shell $(KUBECTL) get pods -n $(K8S_NAMESPACE) -l component=db -o=name | head -n 1)
    psql:
     $(KUBECTL) exec -it $(DB_CONTAINER_NAME) -n $(K8S_NAMESPACE) psql -- --user $(DB_USER)

</code></pre>
And another that&#x27;s a bit less trendy:<p><pre><code>    image: check-tool-docker
     $(DOCKER) build \
     -f infra&#x2F;docker&#x2F;Dockerfile \
     -t ${IMAGE_FULL_NAME_SHA} \
     .

    image-publish: check-tool-docker
     $(DOCKER) push ${IMAGE_FULL_NAME_SHA}

    image-release:
     $(DOCKER) tag $(IMAGE_FULL_NAME_SHA) $(IMAGE_FULL_NAME)
     $(DOCKER) push $(IMAGE_FULL_NAME)
</code></pre>
And earlier in the file is the actual language-specific stuff:<p><pre><code>    lint: check-tool-yarn
     $(YARN) lint
</code></pre>
Yeah, all I&#x27;m doing is just calling through to yarn here but the nice thing is that `lint` is a pretty common target from project to project, so most places `make lint` will do what I think it is going to do.<p>And if you&#x27;re wondering what the check-tool-&lt;x&gt; targets are like:<p><pre><code>    check-tool-yarn:
    ifeq (,$(shell which $(YARN)))
     $(error &quot;yarn not installed (see https:&#x2F;&#x2F;yarnpkg.com)&quot;)
    endif

</code></pre>
I will warn that there are people with Makefile PTSD, but I am finding a <i>lot</i> of value from it these days, would encourage people to take a look. If you&#x27;re really ready for some fun check out recursive make -- managing and orchestrating subprojects is really really easy (and you don&#x27;t have to care what the sub project is written in at the top level).