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

Add documentation about upgrading bitstyles versions; add versions showcase dev tool #119

Merged
merged 15 commits into from
Mar 22, 2024

Conversation

angelikatyborska
Copy link
Contributor

This PR adds a document doc/bitstyles_version_compatibility.md, meant for devs developing bitstyles_phoenix. The goal is to make it easier for more people to help upgrade this project to work with newer bitstyles versions.

Additionally, this PR adds a script, scripts/generate_version_showcase.ex. The script generates static pages based on component stories. The static pages provide a preview for each component with each supported bitstyles version. The goal was to have a way to open the same component in different bitstyles versions side by side, so that we can compare the differences. This should make it easier to ensure components do not degrade in older bitstyles versions because of bugs introduced by default version upgrades.

This script is very experimental, the code quality is less than ideal, and it ignores the live/alpine3 components. Still, its output was very helpful for me to understand the bitstyles version changes, so I hope you'll accept it 😇

Screenshot 2024-03-18 at 18 53 32

@angelikatyborska angelikatyborska force-pushed the allow-preview-with-all-bitstyles-versions branch from f2c1b48 to 846e05d Compare March 18, 2024 17:55
@angelikatyborska
Copy link
Contributor Author

I extended the story macro to allow generating expected values per version:

  story(
    "An error tag",
    '''
        iex> assigns = %{}
        ...> render ~H"""
        ...> <.ui_error error={{"Foo error", []}} />
        ...> """
    ''',
    "4.3.0": '''
        """
        <span class="u-fg-warning">
          Foo error
        </span>
        """
    ''',
    "3.0.0": '''
        """
        <span class="u-fg--warning">
          Foo error
        </span>
        """
    '''
  )

This way, we can start accumulating per-version unit tests in the doctests that will give us more confidence when upgrading.

The downside is: the tests are now synchronous. The bitstyles version change happens by setting a global config option, so async tests would override one another.

@andreasknoepfle
Copy link
Member

andreasknoepfle commented Mar 22, 2024

The downside is: the tests are now synchronous. The bitstyles version change happens by setting a global config option, so async tests would override one another.

We could put the override version into the process dict instead. Like this we could still have async test:
https://hexdocs.pm/elixir/1.12.3/Process.html#put/2

Love the syntax btw

@angelikatyborska
Copy link
Contributor Author

The tests are back to asynchronous 😁 I keep forgetting about the process dictionary being available

@andreasknoepfle andreasknoepfle force-pushed the allow-preview-with-all-bitstyles-versions branch from 8de01d9 to 97af8d4 Compare March 22, 2024 12:27
Copy link
Member

@andreasknoepfle andreasknoepfle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💚

@andreasknoepfle andreasknoepfle merged commit 3e5d5e5 into main Mar 22, 2024
2 checks passed
@andreasknoepfle andreasknoepfle deleted the allow-preview-with-all-bitstyles-versions branch March 22, 2024 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants