Skip to content

Commit aab1241

Browse files
do not use npx
1 parent 1c20b6d commit aab1241

File tree

5 files changed

+24
-24
lines changed

5 files changed

+24
-24
lines changed

README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ yarn global add .
7676
`vue-codemod` consists of different migration rules. Those rules are defined in `transformation/index.ts` and `vue-transformation/index.ts`.
7777

7878
``` bash
79-
npx vue-codemod <path> -t/-a [transformation params][...additional options]
79+
vue-codemod <path> -t/-a [transformation params][...additional options]
8080
```
8181

8282
1. `<path>` indicates the path of execution, which can be files and folders
@@ -86,15 +86,15 @@ npx vue-codemod <path> -t/-a [transformation params][...additional options]
8686
#### Execute All Rules
8787

8888
``` bash
89-
npx vue-codemod src -a
89+
vue-codemod src -a
9090
```
9191

9292
`src` indicates the path of execution. `-a` means executing all rules.
9393

9494
#### Execute Specific Rule
9595

9696
```bash
97-
npx vue-codemod src -t new-global-api
97+
vue-codemod src -t new-global-api
9898
```
9999

100100
`src` indicates the path of execution. `-t new-global-api` means only executing the rule of `new-global-api` .
@@ -104,7 +104,7 @@ npx vue-codemod src -t new-global-api
104104
#### Output Format
105105

106106
```bash
107-
npx vue-codemod src -a -f log
107+
vue-codemod src -a -f log
108108
```
109109

110110
The `-f` option is used to specify the output format. The optional parameters are `table`, `detail`,`log`. If no parameters are specified, the default is `table`.
@@ -163,13 +163,13 @@ index: 1
163163
#### Help
164164

165165
```bash
166-
npx vue-codemod --help
166+
vue-codemod --help
167167
```
168168

169169
Output:
170170

171171
``` bash
172-
npx vue-codemod --help
172+
vue-codemod --help
173173
Usage: vue-codemod [file pattern]
174174

175175
Options:
@@ -182,16 +182,16 @@ Options:
182182
-v, --version Show version number [boolean]
183183

184184
Examples:
185-
npx vue-codemod ./src -a Run all rules to convert all
185+
vue-codemod ./src -a Run all rules to convert all
186186
relevant files in the ./src folder
187-
npx vue-codemod Run slot-attribute rule to convert
187+
vue-codemod Run slot-attribute rule to convert
188188
./src/components/HelloWorld.vue -t HelloWorld.vue
189189
slot-attribute
190190
```
191191

192192
### Migrating from Vue 2 to Vue 3
193193

194-
1. Run the `-a` command: `npx vue-codemod <path> -a`
194+
1. Run the `-a` command: `vue-codemod <path> -a`
195195
2. Manually migrate some cases which `vue-codemod` doesn't cover based on [Manual Migration Guide](./docs/manual-guide.md).
196196
3. Make sure to use [@vue/compat](https://github.com/vuejs/vue-next/tree/master/packages/vue-compat) to build
197197
4. Serve the app in development mode, fix the runtime deprecation warnings

README_ZH.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ yarn global add .
7474
`vue-codemod` 是由一条条转换规则组成,这些转换规则位于 `transformation/index.ts``vue-transformation/index.ts` 下。
7575

7676
```bash
77-
npx vue-codemod <path> -t/-a [transformation params][...additional options]
77+
vue-codemod <path> -t/-a [transformation params][...additional options]
7878
```
7979

8080
1. `<path>` 表示执行的路径,可以是文件和文件夹
@@ -83,15 +83,15 @@ npx vue-codemod <path> -t/-a [transformation params][...additional options]
8383
#### 执行所有规则
8484

8585
```bash
86-
npx vue-codemod src -a
86+
vue-codemod src -a
8787
```
8888

8989
`src` 指定的是扫描的文件路径,`-a` 表示执行所有的规则转换
9090

9191
#### 执行单条规则
9292

9393
```bash
94-
npx vue-codemod src -t new-global-api
94+
vue-codemod src -t new-global-api
9595
```
9696

9797
`src` 指定的是扫描的文件路径,`-t new-global-api` 表示只执行 `new-global-api` 这条规则。
@@ -101,7 +101,7 @@ npx vue-codemod src -t new-global-api
101101
#### 规定输出格式
102102

103103
```bash
104-
npx vue-codemod src -a -f log
104+
vue-codemod src -a -f log
105105
```
106106

107107
`-f` 命令用于规定统计输出格式,可选参数为为 `table``detail``log`,在没有指定参数的情况下默认为 `table`
@@ -154,13 +154,13 @@ index: 1
154154
#### 帮助
155155

156156
```bash
157-
npx vue-codemod --help
157+
vue-codemod --help
158158
```
159159

160160
结果如下所示
161161

162162
```bash
163-
npx vue-codemod --help
163+
vue-codemod --help
164164
Usage: vue-codemod [file pattern]
165165

166166
Options:
@@ -173,16 +173,16 @@ Options:
173173
-v, --version Show version number [boolean]
174174

175175
Examples:
176-
npx vue-codemod ./src -a Run all rules to convert all
176+
vue-codemod ./src -a Run all rules to convert all
177177
relevant files in the ./src folder
178-
npx vue-codemod Run slot-attribute rule to convert
178+
vue-codemod Run slot-attribute rule to convert
179179
./src/components/HelloWorld.vue -t HelloWorld.vue
180180
slot-attribute
181181
```
182182

183183
### 迁移步骤
184184

185-
1. 运行 `vue-codemod``-a` 命令: `npx vue-codemod <path> -a`
185+
1. 运行 `vue-codemod``-a` 命令: `vue-codemod <path> -a`
186186
2. 手动迁移 `vue-codemod` 没有覆盖到的特殊场景, 请参考 [手动迁移指南](./docs/zh/manual-guide.md).
187187
3. 确保使用 [@vue/compat](https://github.com/vuejs/vue-next/tree/master/packages/vue-compat) 兼容包运行
188188
4. 在开发模式下启动项目,修复运行时告警

bin/vue-codemod.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ const {
5757
})
5858
.example([
5959
[
60-
'npx vue-codemod ./src -a',
60+
'vue-codemod ./src -a',
6161
'Run all rules to convert all relevant files in the ./src folder'
6262
],
6363
[
64-
'npx vue-codemod ./src/components/HelloWorld.vue -t slot-attribute',
64+
'vue-codemod ./src/components/HelloWorld.vue -t slot-attribute',
6565
'Run slot-attribute rule to convert HelloWorld.vue'
6666
]
6767
])

docs/typical-case.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ yarn add originjs/vue-codemod -g
2525
Command:
2626
2727
```bash
28-
npx vue-codemod src -a
28+
vue-codemod src -a
2929
```
3030
3131
First we apply `vue-codemod` to auto upgrade the source code. Hers is the transformation log. Users can figure out which rules was executed and which files are modified.
3232
3333
```cmd
34-
npx vue-codemod src -a
34+
vue-codemod src -a
3535
Warning!!
3636
This tool may overwrite files.
3737
press enter or enter yes or enter Y to continue:

docs/zh/typical-case.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ Vue 3 正式版本发布已经半年有余,同时 Vue 2 会逐步停止维护
2020

2121
> 注意:vue-codemod 是在源路径下修改文件,若您的代码没有使用诸如 Git、SVN 等版本管理工具时,请提前备份。
2222
23-
运行命令:`npx vue-codemod src -a`,在手动修改前直接使用 vue-codemod 来一波自动升级(实际是语法替换),下面是转换日志,我们可以看到转换了哪些规则,更改了哪些文件;
23+
运行命令:`vue-codemod src -a`,在手动修改前直接使用 vue-codemod 来一波自动升级(实际是语法替换),下面是转换日志,我们可以看到转换了哪些规则,更改了哪些文件;
2424

2525
```cmd
26-
npx vue-codemod src -a
26+
vue-codemod src -a
2727
Warning!!
2828
This tool may overwrite files.
2929
press enter or enter yes or enter Y to continue:

0 commit comments

Comments
 (0)