Productivity tip: add a Makefile to your project
Editing a Makefile
If you often switch between technology stacks, it can be hard to remember commands to run common tasks. Providing a Makefile with generic targets is a cheap way to make it easier to get started with the project, whether it's for a new developer or for your future self. There are a handful of targets that you may find useful for most projects:
develop: set up a development environment
serve: start a development web server
build: build distributable artifacts
test: run the automated test suite
coverage: produce a test coverage report
deploy: push to your staging or production environment
Adding a Makefile that implements those generic targets using the appropriate command lines acts as executable documentation. You can run all those targets as is, but if your particular need is not covered you can also open the Makefile to see how the existing targets are implemented and use them as a starting point for less common tasks. By reading the Makefile, you'll be able to tell which build tool is used by the project and you'll know where to go from there to find more documentation about this tool.
develop: npm install --dev test: npm test serve: npm start
And here is what the Makefile of a Django project may look like:
develop: pip install -r requirements.txt python manage.py migrate test: clean python manage.py test coverage: coverage run manage.py test coverage report serve: python manage.py runserver
Of course, this tip is not only applicable to pure software projects, here is a Makefile for a static web site:
develop: pip install -r requirements.txt build: wok serve: wok --server --port=8901 deploy: build rsync -avz output/ myserver.example.com:/var/www/homepage
You can also add a Makefile to your presentation slides, your LaTeX resume... as long as you use command lines to manage it, put those commands in a Makefile and it will act as a nice executable reminder of what you can do with the project.
Of course you don't need to implement all targets for all projects. For instance a
minify target would be relevant only to frontend projects. But try to use the same target names from project to project for consistency.
Getting into the habit of providing a Makefile with your project will make it easier for your colleagues and your future self to start working on it.