Skip to content

Commit

Permalink
fix: 优化 npmUsername 的设置;更新文档
Browse files Browse the repository at this point in the history
  • Loading branch information
CaoMeiYouRen committed Dec 10, 2023
1 parent ce1bb73 commit 87ce5f7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ ct create
"AFDIAN_USERNAME": "",
"PATREON_USERNAME": "",
"WEIBO_USERNAME": "",
"TWITTER_USERNAME": ""
"TWITTER_USERNAME": "",
"NPM_USERNAME": ""
}
```

Expand All @@ -87,6 +88,8 @@ WEIBO_USERNAME:微博用户名,可空,默认值为空

TWITTER_USERNAME:Twitter 用户名,可空,默认值为空

NPM_USERNAME:Npm 用户名,可空,默认会使用 `GITHUB_USERNAME` 的用户名

**如果不使用自动初始化远程仓库功能,可以跳过该配置**

## 开发
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ async function getProjectInfo(projectPath: string, answers: InitAnswers) {
const twitterUsername = config?.TWITTER_USERNAME
const afdianUsername = config?.AFDIAN_USERNAME
const patreonUsername = config?.PATREON_USERNAME
const npmUsername = config?.NPM_USERNAME
const npmUsername = config?.NPM_USERNAME || author

const repositoryUrl = `https://github.com/${githubUsername}/${projectName}`
const gitUrl = `git+${repositoryUrl}.git`
Expand Down
1 change: 1 addition & 0 deletions templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@

<% if (authorWebsite) { -%>
* Website: [<%= authorWebsite %>](<%= authorWebsite %>)

<% } -%>
<% if (githubUsername) { -%>
* GitHub: [@<%= githubUsername %>](https://github.com/<%= githubUsername %>)
Expand Down

0 comments on commit 87ce5f7

Please sign in to comment.