Skip to content

Commit

Permalink
feat: 新增 Star History 支持;优化 README.md 模板的 emoji
Browse files Browse the repository at this point in the history
  • Loading branch information
CaoMeiYouRen committed May 18, 2023
1 parent 46c55fe commit 5206dcd
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 19 deletions.
4 changes: 4 additions & 0 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ export interface InitAnswers {
* 是否启用爱发电
*/
isEnableAfdian: boolean
/**
* 是否启用 Star History
*/
isEnableStarHistory: boolean

/**
* 是否移除 yarn
Expand Down
9 changes: 9 additions & 0 deletions src/plopfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,15 @@ module.exports = function (plop: NodePlopAPI) {
return answers.isOpenSource
},
},
{
type: 'confirm',
name: 'isEnableStarHistory',
message: '是否启用 Star History ?',
default: false,
when(answers: InitAnswers) {
return answers.isOpenSource
},
},
{
type: 'confirm',
name: 'isEnableAfdian',
Expand Down
37 changes: 18 additions & 19 deletions templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,15 @@
<% } -%>
<% if (projectHomepage) { -%>
### 🏠 [主页](<%= projectHomepage %>)
## 🏠 主页

[<%= projectHomepage %>](<%= projectHomepage %>)

<% } -%>
<% if (projectDemoUrl) { -%>

### [Demo](<%= projectDemoUrl %>)

[<%= projectDemoUrl %>](<%= projectDemoUrl %>)

<% } -%>
<% if (projectPrerequisites && projectPrerequisites.length) { -%>

## 依赖要求
## 📦 依赖要求

<% projectPrerequisites.map(({ name, value }) => { -%>

Expand All @@ -64,55 +58,55 @@
<% } -%>
<% if (installCommand) { -%>

## 安装
## 🚀 安装

```sh
<%= installCommand %>
```
<% } -%>
<% if (usage) { -%>

## 使用
## 👨‍💻 使用

```sh
<%= usage %>
```
<% } -%>
<% if (devCommand) { -%>

## 开发
## 🛠️ 开发

```sh
<%= devCommand %>
```
<% } -%>
<% if (buildCommand) { -%>

## 编译
## 🔧 编译

```sh
<%= buildCommand %>
```
<% } -%>
<% if (testCommand) { -%>

## 测试
## 🧪 测试

```sh
<%= testCommand %>
```
<% } -%>
<% if (lintCommand) { -%>

## Lint
## 🔍 Lint

```sh
<%= lintCommand %>
```
<% } -%>
<% if (commitCommand) { -%>

## Commit
## 💾 Commit

```sh
<%= commitCommand %>
Expand All @@ -121,12 +115,13 @@

<% if (authorName || authorGithubUsername) { -%>

## 作者
## 👤 作者

<% if (authorName) { %>
👤 **<%= authorName %>**
**<%= authorName %>**
<% } %>
<% if (authorWebsite) { -%>

* Website: [<%= authorWebsite %>](<%= authorWebsite %>)
<% } -%>
<% if (authorGithubUsername) { -%>
Expand All @@ -135,12 +130,12 @@
<% } %>
<% if (issuesUrl) { -%>

## 🤝贡献
## 🤝 贡献

欢迎 贡献、提问或提出新功能!<br />如有问题请查看 [issues page](<%= issuesUrl %>). <br/><%= contributingUrl ? `贡献或提出新功能可以查看[contributing guide](${contributingUrl}).` : '' %>
<% } -%>

## 💰支持
## 💰 支持

如果觉得这个项目有用的话请给一颗⭐️,非常感谢
<% if (isEnableAfdian) { -%>
Expand All @@ -150,7 +145,11 @@
</a>
<% } -%>
<% if (licenseName && licenseUrl) { -%>
<% if (isEnableStarHistory) { -%>
## 🌟 Star History

[![Star History Chart](https://api.star-history.com/svg?repos=<%= authorGithubUsername %>/<%= projectName %>&type=Date)](https://star-history.com/#<%= authorGithubUsername %>/<%= projectName %>&Date)
<% } -%>
## 📝 License

<% if (authorName && authorGithubUsername) { -%>
Expand Down

0 comments on commit 5206dcd

Please sign in to comment.