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

babel-plugin-glamorous-to-emotion

v1.2.0

Published

A codemod to migrate existing React or Preact codebases from glamorous to emotion.

Downloads

72

Readme

💄 glamorous → 👩‍🎤 emotion

This codemod was created to help migrate an existing React or Preact codebase from glamorous to emotion in light of this issue on glamorous.

Here's a demo of the codemod in action. The upper-left quadrant is glamorous code, the lower-right quadrant is the transformed code.

Features

This codemod follows the glamorous to emotion migration guide on the glamorous repo. Particularly, it rewrites the following:

  • ✅ All import statements, including ThemeProvider inclusion.
  • ✅ All glamorous function calls to emotion function calls.
  • ✅ The content property to be emotion friendly.

Usage

You'll need to use babel-codemod to apply this codemod to your existing codebase. It should be pretty straightforward:

  • First, install this plugin: yarn add babel-plugin-glamorous-to-emotion -D

  • Then run it: npx babel-codemod --plugin babel-plugin-glamorous-to-emotion "src/**/*.js" or a similar variation depending on your directory structure.

This will put you fully in emotion-land.

Options

You may also pass a --plugin-options argument to the babel-codemod command. Here's a sample call:

npx babel-codemod --plugin babel-plugin-glamorous-to-emotion --plugin-options glamorousToEmotion='{"withBabelPlugin": true}' src/**/*.js
  • withBabelPlugin

    Tells the plugin that your emotion setup includes the emotion-babel-plugin. Without this option, <glamorous.Div marginTop={5}/> gets translated to <div className={css({marginTop: 5})}>.

    If this option is enabled, it will be transformed to <div css={{marginTop: 5}}>.

  • preact

    Uses import styled from "preact-emotion" instead of import styled from "react-emotion"

Contributing

ALL CONTRIBUTIONS WELCOME!

I sincerely hope it helps you migrate your codebase! Please open issues for areas where it doesn't quite help and we'll sort it out.

Acknowledgements

The following people are awesome for their open source work and should be acknowledged as such.