A Copier template for Copier templates!
To install Copier, please follow the instructions here.
Then, to create a new project based on this template, run:
copier copy 'https://github.com/vivienm/copier-copier' path/to/your/project
and fill in the form.
To update an existing project based on this template, run:
copier update --skip-answered
This template uses itself, so it's a bit messy. Here is a quick recap:
- The nested directory
template/template
contains common template files for all final projects, no matter the language. Hence, it is relatively empty. - The toplevel directory
template
contains common template files for Copier template projects. It is built upon the templates in thetemplate/template
directory. - Finally, the root directory
.
(i.e. this project itself) is built upon the templates in thetemplate
directory.
As a consequence, all Jinja-like filenames in the template/template
directory
should be quoted with {{ '{{' }} ... {{ '}}' }}
to avoid being rendered one
step too far by Copier in the template
directory.
To update the project:
# First, do some changes in the nested common template directory.
vim template/template/some_file
git diff
git commit -am "chore: update some file"
git push
# Then, propagate the change to the toplevel copier template directory.
# Inspect the changes and commit them.
copier update --skip-answered
git diff
git commit -am "chore: propagate $(git rev-parse --short HEAD) to copier template"
git push
# Finally, propagate the change to the project itself. Inspect the changes
# and commit them.
copier update --skip-answered
git diff
git commit -am "chore: propagate $(git rev-parse --short HEAD) to project"
git push