Replies: 2 comments 8 replies
|
Composition using tasks is an experimental idea with some known quirks, it's not officially supported by Copier. With the following changes, your specific example will work: - when: "{{ _copier_operation == 'copy' }}"
command: uvx copier copy --trust -r HEAD ../C subprojectC
- - when: "{{ _copier_operation == 'update' }}"
- command: |
- echo "Current directory: $PWD"
- echo "_folder_name is: {{_folder_name}}"
- - when: "{{ _copier_operation == 'update' }}"
- command: uvx copier update -r HEAD --trust subprojectB
- - when: "{{ _copier_operation == 'update' }}"
- command: uvx copier update -r HEAD --trust subprojectC
+_migrations:
+ - command: |
+ echo "Current directory: $PWD"
+ echo "_folder_name is: {{_folder_name}}"
+ # Commit changes from updating to A's new version.
+ - command: |
+ git add .
+ git commit -m "update A"
+ - command: |
+ uvx copier update -r HEAD --trust subprojectB
+ git add .
+ git commit -m "update subprojectB"
+ - command: |
+ uvx copier update -r HEAD --trust subprojectC
+ git add .
+ git commit -m "update subprojectC"
EOT
# Commit each template into its own respective repositoryHow is this different?
While this modified demo script works, a few problems with this approach are revealed:
If Copier supported this kind of template composition natively, it might be possible to interrupt the update process upon merge conflicts, allow the user to resolve them, and then resume the update process – similar to how, e.g., /cc @francesco086 |
Uh oh!
There was an error while loading. Please reload this page.
I am attempting to generate a single project using sub-templates, aka "composition" as described in #934 . However, I don't see how to make this work as things stand, and believe me, I've been trying! (Maybe this discussion can lead to the sorely-needed content over here?)
Consider:
Below is a bash script to test this pattern. This seems like it should work... Each of the three directories is generated from a different, disjoint template, and each directory has a distinct
.copier-answers.ymlfile in it that refers to the source template. Socopyseems to work fine. During that part of the script you'll see output that looks like this:However, during the
updateoperation, the working directory is not the same, and you will see an error like:The docs say the default value for
working_directoryshould be the destination directory. So why do I see this_folder_name? Shouldn't this be working?The test script is below.
All reactions