Skip to content

Commit 4503e07

Browse files
committed
update CLI docs
1 parent 8505f82 commit 4503e07

File tree

1 file changed

+49
-10
lines changed

1 file changed

+49
-10
lines changed

website/docs/api/codeshift-cli.mdx

Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,9 @@ Print all help text to the command line
110110

111111
- `$ codeshift-cli --help`
112112

113-
## Commands
113+
## list
114114

115-
### list
116-
117-
Lists available codemods for the provided packages
115+
Subcommand that lists available codemods for the provided packages
118116

119117
**example:**
120118

@@ -124,22 +122,63 @@ Print a list of available codemods for a single package
124122

125123
Print a list of available codemods for multiple packages
126124

127-
- `$ codeshift-cli list mylib, @material-ui/button`
125+
- `$ codeshift-cli list @atlaskit/avatar @emotion/monorepo`
128126

129-
### init
127+
## init
130128

131-
Generates a new codemod at your desired path
129+
Subcommand that generates a new codemod at your desired path
132130

133131
**example:**
134132

135-
Create a new codemod package called foobar with a transform for version 10
133+
Create a new codeshift package called foobar with a transform for version 10
136134
on the Desktop
137135

138136
- `$ codeshift-cli init --package-name="foobar" --version="10.0.0" ~/Desktop`
139137

140-
### validate
138+
Create an empty codeshift package called foobar on the Desktop
139+
140+
- `$ codeshift-cli init --package-name="foobar" ~/Desktop`
141+
142+
Create an empty codeshift package called foobar in the current directory
143+
144+
- `$ codeshift-cli init --package-name="foobar"`
145+
146+
### --package-name
147+
148+
The name of the package/directory to be created.
149+
150+
**example:**
151+
152+
Create an empty codemod package called foobar with a transform.
153+
154+
When `--version` and `--preset` flags are omitted no transforms will be generated.
155+
To generate tranforms after already generating the directory, simply rerun the command with the necessary flags.
156+
157+
- `$ codeshift-cli init --package-name="foobar" ~/Desktop`
158+
159+
### --version (optional)
160+
161+
A semver-compatible string. Will be used to generate mock transform files and configuration.
162+
163+
**example:**
164+
165+
Create a codemod package called foobar with a versioned transform.
166+
167+
- `$ codeshift-cli init --package-name="foobar" --version="10.0.0" ~/Desktop`
168+
169+
### --preset (optional)
170+
171+
A kebab-cased string. Will be used to generate mock transform files and configuration.
172+
173+
**example:**
174+
175+
Create a codemod package called foobar with a preset.
176+
177+
- `$ codeshift-cli init --package-name="foobar" --preset="sort-imports" ~/Desktop`
178+
179+
## validate
141180

142-
Validates a codemod package at the desired path.
181+
Subcommand that validates a codemod package at the desired path.
143182

144183
**example:**
145184

0 commit comments

Comments
 (0)