Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swizzle --patch #5734

Open
Josh-Cena opened this issue Oct 18, 2021 · 1 comment
Open

swizzle --patch #5734

Josh-Cena opened this issue Oct 18, 2021 · 1 comment
Labels
difficulty: advanced Issues that are complex, e.g. large scoping for long-term maintainability. proposal This issue is a proposal, usually non-trivial change
Milestone

Comments

@Josh-Cena
Copy link
Collaborator

💥 Proposal

We can make swizzle something similar to yarn patch: it lets you change a file and only records the diff. During an upgrade, if there's a "merge conflict", it asks you to reswizzle the component.

I have no idea how heavy the implementation would be on our side, or if there are packages we can use

Have you read the Contributing Guidelines on issues?

Yes

@Josh-Cena Josh-Cena added status: needs triage This issue has not been triaged by maintainers proposal This issue is a proposal, usually non-trivial change labels Oct 18, 2021
@slorber
Copy link
Collaborator

slorber commented Oct 19, 2021

Hey

As part of #5380, I'd like to encourage swizzle --wrap for most use-cases instead of swizzle --copy (ie current behavior).

I'm trying to see with Facebook how to handle versioning once v2.0 is released:

  • It's likely that we'll respect semver, but at the same time we don't want to increase major to Docusaurus v15 very fast
  • I think we can respect semver for --wrap, maintaining public API surface compatibility on existing theme components
  • We may need to consider --copy as a non-public API surface (ie you are on your own). I suggested we could bump the minor version (v2.1) on such internal theme breaking changes.

Even if --copy wouldn't be the recommended thing to do, we'll still need to reduce annoying updates for our users.

For now, I think we should focus on shipping swizzle --wrap and a good, explicit theme public API,


We'll figure out tooling to support swizzle --copy better later.

An idea is to build a web tool to help users upgrade their theme components highlighting the theme changes for convenient backporting, similar to the React-Native upgrade-helper website:
https://react-native-community.github.io/upgrade-helper/?from=0.62.0&to=0.67.0-rc.0

I was also thinking about providing a patch system, a bit different than yours:

  • store the version at which the theme file was copied (like, in a file comment: // version: 2.1.3)
  • have a cli like docusaurus swizzle upgrade-copy theme-classic theme/NavBar: Docusaurus would compute a diff from 2.1.3 to current version and attempt to apply a patch automatically

@Josh-Cena Josh-Cena changed the title swizzle --diff swizzle --patch Oct 24, 2021
@Josh-Cena Josh-Cena removed the status: needs triage This issue has not been triaged by maintainers label Oct 29, 2021
@Josh-Cena Josh-Cena added the difficulty: advanced Issues that are complex, e.g. large scoping for long-term maintainability. label Dec 15, 2021
@Josh-Cena Josh-Cena added this to the 2.x milestone Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: advanced Issues that are complex, e.g. large scoping for long-term maintainability. proposal This issue is a proposal, usually non-trivial change
Projects
None yet
Development

No branches or pull requests

2 participants