Are you tired of configuring .pre-commit-config.yaml
all over your projects, and
keeping those up-to-date?
Me too. 🤦
Thus, here's autopretty. It uses Copier to keep your projects updated with the latest code formatters and linters.
- Install Copier
- Install pre-commit
- Enter your project folder:
cd my-project
- Make it a git repo:
git init
- Run
copier copy https://github.com/copier-org/autopretty.git .
- Answer questions
- Activate pre-commit:
pre-commit install
- Commit:
git commit -am 'Apply autoprettier'
(repeat if pre-commit reformats anything and makes the update fail) - Update your code
pre-commit run -a
- Commit:
git commit -am 'Run pre-commit'
- Enter your project folder:
cd my-project
- Update:
copier -a .copier-answers.autopretty.yml update
- Answer questions, if anything changed
- Commit:
git commit -am 'Update autoprettier'
(repeat if pre-commit reformats anything and makes the update fail) - Update your code
pre-commit run -a
- Commit:
git commit -am 'Run pre-commit'
This template is self-applied, and as you can imagine, there are some 🐔+🥚 situations.
To update it:
- Publish a new release on Github
git fetch --tags
copier -a .copier-answers.autopretty.yml --prereleases update
In case you want to self-test a new release locally:
git tag v0.1.0a99
... or the version that you will release.copier -a .copier-answers.autopretty.yml --prereleases update
- Once you're happy:
git tag -d v0.1.0a99
- Open PR.
- Merge it.
- Release.
- Do the proper update.
At some point, this should be automated easily.