ui icon indicating copy to clipboard operation
ui copied to clipboard

diff command and 3-way merge problem

Open gar1t opened this issue 6 months ago • 1 comments

My apologies if this has been covered - I couldn't find a discussion of it in the docs or issues list, but may just be blind.

I'm starting to get into my own component customization and appreciate how straight forward it is!

While I no longer need to find workarounds for modifying component behavior (I just change the code directly, hooray 🎉) I now have a merge problem when upstream components change and I want to apply those changes to my own components. The diff command shows me how my components differ from the upstream versions but, as far as I can tell, it can't show me how the upstream code changed across versions. So, if I want to check for upstream changes, I need to read through the diff and rule out any changes that I've made.

Is there a recommended approach to streamline merges for changes to upstream component defs?

I can imagine an option to diff that says, "show me the difference between the component def I originally installed and the currently available component(s)". E.g. diff --upstream or similar (upstream may not be the right term or may be confusing, consider it a placeholder).

My current approach would be to use git diff <my-version-tag> <latest-version> -- <path-to-component> from the shadcn-ui/ui repo and manually apply them. There's probably a way to finagle git to perform a 3-way merge with the components in my project but my Git-fu is not that strong.

This topic seems fundamental to the approach of copying-and-modifying component defs that I figure folks here could point me in the right direction.

gar1t avatar Dec 16 '23 20:12 gar1t

@gar1t This is actually a great idea. Updating is really painful right now. I am using a different Prettier config and a strict ESLint config which makes the current cli diff command basically useless, even when I make no functional changes to the components.

Being able to compare the version of component from the time of adding with the current version would be great. Also the next time we run compare, it should not compare with the initial version again but rather with the version from the time of the last compare.

This would require the shadcn-ui registry to be versioned and to keep local track of the used versions.

Kamahl19 avatar Dec 27 '23 15:12 Kamahl19

This issue has been automatically closed because it received no activity for a while. If you think it was closed by accident, please leave a comment. Thank you.

shadcn avatar Feb 28 '24 23:02 shadcn