cmyr-template-cli 1.5.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +6 -1
- package/dist/plopfile.js +318 -17252
- package/package.json +3 -3
- package/templates/.editorconfig +26 -0
- package/templates/.github/workflows/release.yml +32 -0
- package/templates/.github/workflows/test.yml +25 -0
- package/templates/.husky/commit-msg +4 -0
- package/templates/.husky/pre-commit +4 -0
- package/templates/CONTRIBUTING.md +77 -0
- package/templates/LICENSE +21 -0
- package/templates/README.md +15 -1
- package/templates/commitlint.config.js +20 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cmyr-template-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "草梅友仁自制的项目模板创建器",
|
|
5
5
|
"author": "CaoMeiYouRen",
|
|
6
6
|
"license": "MIT",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@types/ejs": "^3.1.0",
|
|
44
44
|
"@types/fs-extra": "^9.0.4",
|
|
45
45
|
"@types/lodash": "^4.14.165",
|
|
46
|
-
"@types/node": "^
|
|
46
|
+
"@types/node": "^17.0.0",
|
|
47
47
|
"@types/promise.any": "^2.0.0",
|
|
48
48
|
"@typescript-eslint/eslint-plugin": "^4.9.0",
|
|
49
49
|
"@typescript-eslint/parser": "^4.9.0",
|
|
@@ -57,7 +57,6 @@
|
|
|
57
57
|
"eslint-config-cmyr": "^1.1.14",
|
|
58
58
|
"husky": "^7.0.2",
|
|
59
59
|
"lint-staged": "^12.0.2",
|
|
60
|
-
"lodash": "^4.17.20",
|
|
61
60
|
"rimraf": "^3.0.2",
|
|
62
61
|
"rollup": "^2.33.3",
|
|
63
62
|
"rollup-plugin-terser": "^7.0.2",
|
|
@@ -76,6 +75,7 @@
|
|
|
76
75
|
"download-git-repo": "^3.0.2",
|
|
77
76
|
"ejs": "^3.1.6",
|
|
78
77
|
"fs-extra": "^10.0.0",
|
|
78
|
+
"lodash": "^4.17.20",
|
|
79
79
|
"minimist": "^1.2.5",
|
|
80
80
|
"ora": "^5.4.1",
|
|
81
81
|
"plop": "^2.7.6",
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# http://editorconfig.org
|
|
2
|
+
#启用编辑器配置
|
|
3
|
+
root = true
|
|
4
|
+
# 对所有文件生效
|
|
5
|
+
[*]
|
|
6
|
+
#编码方式
|
|
7
|
+
charset = utf-8
|
|
8
|
+
#缩进格式
|
|
9
|
+
indent_style = space
|
|
10
|
+
indent_size = 4
|
|
11
|
+
#换行符
|
|
12
|
+
end_of_line = lf
|
|
13
|
+
#插入最终换行符
|
|
14
|
+
insert_final_newline = true
|
|
15
|
+
#修剪尾随空格
|
|
16
|
+
trim_trailing_whitespace = true
|
|
17
|
+
# 对后缀名为 md 的文件生效
|
|
18
|
+
[*.md]
|
|
19
|
+
trim_trailing_whitespace = false
|
|
20
|
+
[*.sh]
|
|
21
|
+
#换行符
|
|
22
|
+
end_of_line = lf
|
|
23
|
+
[package.json]
|
|
24
|
+
indent_size = 2
|
|
25
|
+
[*.yml]
|
|
26
|
+
indent_size = 2
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches:
|
|
5
|
+
- master
|
|
6
|
+
jobs:
|
|
7
|
+
release:
|
|
8
|
+
name: Release
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v2
|
|
12
|
+
- name: Setup Node.js environment
|
|
13
|
+
uses: actions/setup-node@v2.1.2
|
|
14
|
+
with:
|
|
15
|
+
node-version: "lts/*"
|
|
16
|
+
cache: "yarn"
|
|
17
|
+
- name: Cache multiple paths
|
|
18
|
+
uses: actions/cache@v2
|
|
19
|
+
with:
|
|
20
|
+
path: |
|
|
21
|
+
~/.npm
|
|
22
|
+
~/cache
|
|
23
|
+
!~/cache/exclude
|
|
24
|
+
**/node_modules
|
|
25
|
+
key: npm-${{ runner.os }}-${{ hashFiles('package.json') }}
|
|
26
|
+
- run: yarn
|
|
27
|
+
- run: npm run lint
|
|
28
|
+
- run: npm run build
|
|
29
|
+
- env:
|
|
30
|
+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
|
31
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
32
|
+
run: npm run release
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
on: [push, pull_request]
|
|
3
|
+
jobs:
|
|
4
|
+
test:
|
|
5
|
+
name: Test
|
|
6
|
+
runs-on: ubuntu-latest
|
|
7
|
+
steps:
|
|
8
|
+
- uses: actions/checkout@v2
|
|
9
|
+
- name: Setup Node.js@lts environment
|
|
10
|
+
uses: actions/setup-node@v2
|
|
11
|
+
with:
|
|
12
|
+
node-version: "lts/*"
|
|
13
|
+
cache: "yarn"
|
|
14
|
+
- name: Cache multiple paths
|
|
15
|
+
uses: actions/cache@v2
|
|
16
|
+
with:
|
|
17
|
+
path: |
|
|
18
|
+
~/.npm
|
|
19
|
+
~/cache
|
|
20
|
+
!~/cache/exclude
|
|
21
|
+
**/node_modules
|
|
22
|
+
key: npm-${{ runner.os }}-${{ hashFiles('package.json') }}
|
|
23
|
+
- run: yarn
|
|
24
|
+
- run: npm run lint
|
|
25
|
+
- run: npm run build
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# 贡献指南
|
|
2
|
+
|
|
3
|
+
在为此存储库做出贡献时,请首先通过 issue、电子邮件或任何其他方法与此存储库的所有者讨论您希望进行的更改,然后再进行更改。
|
|
4
|
+
|
|
5
|
+
## 开发环境设置
|
|
6
|
+
|
|
7
|
+
要设置开发环境,请按照以下步骤操作:
|
|
8
|
+
|
|
9
|
+
1. Clone 本项目
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
git clone <%= repositoryUrl %>.git
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
2. 安装依赖
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npm i
|
|
19
|
+
# 或 yarn
|
|
20
|
+
# 或 pnpm i
|
|
21
|
+
```
|
|
22
|
+
<% if (devCommand) { -%>
|
|
23
|
+
3. 运行开发环境
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
<%= devCommand %>
|
|
27
|
+
```
|
|
28
|
+
<% } -%>
|
|
29
|
+
|
|
30
|
+
## 问题和功能请求
|
|
31
|
+
|
|
32
|
+
你在源代码中发现了一个错误,文档中有一个错误,或者你想要一个新功能? 看看[GitHub 讨论](<%= discussionsUrl %>)看看它是否已经在讨论中。您可以通过[在 GitHub 上提交问题](<%= issuesUrl %>)来帮助我们。在创建问题之前,请确保搜索问题存档 - 您的问题可能已经得到解决!
|
|
33
|
+
|
|
34
|
+
请尝试创建以下错误报告:
|
|
35
|
+
|
|
36
|
+
- *可重现*。包括重现问题的步骤。
|
|
37
|
+
- *具体的*。包括尽可能多的细节:哪个版本,什么环境等。
|
|
38
|
+
- *独特的*。不要复制现有的已打开问题。
|
|
39
|
+
- *范围仅限于单个错误*。每个报告一个错误。
|
|
40
|
+
|
|
41
|
+
**更好的是:提交带有修复或新功能的 Pull Requests!**
|
|
42
|
+
|
|
43
|
+
### 如何提交拉取请求
|
|
44
|
+
|
|
45
|
+
1. 在我们的存储库中搜索 与您的提交相关的开放或关闭的 [Pull Requests](<%= pullRequestsUrl %>)。你不想重复努力。
|
|
46
|
+
|
|
47
|
+
2. Fork 本项目
|
|
48
|
+
|
|
49
|
+
3. 创建您的功能分支 ( `git checkout -b feat/your_feature`)
|
|
50
|
+
|
|
51
|
+
4. 提交您的更改
|
|
52
|
+
|
|
53
|
+
本项目使用 [约定式提交](https://www.conventionalcommits.org/zh-hans/v1.0.0/),因此请遵循提交消息中的规范。
|
|
54
|
+
|
|
55
|
+
git commit 将用于自动化生成日志,所以请勿直接提交 git commit。
|
|
56
|
+
|
|
57
|
+
非常建议使用 [commitizen](https://github.com/commitizen/cz-cli) 工具来生成 git commit,使用 husky 约束 git commit
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
git add .
|
|
61
|
+
git cz # 使用 commitizen 提交!
|
|
62
|
+
git pull # 请合并最新代码并解决冲突后提交!
|
|
63
|
+
#请勿直接提交git commit
|
|
64
|
+
#若觉得修改太多也可分开提交。先 git add 一部分,执行 git cz 提交后再提交另外一部分
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
关于选项,参考 [semantic-release](https://github.com/semantic-release/semantic-release) 的文档
|
|
68
|
+
|
|
69
|
+
- 若为 BUG 修复,则选择 `fix`
|
|
70
|
+
- 若为新增功能,则选择 `feat`
|
|
71
|
+
- 若为移除某些功能,则选择 `perf` 或填写 `BREAKING CHANGE`
|
|
72
|
+
- `perf` 和其他破坏性更新,若不是为了修复 BUG,原则上将拒绝该 PR
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
5. 推送到分支 ( `git push origin feat/your_feature`)
|
|
76
|
+
|
|
77
|
+
6. [打开一个新的 Pull Request](<%= repositoryUrl %>/compare?expand=1)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) <%= currentYear %> <%= authorName %>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/templates/README.md
CHANGED
|
@@ -8,6 +8,11 @@
|
|
|
8
8
|
<% if (projectVersion && !isProjectOnNpm) { -%>
|
|
9
9
|
<img alt="Version" src="https://img.shields.io/badge/version-<%= projectVersion %>-blue.svg?cacheSeconds=2592000" />
|
|
10
10
|
<% } -%>
|
|
11
|
+
<% if (isGithubRepos) { -%>
|
|
12
|
+
<a href="<%= repositoryUrl %>/actions?query=workflow%3ARelease" target="_blank">
|
|
13
|
+
<img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/<%= authorGithubUsername %>/<%= projectName %>/Release">
|
|
14
|
+
</a>
|
|
15
|
+
<% } -%>
|
|
11
16
|
<% if (projectPrerequisites) { -%>
|
|
12
17
|
<% projectPrerequisites.map(({ name, value }) => { -%>
|
|
13
18
|
<img src="https://img.shields.io/badge/<%= name %>-<%= encodeURIComponent(value) %>-blue.svg" />
|
|
@@ -28,6 +33,7 @@
|
|
|
28
33
|
<img alt="License: <%= licenseName %>" src="https://img.shields.io/<%= `badge/License-${licenseName}-yellow.svg` %>" />
|
|
29
34
|
</a>
|
|
30
35
|
<% } -%>
|
|
36
|
+
</p>
|
|
31
37
|
|
|
32
38
|
<% if (projectDescription) { -%>
|
|
33
39
|
|
|
@@ -71,6 +77,14 @@
|
|
|
71
77
|
<%= usage %>
|
|
72
78
|
```
|
|
73
79
|
<% } -%>
|
|
80
|
+
<% if (devCommand) { -%>
|
|
81
|
+
|
|
82
|
+
## 开发
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
<%= devCommand %>
|
|
86
|
+
```
|
|
87
|
+
<% } -%>
|
|
74
88
|
<% if (buildCommand) { -%>
|
|
75
89
|
|
|
76
90
|
## 编译
|
|
@@ -114,7 +128,7 @@
|
|
|
114
128
|
|
|
115
129
|
## 🤝贡献
|
|
116
130
|
|
|
117
|
-
欢迎
|
|
131
|
+
欢迎 贡献、提问或提出新功能!<br />如有问题请查看 [issues page](<%= issuesUrl %>). <br/><%= contributingUrl ? `贡献或提出新功能可以查看[contributing guide](${contributingUrl}).` : '' %>
|
|
118
132
|
<% } -%>
|
|
119
133
|
|
|
120
134
|
## 支持
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
extends: ['@commitlint/config-conventional'],
|
|
3
|
+
rules: {
|
|
4
|
+
'type-enum': [2, 'always', [
|
|
5
|
+
'feat',
|
|
6
|
+
'fix',
|
|
7
|
+
'docs',
|
|
8
|
+
'style',
|
|
9
|
+
'refactor',
|
|
10
|
+
'perf',
|
|
11
|
+
'test',
|
|
12
|
+
'build',
|
|
13
|
+
'ci',
|
|
14
|
+
'chore',
|
|
15
|
+
'revert',
|
|
16
|
+
]],
|
|
17
|
+
'subject-full-stop': [0, 'never'],
|
|
18
|
+
'subject-case': [0, 'never'],
|
|
19
|
+
},
|
|
20
|
+
}
|