Skip to content

Commit f1ec783

Browse files
colmugxlevy9527
authored andcommitted
docs: 补充通过命令创建的说明 (#97)
1 parent b3f4998 commit f1ec783

File tree

3 files changed

+23
-11
lines changed

3 files changed

+23
-11
lines changed

README-zh.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ yarn publish
6161

6262
### 参数选项
6363

64-
```
65-
-u, --upgrade
66-
```
64+
`-u`, `--upgrade`
6765

6866
根据 template目录下模板,生成新的文件,更新到当前组件中。使用的是覆盖策略,默认覆盖的文件定义在 update-files.js。常用于使用最新版本vue-sfc-cli对旧组件的配置进行升级
6967

@@ -72,22 +70,30 @@ yarn publish
7270
npx vue-sfc-cli -u
7371
```
7472

75-
`—files`
73+
`-files`
7674

7775
如果想更新额外的文件,可以传此选项,后接文件名,多个文件使用 `,` 分隔
7876

7977
```
8078
npx vue-sfc-cli -u --files package.json,.babelrc.js
8179
```
8280

83-
`—test`
81+
`-—test`
8482

8583
生成一个测试的组件模板,常用于ci环境测试。
8684

8785
```
8886
npx vue-sfc-cli --test
8987
```
9088

89+
`--name`, `--owner`
90+
91+
以命令形式生成组件,跳过询问过程。它们通常成对出现。
92+
93+
```
94+
npx vue-sfc-cli --name log-viewer --owner FEMessage
95+
```
96+
9197
### 示例文档
9298

9399
在docs目录下,新建 `md` 文件,建议命名同样是kebab-case

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,7 @@ yarn publish
6666

6767
### Options
6868

69-
```
70-
-u, --upgrade
71-
```
69+
`-u`, `--upgrade`
7270

7371
According to the template files in the templates directory, new files will be generated and override the files with same name in current component directory. The default override files is defined in update-files.js. This option often used to upgrade the configuration of old components using the latest version of vue-sfc-cli:
7472

@@ -77,22 +75,30 @@ According to the template files in the templates directory, new files will be ge
7775
npx vue-sfc-cli -u
7876
```
7977

80-
`—files`
78+
`-files`
8179

8280
If you want to update additional files, you can pass this option, multiple files use `,` to separate
8381

8482
```
8583
npx vue-sfc-cli -u --files package.json,.babelrc.js
8684
```
8785

88-
`—test`
86+
`-—test`
8987

9088
Generate a component template for testing, commonly used in CI .
9189

9290
```
9391
npx vue-sfc-cli --test
9492
```
9593

94+
`--name`, `--owner`
95+
96+
These two arguments are usually used together to generate component without prompt.
97+
98+
```
99+
npx vue-sfc-cli --name log-viewer --owner FEMessage
100+
```
101+
96102
### Writing Example
97103

98104
The docs directory hosts your component's examples. You just write markdown files, and they will turn into demo. It is also recommended to name the markdown files in kebab-case style.

init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ let pkgName = ''
1515
/**
1616
* Prompt user for input to populate template files
1717
*/
18-
let npmName = argv.get('npm')
18+
let npmName = argv.get('name')
1919
let ownerName = argv.get('owner')
2020
const OWNER_NAME = 'FEMessage'
2121

0 commit comments

Comments
 (0)