npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@channel.io/bezier-codemod

v0.5.0

Published

Codemod transformations to help upgrade app using Bezier design system.

Downloads

4

Readme

Bezier Codemod

Codemod transformations to help upgrade app using Bezier design system.

Usage

In your terminal, navigate into your project's folder, then run:

npx @channel.io/bezier-codemod

Transformations

Icons to Bezier icons

icons-to-bezier-icons

Update the import syntax for the icon source moved from @channel.io/bezier-react to @channel.io/bezier-icons.

For example:

import React from 'react'
import {
  AllIcon,
  Button,
  CheckIcon as CheckIconSource,
  Icon,
  type IconName,
  IconSize,
} from '@channel.io/bezier-react'

import Foo from './foo'

Transforms into:

import React from 'react'
import {
  AllIcon,
  CheckIcon as CheckIconSource,
  type IconName,
} from '@channel.io/bezier-icons'
import { Button, Icon, IconSize } from '@channel.io/bezier-react'

import Foo from './foo'

Enum Member to String Literal

v2-enum-member-to-string-literal

Replace deprecated enum usage to string literal.

For example:

import {
  ProgressBar,
  ProgressBarSize,
  ProgressBarVariant,
} from '@channel.io/bezier-react'

export default () => (
  <ProgressBar
    width="100%"
    size={ProgressBarSize.M}
    variant={ProgressBarVariant.GreenAlt}
    value={uploadProgressPercentage / 100}
  />
)

Transforms into:

import { ProgressBar } from '@channel.io/bezier-react'

export default () => (
  <ProgressBar
    width="100%"
    size="m"
    variant="green-alt"
    value={uploadProgressPercentage / 100}
  />
)

Foundation to CSS Variable

v2-foundation-to-css-variable

Replace foundation to css variable You can also use individual transform function such as foundation-to-css-theme, foundation-to-css-rounding, and so on.

For example:

import { styled } from '@channel.io/bezier-react'

const Wrapper = styled.div`
  color: ${({ foundation }) => foundation?.theme?.['txt-black-dark']};

  ${({ foundation }) => foundation?.rounding.round12};

  ${({ foundation }) =>
    foundation?.border?.getBorder(0.5, foundation.theme['bdr-black-light'], {
      top: false,
      right: false,
      left: false,
    })};

  ${({ foundation }) => foundation?.elevation?.ev1()};

  margin-bottom: ${({ foundation }) => foundation?.spacing.s6};

  ${({ foundation }) => foundation?.transition?.getTransitionsCSS('color')};
`

Transforms into:

import { styled } from '@channel.io/bezier-react'

const Wrapper = styled.div`
  color: var(--txt-black-dark);

  overflow: hidden;
  border-radius: var(--radius-12);

  border-color: var(--bdr-black-light);
  border-style: none none solid none;
  border-width: 0.5px;

  background-color: var(--bg-white-low);
  box-shadow: var(--ev-1);

  margin-bottom: 16px;

  transition: color var(--transition-s);
`

Interpolation to CSS Variable

v2-interpolation-to-css-variable

Replace various interpolation such as Typography, ZIndex, InputWrapperStyle, Rounding to css variable For example:

import {
  styled,
  Typography,
  inputWrapperStyle,
  focusedInputWrapperStyle,
  erroredInputWrapperStyle,
  ZIndex,
  Rounding,
} from '@channel.io/bezier-react'

const Wrapper = styled.div`
  ${Typography.Size11};

  ${inputWrapperStyle};

  ${({ focus }) => focus && focusedInputWrapperStyle};

  ${erroredInputWrapperStyle};

  ${inputPlaceholderStyle};

  z-index: ${ZIndex.Hide};

  ${Rounding.round12};
`

Transforms into:

import { styled } from '@channel.io/bezier-react'

const Wrapper = styled.div`
  /* NOTE: Do not use font-related css variables below separately, use Text component instead */
  font-size: var(--typography-size-11-font-size);
  line-height: var(--typography-size-11-line-height);

  box-shadow: var(--input-box-shadow);

  ${({ focus }) =>
    focus &&
    css`
      box-shadow: var(--input-box-shadow-focused);
    `};

  box-shadow: var(--input-box-shadow-invalid);

  &::placeholder {
    color: var(--txt-black-dark);
  }

  z-index: var(--z-index-hidden);

  overflow: hidden;
  border-radius: var(--radius-12);
`

It also handles when ZIndex is used in object.

import { ZIndex } from '@channel.io/bezier-react'

export const OVERLAY_POSITION1 = {
  zIndex: ZIndex.Modal,
}

Transforms into:

export const OVERLAY_POSITION1 = {
  zIndex: 'var(--z-index-modal)',
}

import directly from styled-components

v2-import-from-bezier-to-styled-components

Switch library to import styled, css, StyleSheetManager, keyframes, createGlobalStyle, ServerStyleSheet object from @channel.io/bezier-react to styled-components For example:

import { styled, Button, css } from '@channel.io/bezier-react'

export const Wrapper = styled(Button)`
  ${css`
    background: red;
  `}
`

Transforms into:

import styled, { css } from 'styled-components'
import { Button } from '@channel.io/bezier-react'

export const Wrapper = styled(Button)`
  ${css`
    background: red;
  `}
`

Add Legacy prefix to components to be deprecated and remove Alpha prefix from experimental components

v2-remove-alpha-from-alpha-components

Components to be deprecated

  • Stack
  • HStack
  • VStack
  • StackItem
  • Spacer

Experimental components

  • AlphaStack
  • AlphaCenter

For example:

import {
  VStack,
  StackItem,
  AlphaStack,
  AlphaCenter,
} from '@channel.io/bezier-react'

function Foo() {
  return (
    <VStack>
      <StackItem>
        <div />
      </StackItem>
      <StackItem>
        <div />
      </StackItem>
    </VStack>
  )
}

function Bar() {
  return (
    <AlphaStack direction="horizontal">
      <div />
      <div />
    </AlphaStack>
  )
}

function Baz() {
  return (
    <AlphaCenter>
      <div />
    </AlphaCenter>
  )
}

Transforms into:

import {
  LegacyVStack,
  LegacyStackItem,
  Stack,
  Center,
} from '@channel.io/bezier-react'

function Foo() {
  return (
    <LegacyVStack>
      <LegacyStackItem>
        <div />
      </LegacyStackItem>
      <LegacyStackItem>
        <div />
      </LegacyStackItem>
    </LegacyVStack>
  )
}

function Bar() {
  return (
    <Stack direction="horizontal">
      <div />
      <div />
    </Stack>
  )
}

function Baz() {
  return (
    <Center>
      <div />
    </Center>
  )
}

Change interface of Text

v2-text-component-interface

Replace Typography enum with string literal and change marginAll property to short.

For example:

import { Text, styled, Typography } from '@channel.io/bezier-react'

function Foo() {
  return (
    <Text
      typo={Typography.Size13}
      marginAll={4}
    >
      title
    </Text>
  )
}

const Title = styled(Text).attrs({
  typo: Typography.Size13,
  marginAll: 4,
})``

Transforms into:

import { Text, styled } from '@channel.io/bezier-react'

function Foo() {
  return (
    <Text
      typo="13"
      margin={4}
    >
      title
    </Text>
  )
}

const Title = styled(Text).attrs({
  typo: '13',
  margin: 4,
})``