Skip to content

Commit 450c977

Browse files
committed
Adds new primary cli alias 'codeshift'
1 parent 02b0a19 commit 450c977

File tree

6 files changed

+36
-31
lines changed

6 files changed

+36
-31
lines changed

.changeset/strange-swans-poke.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@codeshift/cli': patch
3+
---
4+
5+
Adds new primary CLI alias `codeshift` (as opposed to just `codeshift-cli`)

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"license": "MIT",
88
"repository": "https://github.com/CodeshiftCommunity/CodeshiftCommunity/tree/master/packages/cli",
99
"bin": {
10-
"@codeshift/cli": "./bin/codeshift-cli.js",
10+
"codeshift": "./bin/codeshift-cli.js",
1111
"codeshift-cli": "./bin/codeshift-cli.js"
1212
},
1313
"scripts": {

website/docs/api/codeshift-cli.mdx

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The cli allows you to run transforms either from the [community folder](https://
2121

2222
We recommend running the CLI with `$ npx` to ensure you always have the latest version.
2323

24-
`$ npx codeshift-cli --packages mylib@1.0.0 /project/src`
24+
`$ npx codeshift --packages mylib@1.0.0 /project/src`
2525

2626
But it can also be installed normally:
2727

@@ -33,7 +33,7 @@ Or globally:
3333

3434
and run with:
3535

36-
`$ codeshift-cli`
36+
`$ codeshift`
3737

3838
## Options
3939

@@ -46,18 +46,18 @@ Allows you to execute local transform file(s).
4646

4747
**example:**
4848

49-
- `$ codeshift-cli --transform codemods/my-special-mod /project/src/file.js`
50-
- `$ codeshift-cli --transform codemods/my-special-mod/index.ts /project/src/file.js`
51-
- `$ codeshift-cli --transform path/to/transform1.ts,path/to/transform2.ts,path/to/transform3.ts /project/src/file.js`
49+
- `$ codeshift --transform codemods/my-special-mod /project/src/file.js`
50+
- `$ codeshift --transform codemods/my-special-mod/index.ts /project/src/file.js`
51+
- `$ codeshift --transform path/to/transform1.ts,path/to/transform2.ts,path/to/transform3.ts /project/src/file.js`
5252

5353
### --packages
5454

5555
Runs transforms for the specified comma separated list of packages, optionally include a version for each package to run all transforms since that version
5656

5757
**example:**
5858

59-
- `$ codeshift-cli --packages @atlaskit/button /project/src`
60-
- `$ codeshift-cli --packages @atlaskit/button@3.0.0,@atlaskit/range@4.0.0 /project/src`
59+
- `$ codeshift --packages @atlaskit/button /project/src`
60+
- `$ codeshift --packages @atlaskit/button@3.0.0,@atlaskit/range@4.0.0 /project/src`
6161

6262
### --parser, -p
6363

@@ -73,42 +73,42 @@ Parser to use for parsing the source files you are code modding.
7373

7474
**example:**
7575

76-
- `$ codeshift-cli --parser tsx /project/src/file.ts`
77-
- `$ codeshift-cli -p babel /project/src/file.js`
76+
- `$ codeshift --parser tsx /project/src/file.ts`
77+
- `$ codeshift -p babel /project/src/file.js`
7878

7979
### --extensions, -e
8080

8181
Transform files with these file extensions (comma separated list) (default: js)
8282

8383
**example:**
8484

85-
- `$ codeshift-cli --extensions ts,tsx /project/src/file.js`
86-
- `$ codeshift-cli -e js /project/src/file.js`
85+
- `$ codeshift --extensions ts,tsx /project/src/file.js`
86+
- `$ codeshift -e js /project/src/file.js`
8787

8888
### --ignore-pattern
8989

9090
Ignore files that match a provided glob expression
9191

9292
**example:**
9393

94-
- `$ codeshift-cli --ignore-pattern node_modules /project/src/file.js`
94+
- `$ codeshift --ignore-pattern node_modules /project/src/file.js`
9595

9696
### --version, -v
9797

9898
Get current version number
9999

100100
**example:**
101101

102-
- `$ codeshift-cli --version`
103-
- `$ codeshift-cli -v`
102+
- `$ codeshift --version`
103+
- `$ codeshift -v`
104104

105105
### --help
106106

107107
Print all help text to the command line
108108

109109
**example:**
110110

111-
- `$ codeshift-cli --help`
111+
- `$ codeshift --help`
112112

113113
## list
114114

@@ -118,11 +118,11 @@ Subcommand that lists available codemods for the provided packages
118118

119119
Print a list of available codemods for a single package
120120

121-
- `$ codeshift-cli list mylib`
121+
- `$ codeshift list mylib`
122122

123123
Print a list of available codemods for multiple packages
124124

125-
- `$ codeshift-cli list @atlaskit/avatar @emotion/monorepo`
125+
- `$ codeshift list @atlaskit/avatar @emotion/monorepo`
126126

127127
## init
128128

@@ -133,15 +133,15 @@ Subcommand that generates a new codemod at your desired path
133133
Create a new codeshift package called foobar with a transform for version 10
134134
on the Desktop
135135

136-
- `$ codeshift-cli init --package-name="foobar" --version="10.0.0" ~/Desktop`
136+
- `$ codeshift init --package-name="foobar" --version="10.0.0" ~/Desktop`
137137

138138
Create an empty codeshift package called foobar on the Desktop
139139

140-
- `$ codeshift-cli init --package-name="foobar" ~/Desktop`
140+
- `$ codeshift init --package-name="foobar" ~/Desktop`
141141

142142
Create an empty codeshift package called foobar in the current directory
143143

144-
- `$ codeshift-cli init --package-name="foobar"`
144+
- `$ codeshift init --package-name="foobar"`
145145

146146
### --package-name
147147

@@ -154,7 +154,7 @@ Create an empty codemod package called foobar with a transform.
154154
When `--version` and `--preset` flags are omitted no transforms will be generated.
155155
To generate tranforms after already generating the directory, simply rerun the command with the necessary flags.
156156

157-
- `$ codeshift-cli init --package-name="foobar" ~/Desktop`
157+
- `$ codeshift init --package-name="foobar" ~/Desktop`
158158

159159
### --version (optional)
160160

@@ -164,7 +164,7 @@ A semver-compatible string. Will be used to generate mock transform files and co
164164

165165
Create a codemod package called foobar with a versioned transform.
166166

167-
- `$ codeshift-cli init --package-name="foobar" --version="10.0.0" ~/Desktop`
167+
- `$ codeshift init --package-name="foobar" --version="10.0.0" ~/Desktop`
168168

169169
### --preset (optional)
170170

@@ -174,7 +174,7 @@ A kebab-cased string. Will be used to generate mock transform files and configur
174174

175175
Create a codemod package called foobar with a preset.
176176

177-
- `$ codeshift-cli init --package-name="foobar" --preset="sort-imports" ~/Desktop`
177+
- `$ codeshift init --package-name="foobar" --preset="sort-imports" ~/Desktop`
178178

179179
## validate
180180

@@ -184,8 +184,8 @@ Subcommand that validates a codemod package at the desired path.
184184

185185
Validate a codemod package called "my-codemods".
186186

187-
- `$ codeshift-cli validate ./codemods/my-codemods`
187+
- `$ codeshift validate ./codemods/my-codemods`
188188

189189
Validate a codemod package from the current working directory
190190

191-
- `$ codeshift-cli validate`
191+
- `$ codeshift validate`

website/docs/authoring.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ Do not use this method if:
3434
## 2. Add codeshift to an existing package
3535

3636
For existing npm packages (like react), you have the option to expose codemods directly from the package by simply creating a `codeshift.config.js` at either the root, `/src` or `/codemods` directory.
37-
Given that the config and codemod files are then published and available on NPM, `codeshift-cli` will be able to find and run codemods using the `--package` flag.
37+
Given that the config and codemod files are then published and available on NPM, `codeshift` will be able to find and run codemods using the `--package` flag.
3838

3939
Use this method if you want:
4040

4141
- To get up and running with an existing package with very little overhead
4242
- Control over where and how your codeshift package is hosted
4343
- Control over tooling, dependencies and techstack
44-
- To remove a previously created jscodeshift cli wrapper and instead use the generic codeshift-cli
44+
- To remove a previously created `jscodeshift` cli wrapper and instead use the generic `codeshift` cli
4545

4646
Do not use this method if:
4747

website/docs/configuration.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module.exports = {
2424
};
2525
```
2626

27-
These files should always be in the root directory of your package to ensure `codeshift-cli` has access to it.
27+
These files should always be in the root directory of your package to ensure `codeshift` has access to it.
2828
It does so by pulling your package directly from NPM and searching the root directory, which by extension means you should always ensure that the config and the transform files are not ignored by npm.
2929

3030
Config files can be written in either JavaScript or TypeScript, depending on your preference.

website/docs/external-packages.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ To create a standalone codeshift package automatically, install the install and
2121

2222
Then given you want to initialize a new project called "foobar", with a codemod targetting version `10.0.0` you can run the following command:
2323

24-
`$ codeshift-cli init --package-name="foobar" --version="10.0.0" ~/Desktop`
24+
`$ codeshift init --package-name="foobar" --version="10.0.0" ~/Desktop`
2525

2626
This will create a new directory called "foobar" in the `~/Desktop` directory.
2727

2828
You can then also initialize subsequent transforms and presets by running the command again:
2929

30-
`$ codeshift-cli init --package-name="foobar" --preset="sort-imports" ~/Desktop`
30+
`$ codeshift init --package-name="foobar" --preset="sort-imports" ~/Desktop`
3131

3232
### File structure
3333

0 commit comments

Comments
 (0)