Copier + Jinja template-repository design skill: reference architecture, implementation workflow, validation checklist, and a full worked example template (questionnaire, extensions, resolvers, wrapper-first .scripts). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
34 lines
901 B
Bash
34 lines
901 B
Bash
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
_copier_bootstrap_one() {
|
|
[ -z "${HL_V1_COPIER_TARGET_DIR}" ] && {
|
|
echo "--copier-target-dir is required"
|
|
return 1
|
|
}
|
|
|
|
_copier_answers_new_ensure_existence
|
|
_copier_answers_previous_pull_and_merge
|
|
_copier_answers_params_pull_and_merge
|
|
|
|
if [ "${HL_V1_COPIER_FORCE_COPY}" = "true" ]; then
|
|
copier copy \
|
|
--trust \
|
|
--force \
|
|
--overwrite \
|
|
--data-file "${HL_V1_COPIER_FILE_COPIER_ANSWERS_NEW}" \
|
|
. "${HL_V1_COPIER_TARGET_DIR}"
|
|
else
|
|
copier copy \
|
|
--trust \
|
|
--data-file "${HL_V1_COPIER_FILE_COPIER_ANSWERS_NEW}" \
|
|
. "${HL_V1_COPIER_TARGET_DIR}"
|
|
fi
|
|
|
|
# Keep template repo CI separate from rendered repo CI, same pattern as source repos.
|
|
if [ -f "${HL_V1_COPIER_TARGET_DIR}/.tmp-gitlab-ci.yml" ]; then
|
|
mv "${HL_V1_COPIER_TARGET_DIR}/.tmp-gitlab-ci.yml" "${HL_V1_COPIER_TARGET_DIR}/.gitlab-ci.yml"
|
|
fi
|
|
}
|