Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 108 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,135 @@
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/hypermod-io/hypermod-community/assets/3030010/f4ec415a-b320-4949-b352-0be9b1666f97">
<source media="(prefers-color-scheme: light)" srcset="https://github.com/hypermod-io/hypermod-community/assets/3030010/9deed89f-1b24-4914-8007-74551abf40b2">
<img alt="Hypermod – App repository banner" src="https://github.com/hypermod-io/hypermod-community/assets/3030010/9deed89f-1b24-4914-8007-74551abf40b2">
<img alt="Hypermod Community banner" src="https://github.com/hypermod-io/hypermod-community/assets/3030010/9deed89f-1b24-4914-8007-74551abf40b2">
</picture>

# Hypermod Community

**Formerly: CodeshiftCommunity**
Hypermod Community is the open-source codemod registry and CLI ecosystem for [Hypermod.io](https://www.hypermod.io/).
Use this repository to discover, author, test, publish, and contribute codemods; use Hypermod.io to explore codemods, learn migration workflows, and promote safer package upgrades at scale.

The community-owned global registry and documentation hub for codemods. Providing library maintainers & users with facilities to help write, test, publish and consume codemods in a structured, standardized and familiar way.
[Explore Hypermod.io](https://www.hypermod.io/) •
[Browse codemods](https://www.hypermod.io/explore) •
[Read the docs](https://www.hypermod.io/docs) •
[Join Discord](https://discord.gg/XGqmKNZ8Rk)

[💬 Join our community on Discord](https://discord.gg/XGqmKNZ8Rk)
## Why this project exists

## Features
Upgrading dependencies is expensive when maintainers only ship changelogs and users are left to translate breaking changes by hand.
Hypermod helps library maintainers, platform teams, design-system teams, and migration owners turn breaking API changes into repeatable codemods that can be shared with the wider ecosystem and used by agents.

🔭 Explore an extensive list of codemods [contributed by the community](https://www.hypermod.io/explore).
This repository is the community-facing home for that workflow:

🧠 Up-skill your engineering team using our [guides & resources](https://www.hypermod.io/docs/guides/your-first-codemod).
- **Community codemod registry** for versioned and reusable codemods.
- **CLI packages** for running codemods locally, from npm, or from Hypermod.io-hosted sources.
- **Authoring utilities** for creating, validating, and testing codemod packages.
- **Examples and templates** that make it easier to ship migrations users can actually adopt.

🎨 Perfect for [Design Systems & Monorepos](https://www.hypermod.io/docs/local-development/monorepos).
## How Hypermod Community and Hypermod.io fit together

## Registry
- **Hypermod.io** is the orchestration and discovery layer: explore codemods, generate codemods, deploy migrations across repositories, and access hosted Hypermod experiences.
- **`@hypermod/cli`** is the command-line entry point for running codemods in local projects, from npm packages, and from Hypermod.io-powered sources.
- **This repository** is the open-source registry, package monorepo, and contribution surface behind the ecosystem.

[The registry](https://www.hypermod.io/explore) contains all community-contributed codemods, hosted and published directly from the Hypermod Platform.
## Get started with the CLI

## CLI
We recommend using the CLI with `npx` so you always run the latest version:

Downloading and running codemods as well as initialising and maintaining codemod packages can all be done via the Hypermod CLI (`@hypermod/cli`).
```bash
npx @hypermod/cli --packages react@18.0.0 ./src

Choose a reason for hiding this comment

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

P2 Badge Replace the React version example with a runnable command

The new quick-start example --packages react@18.0.0 will fail in this CLI: packages/cli/src/resolvers/npm.ts:49-60 rejects any version that is not present in config.transforms, and community/react/src/hypermod.config.js:1-16 exposes no versioned transforms for react at all (only presets). As written, a user following the first README command will get an "Unable to resolve version 18.0.0" error instead of a successful migration.

Useful? React with 👍 / 👎.

```

[Please see the docs for more information and examples](https://www.hypermod.io/docs/tools/cli)
You can also install it globally:

We recommend running the CLI with `$ npx` to ensure you always have the latest version.
```bash
npm install -g @hypermod/cli
# or
yarn global add @hypermod/cli
```

`$ npx @hypermod/cli --packages mylib@1.0.0 /project/src`
Then run it with either binary:

But it can also be installed globally:
```bash
hypermod --help
# or
hypermod-cli --help
```

`$ npm install -g @hypermod/cli or yarn global add @hypermod/cli`
### Common usage examples

and run with:
#### Run a package migration from npm/community codemods

`$ hypermod or $ hypermod-cli`
```bash
npx @hypermod/cli --packages @atlaskit/button@3.0.0 ./src
```

#### Run all transforms from a version to latest

```bash
npx @hypermod/cli --sequence --packages @mylib/button@3.0.0 ./src
```

#### Run a preset

```bash
npx @hypermod/cli --packages @mylib/button#remove-deprecated-props ./src
```

#### Run a local transform file

```bash
npx @hypermod/cli --transform ./codemods/rename-imports/transform.ts ./src
```

#### Browse available codemods for packages

```bash
npx @hypermod/cli list react @atlaskit/button
```

#### Initialize a new codemod package

```bash
npx @hypermod/cli init --transform 1.0.0 my-codemod-package
```

#### Validate a codemod package

```bash
npx @hypermod/cli validate ./community/my-package
```

## What the CLI supports

`@hypermod/cli` is built for real migration workflows, not just one-off transforms.

- Run codemods from **local transform files**.
- Resolve codemods from **npm packages** and the **community registry**.
- Run **versioned transforms in sequence** for safer upgrades.
- Run **presets** for utility codemods that are not tied to a semver milestone.
- Initialize and validate codemod packages for maintainers and contributors.
- Access Hypermod.io-powered transform sources through the same CLI surface.

For the latest product docs and guides, visit [hypermod.io/docs](https://www.hypermod.io/docs).

## Who this is for

- **Library maintainers** who want to ship upgrades users can actually adopt.
- **Platform and infra teams** performing large-scale migrations across many repositories.
- **Design-system teams** managing frequent component API changes.
- **Application teams** that want safer, faster JavaScript and TypeScript refactors.

## Contributing codemods

Community codemods live in the [`community/`](./community) directory and are published as packages that can be discovered and run through the Hypermod ecosystem.

Useful starting points:

- Browse the community packages in [`community/`](./community)
- Inspect the CLI in [`packages/cli`](./packages/cli)
- Use the package template in [`packages/initializer/template`](./packages/initializer/template)
- Explore product docs on [Hypermod.io](https://www.hypermod.io/docs)

## Used by

Expand Down
4 changes: 2 additions & 2 deletions community/@atlaskit__breadcrumbs/src/11.0.0/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function transformer(
* It is often good practice to exit early and return the original source file
* if it does not contain code relevant to the codemod.
* See this page for more information:
* https://codeshiftcommunity.github.io/CodeshiftCommunity/docs/your-first-codemod#output
* https://www.hypermod.io/docs/guides/your-first-codemod
*/
if (!hasImportDeclaration(j, source, '@atlaskit/breadcrumbs')) {
return fileInfo.source;
Expand All @@ -31,7 +31,7 @@ export default function transformer(
* consider grouping specific actions into 'motions' and running them in sequence
*
* See this page for more information:
* https://codeshiftcommunity.github.io/CodeshiftCommunity/docs/authoring#motions
* https://www.hypermod.io/docs
*/
applyMotions(j, source, [
removeHasSeparator,
Expand Down
2 changes: 1 addition & 1 deletion community/@atlaskit__popper/src/5.0.0/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function transformer(
* It is often good practice to exit early and return the original source file
* if it does not contain code relevant to the codemod.
* See this page for more information:
* https://codeshiftcommunity.github.io/CodeshiftCommunity/docs/your-first-codemod#output
* https://www.hypermod.io/docs/guides/your-first-codemod
*/
if (!hasImportDeclaration(j, source, '@atlaskit/popper')) {
return fileInfo.source;
Expand Down
2 changes: 1 addition & 1 deletion community/@atlaskit__tag/src/11.0.0/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function transformer(
* It is often good practice to exit early and return the original source file
* if it does not contain code relevant to the codemod.
* See this page for more information:
* https://codeshiftcommunity.github.io/CodeshiftCommunity/docs/your-first-codemod#output
* https://www.hypermod.io/docs/guides/your-first-codemod
*/
if (!hasImportDeclaration(j, source, '@atlaskit/tag')) {
return fileInfo.source;
Expand Down
2 changes: 1 addition & 1 deletion community/@atlaskit__toggle/src/11.0.0/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default function transformer(
* It is often good practice to exit early and return the original source file
* if it does not contain code relevant to the codemod.
* See this page for more information:
* https://codeshiftcommunity.github.io/CodeshiftCommunity/docs/your-first-codemod#output
* https://www.hypermod.io/docs/guides/your-first-codemod
*/
if (!hasImportDeclaration(j, source, '@atlaskit/toggle')) {
return fileInfo.source;
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
"license": "MIT",
"private": true,
"scripts": {
"predocs:start": "ts-node scripts/docs",
"docs:start": "cd website && yarn start",
"postinstall": "yarn monorepo:fix && yarn monorepo:check",
"build": "yarn build:pkgs && yarn build:community",
"build:pkgs": "tsc --build tsconfig.packages.json",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli-alias/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# @codeshift/cli

**THIS PACKAGE IS DEPRECATED IN FAVOUR OF [@hypermod/cli](https://www.codeshiftcommunity.com/docs/cli)**
**THIS PACKAGE IS DEPRECATED IN FAVOUR OF [@hypermod/cli](https://www.hypermod.io/docs)**

No API changes were performed as part of this change, use `@hypermod/cli` as a direct replacement the package has simply been renamed.

Expand Down
82 changes: 74 additions & 8 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,80 @@
# @hypermod/cli

To download and run codemods, we provide a CLI tool called @hypermod/cli.
`@hypermod/cli` is the command-line interface for running codemods from local files, npm packages, the Hypermod community registry, and Hypermod.io-powered sources.

`@hypermod/cli` is responsible for running the provided transform against your entire codebase. Under the hood, it is a wrapper of jscodeshift's CLI, which provides additional functionality.
It builds on top of `jscodeshift` and adds workflow features needed for real package migrations:

- Ability to run community codemods hosted on npm
- Runs versioned codemods in sequence
- Always runs the latest version of a codemod
- The CLI allows you to run transforms either from the the [public registry](https://www.codeshiftcommunity.com/docs/registry) or on your local machine as per the original implementation of jscodeshift
- Run codemods from local transform files.
- Resolve codemods from npm packages and the community registry.
- Run versioned codemods in sequence.
- Run presets using the same package addressing format.
- Initialize and validate codemod packages.
- Use the same CLI surface for Hypermod.io-powered transforms.

_Note:_ Codemods are designed to do the heavy lifting, but they may not be perfect, so some manual work may still be required in order to successfully migrate.
> Codemods are designed to do the heavy lifting, but some manual review may still be required after running a migration.

[Documentation](https://www.codeshiftcommunity.com/docs/cli)
## Install

Use `npx` for the latest version:

```bash
npx @hypermod/cli --help
```

Or install globally:

```bash
npm install -g @hypermod/cli
# or
yarn global add @hypermod/cli
```

## Usage

### Run a package migration

```bash
npx @hypermod/cli --packages react@18.0.0 ./src
```

### Run all transforms since a version

```bash
npx @hypermod/cli --sequence --packages @mylib/button@3.0.0 ./src
```

### Run a preset

```bash
npx @hypermod/cli --packages @mylib/button#remove-deprecated-props ./src
```

### Run a local transform

```bash
npx @hypermod/cli --transform ./codemods/rename-imports/transform.ts ./src
```

### List available codemods

```bash
npx @hypermod/cli list react @atlaskit/button
```

### Initialize a new codemod package

```bash
npx @hypermod/cli init --transform 1.0.0 my-codemod-package
```

### Validate a codemod package

```bash
npx @hypermod/cli validate ./community/my-package
```

## Learn more

- Product and docs: [hypermod.io/docs](https://www.hypermod.io/docs)
- Explore codemods: [hypermod.io/explore](https://www.hypermod.io/explore)
- Repository: [hypermod-community](https://github.com/hypermod-io/hypermod-community)
10 changes: 5 additions & 5 deletions packages/initializer/template/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# <% packageName %>

This project was bootstrapped with [Hypermod 🚚](https://www.codeshiftcommunity.com/). Please see the [external packages guide](https://www.codeshiftcommunity.com/docs/external-packages) for more information on how to work with this repo.
This project was bootstrapped with [Hypermod 🚚](https://www.hypermod.io/). Please see the [Hypermod docs](https://www.hypermod.io/docs) for more information on how to work with this repo.

![Hypermod logo](https://www.codeshiftcommunity.com/img/logo.svg)
![Hypermod logo](https://www.hypermod.io/img/logo.svg)

## Scripts

Expand All @@ -14,19 +14,19 @@ Runs the Hypermod CLI useful for testing transform files as if they have been pu

Alternatively, you can run `npm run dev` to see an interactive list of codemods to choose from.

See the [cli reference](https://www.codeshiftcommunity.com/docs/cli) for more information.
See the [CLI docs](https://www.hypermod.io/docs) for more information.

### `npm run test`

Launches the test runner in interactive watch mode.

See the [testing guide](https://www.codeshiftcommunity.com/docs/testing) for more information.
See the [testing guide](https://www.hypermod.io/docs) for more information.

### `npm run validate`

Checks the validity of your `hypermod.config.js` file.

See the [configuration options](https://www.codeshiftcommunity.com/docs/configuration) for more information.
See the [configuration docs](https://www.hypermod.io/docs) for more information.

### `npm run build`

Expand Down
4 changes: 2 additions & 2 deletions packages/initializer/template/codemods/codemod/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function transformer(
* It is often good practice to exit early and return the original source file
* if it does not contain code relevant to the codemod.
* See this page for more information:
* https://codeshiftcommunity.github.io/CodeshiftCommunity/docs/your-first-codemod#output
* https://www.hypermod.io/docs/guides/your-first-codemod
*/
if (/* Some condition here */ true) {
return file.source;
Expand All @@ -26,7 +26,7 @@ export default function transformer(
* consider grouping specific actions into 'motions' and running them in sequence
*
* See this page for more information:
* https://codeshiftcommunity.github.io/CodeshiftCommunity/docs/authoring#motions
* https://www.hypermod.io/docs
*/
source.findVariableDeclarators('foo').renameTo('bar');

Expand Down
2 changes: 1 addition & 1 deletion packages/utils/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# @hypermod/utils

[Documentation](https://www.codeshiftcommunity.com/docs/utils)
[Documentation](https://www.hypermod.io/docs)
Loading
Loading