From ecec929cf0fa291c26fad6bcf0d49458f38efd58 Mon Sep 17 00:00:00 2001 From: martonvago Date: Thu, 24 Jul 2025 16:53:07 +0100 Subject: [PATCH] feat: :sparkles: add locked var for copyright year --- copier.yaml | 5 +++++ template/LICENSE-MIT.md.jinja | 4 +--- template/{{ _copier_conf.answers_file }}.jinja | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 template/{{ _copier_conf.answers_file }}.jinja diff --git a/copier.yaml b/copier.yaml index 338b904..c154eb7 100644 --- a/copier.yaml +++ b/copier.yaml @@ -40,3 +40,8 @@ github_board_number: {% if github_board_number and not github_board_number.isdigit() %} The board number must be an integer. {% endif %} + +copyright_year: + type: str + default: "{{ copyright_year | default('%Y' | strftime) }}" + when: false diff --git a/template/LICENSE-MIT.md.jinja b/template/LICENSE-MIT.md.jinja index bc00010..2c2d8e8 100644 --- a/template/LICENSE-MIT.md.jinja +++ b/template/LICENSE-MIT.md.jinja @@ -1,8 +1,6 @@ # MIT License - - -Copyright (c) YEAR {{ package_abbrev }} authors +Copyright (c) {{ copyright_year }} {{ package_abbrev }} authors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/template/{{ _copier_conf.answers_file }}.jinja b/template/{{ _copier_conf.answers_file }}.jinja new file mode 100644 index 0000000..a8c521e --- /dev/null +++ b/template/{{ _copier_conf.answers_file }}.jinja @@ -0,0 +1,2 @@ +# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY +{{ dict(_copier_answers, copyright_year=copyright_year) | to_nice_yaml -}}