Skip to content

Commit

Permalink
Added documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ijlee2 committed Jul 9, 2023
1 parent 0c99cfe commit f6b0609
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 2 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,19 @@ _Utilities for writing codemods_

`@codemod-utils` provides a set of **tools and conventions** to help you write codemods.

You can use `@codemod-utils/cli` to create a codemod project.

```sh
npx @codemod-utils/cli --name <your-codemod-name>
```


### Package overview

- [`@codemod-utils/ast-javascript`](/packages/ast/javascript/README.md)
- [`@codemod-utils/ast-template`](/packages/ast/template/README.md)
- [`@codemod-utils/blueprints`](/packages/blueprints/README.md)
- [`@codemod-utils/cli`](/packages/cli/README.md)
- [`@codemod-utils/ember-cli-string`](/packages/ember-cli-string/README.md)
- [`@codemod-utils/files`](/packages/files/README.md)
- [`@codemod-utils/json`](/packages/json/README.md)
Expand Down
85 changes: 84 additions & 1 deletion packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,90 @@

# @codemod-utils/cli

_CLI for @codemod-utils_
_CLI to create a codemod project_


## Usage

Use `npx` to run `@codemod-utils/cli`. (Alternatively, you can install `@codemod-utils/cli` globally.)

```sh
npx @codemod-utils/cli --name <your-codemod-name> <additional arguments>
```

This will create a folder named `<your-codemod-name>`, inside of which you can find the package named `<your-codemod-name>`.

Change the directory, then run these scripts:

```sh
# Set up the project
pnpm install

# Create a GitHub repository
git init
git add .
git commit -m "Initial commit"
git branch -M main
git remote add origin [email protected]:<your-GitHub-handle>/<your-repo-name>.git
git push -u origin main
```


### Arguments

You must pass `--name` to name your codemod.

```sh
npx @codemod-utils/cli --name ember-codemod-v1-to-v2
```


<details>
<summary>Optional: Add <code>@codemod-utils</code> packages</summary>

By default, `@codemod-utils/cli` installs only [`@codemod-utils/files`](../files/README.md) and [`@codemod-utils/tests`](../tests/README.md).

To add more `@codemod-utils` packages and scaffold files, pass `--addon` and a list of package names.

```sh
npx @codemod-utils/cli --addon blueprints
```

The available package names are:

- [`ast-javascript`](../ast/javascript/README.md)
- [`ast-template`](../ast/template/README.md)
- [`blueprints`](../blueprints/README.md)
- [`ember-cli-string`](../ember-cli-string/README.md)
- [`json`](../json/README.md)

</details>


<details>
<summary>Optional: Specify the project root</summary>

Pass `--root` to run the codemod somewhere else (i.e. not in the current directory).

```sh
npx @codemod-utils/cli --root=<path/to/your/project>
```

</details>


<details>
<summary>Optional: Create a JavaScript project</summary>

By default, `@codemod-utils/cli` creates a TypeScript project to help you (and contributors) maintain and extend the codemod.

Pass `--typescript` to opt out.

```sh
npx @codemod-utils/cli --typescript false
```

</details>


## Compatibility
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@codemod-utils/cli",
"version": "0.0.0",
"description": "CLI for @codemod-utils",
"description": "CLI to create a codemod project",
"keywords": [
"codemod",
"ember-codemod"
Expand Down

0 comments on commit f6b0609

Please sign in to comment.