1.1.8 • Published 1 day ago

@mux/mux-elements-codemod v1.1.8

Weekly downloads
-
License
MIT
Repository
github
Last release
1 day ago

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
1.1.8

6 months ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago