Tuesday, September 30, 2025

Convenience Scripts for Projects

Recommended bash scripts for every project



  1. clean_start ensures you are ready to start new work. It does:
    1. 'pull -r' (which fails if you have uncommitted work)
    2. a refresh of the local environment
    3.  'git clean -i' in case you have untracked files you've forgotten about
    4. a full test run.
  2. onboard is the script to run if you are a brand-new developer and you need to set up your development environment. It will deal with setting up the environment (installing dependencies and any virtual environment) and runs the tests.
  3. run runs the application itself.
    I started adding run scripts when I started changing between ruby, python, java and other projects and got tired of having to remember which incantation started the servers.  This is a shortcut.
  4. run_tests will run all of the tests -- every kind.
  5. run_integration_tests will run only the integration tests (I don't always separate these).
I don't use a script to run only the unit tests, because I have IDE configured to run every time I make a compilable change. In some languages, I have to wait until I save the file (pycharm does it better). Some js/ts test libraries will also run automatically on save. If you need one, write a './unit_test' script and be happy. Use it often.

Another useful trick is to add a precommit hook so that you cannot commit locally unless all the tests are running successfully.

It can be helpful to have an LLM/agent/AI write these scripts initially and keep them up to date. You can do just as good a job as they can, but it is a fairly simple task that most of them can handle well enough.



No comments:

Post a Comment