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

Create codemod to migrate colors to css variables #363

Merged
merged 9 commits into from
Aug 29, 2023
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ assets/
fixtures/

src/icons/

src/codemods/
68 changes: 0 additions & 68 deletions codemods/v2.ts

This file was deleted.

38 changes: 24 additions & 14 deletions docs/migrating.storybook.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,7 @@ import { Meta } from '@storybook/blocks';

# Migrating

Migrating from one major version to the next with ease.

## From v1 to v2

A codemod exists to upgrade your components for this version.

```bash
npx jscodeshift -t node_modules/@freenow/wave/codemods/v2.ts path/to/src
```

### Button and TextButton

The `block` property used to act as a shortcut to give the button components a width of 100%. In the future, use the `width` property
directly. It uses the styled-system variable, which is a lot more flexible than just the boolean flag.
Migrate to the next Wave major version with ease.

## Codemods

Expand All @@ -28,3 +15,26 @@ previous major versions first. Beware that codemods are not 100% fool-proof and

If you're working in a typescript environment, you need to add `--parser=tsx` to the command in each codemod command to
allow jscodeshift to parse your typescript/jsx files.

## From v1 to v2

Two codemods exist to upgrade your components for version 2. In order to apply the transformations in your project you simply need to run the
command for your desired codemod pointing to your project's source path.

### Button and TextButton block property

The `block` property used to act as a shortcut to give the button components a width of 100%. In the future, use the `width` property
directly. It uses the styled-system variable, which is a lot more flexible than just the boolean flag.

```bash
npx jscodeshift -t node_modules/@freenow/wave/lib/cjs/codemods/block-to-width-100.js path/to/src
```

### Colors to CSS variables

Our theme colors structure has changed significantly in this major. In order to use Wave colors in your project you should now use the CSS variables
that our theme brings.

```bash
npx jscodeshift -t node_modules/@freenow/wave/lib/cjs/codemods/colors-to-css-vars.js path/to/src
```
Loading
Loading