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

@newskit/codemod

v7.0.1

Published

You can use this CLI tool to run various scripts (codemods) that will help update NewsKit APIs

Downloads

6

Readme

Codemods for NewsKit

NewsKit provides Codemod transformations to help upgrade your codebase when a component is updated or deprecated.

Codemods are transformations that run on your codebase programmatically. This allows for a large amount of changes to be applied without having to manually go through every file.

Usage

You can run these at the root of your project.

npx @newskit/codemod [codemod] [paths]

run to see all codemods and flags

npx @newskit/codemod --help

v7.0.0

The following transformers are available when upgrading to v7:

audio-player-play-pause-button

There are changes to the default styling of the AudioPlayer component in v7.

Run this codemod if you would like to apply manual overrides to keep the old default styling.

- <AudioPlayerPlayPauseButton />

+ <AudioPlayerPlayPauseButton size="large" />

all-default

Run this codemod if you would like to apply manual overrides to the keep the old default for all components listed above.

replace-space-inset-props-and-overrides

spaceInset prop was marked as deprecated and has now been removed in V7.

Run this codemod if you would like to apply logical props instead.

- <Flag overrides={{spaceInset: "space060"}}>Flag</Flag>

+ <Flag overrides={{paddingBlock: "space060", paddingInline: "space060"}}>Flag</Flag>
- <Block spaceInset="space020" stylePreset="inkContrast">Block</Block>

+ <Block stylePreset="inkContrast" paddingBlock="space020" paddingInline="space020">Block</Block>

popover

The Popover component has a renamed override prop - from distance to offset

The script replace the override prop distance with offset

- <Popover overrides={{distance: 'space020'}>Content</Popover>

+ <Popover overrides={{offset: 'space020'}>Content</Popover>

tooltip

The Tooltip component has a renamed override prop - from distance to offset

The script replace the override prop distance with offset

- <Tooltip overrides={{distance: 'space020'}>Content</Tooltip>

+ <Tooltip overrides={{offset: 'space020'}>Content</Tooltip>

caption-inset

CaptionInset has been removed in favour of Caption. Using this script the same functionality can be achieve by adding paddingBlock and paddingInline as overrides.

- <CaptionInset />

+ <Caption overrides={{paddingBlock:  "space040",  paddingInline: "space040"}} />

v6.0.0

The following transformers are available when upgrading to v6:

emotion-icons

Imports and transform newskit icons to emotion-icons;

- import { IconFilledAccountTree } from 'newskit';
+ import { toNewsKitIcon } from 'newskit';
+ import {AccountTree as FilledAccountTree} from '@emotion-icons/material/AccountTree';
+ const IconFilledAccountTree = toNewsKitIcon(FilledAccountTree);
npx @newskit/codemod v6.0.0/emotion-icons [path]
// example
npx @newskit/codemod v6.0.0/emotion-icons 'components/**/*.+(ts|tsx|js|jsx)'

remove-redundant-marker-ul

Unordered List has now a default marker, removes the prop passing the same icon now set as default.

-  <UnorderedList listItemMarker={IconFilledCircle}>{listData}</UnorderedList>
+  <UnorderedList >{listData}</UnorderedList>

update-list-item-marker-ul-value

Unordered List has now a default marker, the script passes listItemMarker with a value of null to UnorderedList components originally not passing any marker.

-   <UnorderedList></UnorderedList>
+    <UnorderedList listItemMarker={null}></UnorderedList>

enum-to-union

Some of NewsKit components support enum as the prop type, the script remove the imports of enum and replace enum type with union type.

-   <Button size={ButtonSize.Small}>Button</Button>
+   <Button size="small">Button</Button>

update-linkinline

Updates deprecated Link component to LinkInline. LinkInline is used within paragraphs or sentences to link to different content on the same page or other pages.

-  import {Link} from 'newskit';
- <Link href={'www.google.com'}>Click on me</Link>;

+    import {LinkInline} from 'newskit';
+  <LinkInline href={'www.google.com'}>Click on me</LinkInline>;

update-linkstandalone

Updates deprecated Link component to LinkStandalone. LinkStandalone is used outside of body content, for example within navigational components such as menus, headers and footers.

-  import {Link} from 'newskit';
- <Link href={'www.google.com'}>Click on me</Link>;

+    import {LinkStandalone} from 'newskit';
+  <LinkStandalone href={'www.google.com'}>Click on me</LinkStandalone>;

Development

Setup

yarn install

Link

Link this package in your global node_modules by running:

cd lib/codemod
yarn link

Usage

Run the codemod package locally:

newskit-codemod [codemod [path]