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

@mux/mux-elements-codemod

v1.1.10

Published

A codemod to transform @mux-elements scope imports into @mux scope imports

Downloads

2,625

Readme

Introduction

mux-elements-codemod is a CLI app to help run various migrations or codemods on users who use any of the mux elements.

Usage

Easiest way to use it is via npx which ships with npm:

npx @mux/mux-elements-codemod

Alternatively, install it globally with npm or yarn

npm install --global @mux/mux-elements-codemod
mux-elements-codemod

By default, it will run in dry-run mode, so, you don't have to worry about it changing your files. Pass in --force for it to change any file.

command usage

$ mux-elements-codemod --help

$ mux-elements-codemod [OPTIONS] [paths ...]
$ mux-elements-codemod [--help|-h]

paths can be regular globbed items or a list of folders
The default path is ./

Examples:
$ mux-elements-codemod -i ./packages ./examples
$ mux-elements-codemod --imports ./packages
$ mux-elements-codemod --imports ./examples/**/*.tsx
$ mux-elements-codemod --extensions="tsx jsx" --imports ./examples/
$ mux-elements-codemod -e="tsx jsx" --imports ./examples/ --ignore .next --ignore dist

Options:
  -i --imports      update imports/requires scope from @mux-elements to @mux
     --ignore       Add a name to ignore in the files, multiples can be provided
  -e --extensions   specifiy the specific file extensions to use as a space separated string
                    default is "js ts jsx tsx json html mjs cjs"
  -f --force        by default, this does a dry run, run with --force to replace the text inline
  -h --help         show this help

Available codemods

Imports

Currently, the only available codemod is a scope migration script for imports.

It allows you to bulk change multiple imports that use the old scope (@mux-elements) to the new scope (@mux).

$ mux-elements-codemod --imports ./src
Running in dry run mode. The following files will be modified:
src/player.tsx
Before:
	2:import MuxPlayer from "@mux-elements/mux-player-react";
After:
	2:import MuxPlayer from "@mux/mux-player-react";

And then, you can run it with --force to make the replacements inline.

$ mux-elements-codemod --imports ./src --force
Modifying the following files to replace `@mux-elements/` scope with `@mux/`:
src/player.tsx

Package update

This command will allow you to more easily remove the old scoped packages (@mux-elements/) and re-add them via the new scope (@mux).

If the current working directory has a package.json, it will assume it's a module and will update the dependencies. It will assume that yarn is being used when if a yarn.lock is present, otherwise, can be told to use a specific client via --npm client yarn.

$ mux-elements-codemod --package
The following dependencies will be removed and re-added with the updated @mux/ scope:
	 @mux-elements/mux-audio
	 @mux-elements/mux-audio-react
	 @mux-elements/mux-player
	 @mux-elements/mux-player-react
	 @mux-elements/mux-video
	 @mux-elements/mux-video-react

And then you can run it with --force to apply the changes

mux-elements-codemod -p --force
Running yarn remove on @mux-elements/mux-audio @mux-elements/mux-audio-react @mux-elements/mux-player @mux-elements/mux-player-react @mux-elements/mux-video @mux-elements/mux-video-react
yarn remove v1.22.17
[1/7] Removing module @mux-elements/mux-audio...
[2/7] Removing module @mux-elements/mux-audio-react...
[3/7] Removing module @mux-elements/mux-player...
[4/7] Removing module @mux-elements/mux-player-react...
[5/7] Removing module @mux-elements/mux-video...
[6/7] Removing module @mux-elements/mux-video-react...
[7/7] Regenerating lockfile and installing missing dependencies...
success Uninstalled packages.
Done in 0.39s.
Running yarn add on @mux-elements/mux-audio @mux-elements/mux-audio-react @mux-elements/mux-player @mux-elements/mux-player-react @mux-elements/mux-video @mux-elements/mux-video-react
yarn add v1.22.17
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 11 new dependencies.
info Direct dependencies
├─ @mux/[email protected]
├─ @mux/[email protected]
├─ @mux/[email protected]
├─ @mux/[email protected]
├─ @mux/[email protected]
└─ @mux/[email protected]
info All dependencies
├─ @github/[email protected]
├─ @mux/[email protected]
├─ @mux/[email protected]
├─ @mux/[email protected]
├─ @mux/[email protected]
├─ @mux/[email protected]
├─ @mux/[email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
Done in 7.31s.

Replacing @mux-elements scope to @mux in package succeeded successfully! 🎉