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

feat(PPDSC-1958): stop exporting emotion icons #281

Merged
merged 29 commits into from
Jul 26, 2022

Conversation

mutebg
Copy link
Contributor

@mutebg mutebg commented Jul 14, 2022

PPDSC-1958

What

  1. Background - newskit will not want to maintain list the list of icons
  2. What did you do: stopped exporting all emotion icons, so we will have only the icons which are used internally;
    • updated all scripts and documentation
    • stoped exporting icons from newskit package, we export only helper functions
    • wrote a codemod to transform newskit to emotion icons
    • used the codemod to transform our docs website so it does not depend on newskit icons anymore
  3. What does the reviewers should expect

I have done:

  • Written unit tests against changes
  • Written functional tests against the component and/or NewsKit site
  • Updated relevant documentation

I have tested manually:

  • The feature's functionality is working as expected on Chrome, Firefox, Safari and Edge
  • The screen reader reads and flows through the elements as expected.
  • There are no new errors in the browser console coming from this PR.
  • When visual test is not added, it renders correctly on different browsers and mobile viewports (Safari, Firefox, small mobile viewport, tablet)
  • The Playground feature is working as expected

Before:

After:

Who should review this PR:

How to test:

@github-actions github-actions bot added the feature This change contains a new feature label Jul 14, 2022
@mutebg mutebg added the ready for review Please assist in getting this reviewed label Jul 20, 2022
@mutebg mutebg marked this pull request as ready for review July 20, 2022 07:38
Comment on lines +27 to +36
export {
/* istanbul ignore next */
Svg,
/* istanbul ignore next */
toNewsKitIcon,
/* istanbul ignore next */
customToNewsKitIcon,
/* istanbul ignore next */
IndeterminateProgressIndicator,
} from './icons';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any ideas on how to fix this Istanbul coverage?

Copy link
Contributor

@Xin00163 Xin00163 left a comment

Choose a reason for hiding this comment

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

```

```sh
npx @newskit/codemod emotion-icons <path>
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we give some hints about the path?

const transform = require('../../emotion-icons');
const {readFile} = require('../utils');

function read(fileName) {
Copy link
Contributor

Choose a reason for hiding this comment

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

is it worth moving this to utils?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

its worth, but not possible, moving it to another file __dirname will return different value


```diff
- import { IconFilledAccountTree } from 'newskit';
+ import {AccountTree as AccountTreeFilled} from '@emotion-icons/material/AccountTree';
Copy link
Contributor

Choose a reason for hiding this comment

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

Icon has the convention of Icon {Set} {Name}. To make it consistent, shall we follow {set} {name} for renaming, so it will be FilledAccountTree?

<Code>
{`
import {toNewsKitIcon} from 'newskit';
import {AccountTree} from '@emotion-icons/material/AccountTree';
Copy link
Contributor

Choose a reason for hiding this comment

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

It's AccountTreeFilled in the other example. If we were to follow the convention, it should be FilledAccountTree

IconFilledYoutube,
IconFilledFigma,
} from 'newskit';
import {IconFilledFacebook} from '../../components/icons/icon-filled-facebook.tsx';
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we importing those?

@mutebg mutebg requested a review from Xin00163 July 26, 2022 09:16
```diff
- import { IconFilledAccountTree } from 'newskit';
+ import {AccountTree as FilledAccountTree} from '@emotion-icons/material/AccountTree';
+ const IconFilledAccountTree = toNewsKitIcon(FilledAccountTree);
Copy link
Contributor

Choose a reason for hiding this comment

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

Also need an import for toNewsKitIcon?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -26,3 +26,25 @@ Link this package in your global `node_modules` by running:
cd lib/codemod
yarn link
Copy link
Contributor

Choose a reason for hiding this comment

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

We need a yarn step here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -26,3 +26,25 @@ Link this package in your global `node_modules` by running:
cd lib/codemod
yarn link
```
Copy link
Contributor

Choose a reason for hiding this comment

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

Add the run command for a local codemod: newskit-codemod [codemod] [paths]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@mutebg mutebg requested a review from mstuartf July 26, 2022 13:09
@mutebg mutebg merged commit 38a86b4 into main Jul 26, 2022
@mutebg mutebg deleted the feat/PPDSC-1958-stop-exporting-emotion-icons branch July 26, 2022 15:38
Xin00163 pushed a commit that referenced this pull request Oct 17, 2022
* feat(PPDSC-1958): update emotion icons

* feat(PPDSC-1958): update docs

* feat(PPDSC-1958): do not export icons

* feat(PPDSC-1958): update tests

* feat(PPDSC-1958): add codemode for emotion-icons

* feat(PPDSC-1958): add icons

* feat(PPDSC-1958): fix tests

* feat(PPDSC-1958): update snapshots

* feat(PPDSC-1958): fix unit tests

* feat(PPDSC-1958): linting

* feat(PPDSC-1958): updatae codemod readme

* feat(PPDSC-1958): update docs

* feat(PPDSC-1958): fix stories

* feat(PPDSC-1958): fix typo

* feat(PPDSC-1958): clean

* feat(PPDSC-1958): adjust codemod

* feat(PPDSC-1958): fix icons names

* feat(PPDSC-1958): cleanup

* feat(PPDSC-1958): jest test

* feat(PPDSC-1958): debug jest

* feat(PPDSC-1958): reverse changes

* feat(PPDSC-1958): update docs

* feat(PPDSC-1958): update codemod readme

* feat(PPDSC-1958): update readme
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change feature This change contains a new feature ready for review Please assist in getting this reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants