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

Version Packages (next) #58

Merged
merged 1 commit into from
Dec 25, 2023
Merged

Version Packages (next) #58

merged 1 commit into from
Dec 25, 2023

Conversation

github-actions[bot]
Copy link
Contributor

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

main is currently in pre mode so this branch has prereleases rather than normal releases. If you want to exit prereleases, run changeset pre exit on main.

⚠️⚠️⚠️⚠️⚠️⚠️

Releases

@tabula/[email protected]

Major Changes

Minor Changes

  • #57 d3c40d7 Thanks @demiazz! - added support of transformation of SVG component name with svgrComponentName option.

    By default, SVGR uses Svg<CamelCaseFileName> name for components. You can override this behaviour through
    svgrComponentName options, which should be function of format (svgrName: string) => string.

    Example:

    export default {
      // ...
      svgrComponentName(name) {
        return `Ui${name.slice(3)}Icon`;
      },
      // ...
    };

    If you have a file column.svg then component name is SvgColumn by default. But with config from about the name
    will be UiColumnIcon.

    If you use memoization it looks like:

    import { memo } from "react";
    
    const UiColumnIcon = (props) => {
      // ...
    };
    
    const Memo = memo(UiColumnIcon);
    
    export { Memo as ReactComponent };

    This option doesn't affect named exports.

  • #57 d3c40d7 Thanks @demiazz! - allow to append displayName for SVGR components.

    By default, SVGR doesn't append displayName for exported components. You can add this behaviour through svgrDisplayName
    option, which should be function of format (componentName: string) => string | { displayName: string; isDebugOnly?: boolean }.

    When function is returns string, then isDebugOnly equals to false.

    The componentName is name of component itself (before memoization if enabled). If you provide svgrComponentName option,
    then result of applying this function is componentName.

    The isDebugOnly enables wrapping the assignment in Vite compatible condition.

    // `isDebugOnly` = false
    
    Component.displayName = "scope(ComponentDisplayName)";
    
    // `isDebugOnly` = true
    
    if (import.meta.env.DEV) {
      Component.displayName = `scope(ComponentDisplayName)`;
    }

    If memoization is enabled, then the displayName will be assigned to the memoized component:

    const Component = (props) => {
      // ...
    };
    
    const Memo = memo(Component);
    
    Memo.displayName = `scope(ComponentDisplayName)`;

Patch Changes

@demiazz demiazz merged commit e1cd2c8 into main Dec 25, 2023
@demiazz demiazz deleted the changeset-release/main branch December 25, 2023 16:42
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.

1 participant