copier-org / copier

Library and command-line utility for rendering projects templates.

Home Page:https://readthedocs.org/projects/copier/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add template preview

bswck opened this issue · comments

Actual Situation

During developing my pretty advanced template, when I want to check how my update will render in the downstream projects, I usually:

  • commit my change,
  • push it (up to some point I did push to a dev branch, but it became exhausting),
  • open a special downstream project (lucky if I have skeleton and downstream open in one workspace, but it's still pretty hard to work with),
  • poe bump (wrapper around copier update)
  • see what needs fix,
  • open back the skeleton project,
  • commit my fix,
  • push it...

I know I can update from a template in a directory that is locally in my filesystem, but it would conflict with my poe bump command that not only is configured to pull changes from the skeleton repository on GitHub, but also automatically makes a commit.

And this is a pretty messy workflow and it definitely shouldn't be like that.

Desired Situation

I can easily inspect how my copier template renders as I am developing it, ideally with hot-reloading.

Proposed solution

A browser-based or IDE-based GUI for previewing a template that is made in a temporary directory as the developer makes changes with hot-reloading (I suggest watchfiles).
My goal would be getting a DX like when writing a React application.

I've been doing snapshot-based testing based on ctt. I think that's gonna work for you, so let me close this. You can keep the discussion or reopen later otherwise. Thanks!

Thank you for recommending the right tool. Mind referencing it in the documentation, so others can find it quickly? Maybe in the FAQ? A proper annotation can be made to inform that the copier tester is not maintained by copier maintainers; just similarly to how Python docs reference some outside-CPython projects for solutions to some complex problems, like in the AST reference.

@yajo Pinging as I don't know if you were notified on this.

Mind referencing it in the documentation, so others can find it quickly? Maybe in the FAQ?

Makes sense indeed.