cmyr-template-cli 1.7.5 → 1.8.2

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/README.md CHANGED
@@ -1,6 +1,40 @@
1
- # cmyr-template-cli
1
+ <h1 align="center">cmyr-template-cli </h1>
2
+ <p>
3
+ <a href="https://www.npmjs.com/package/cmyr-template-cli" target="_blank">
4
+ <img alt="Version" src="https://img.shields.io/npm/v/cmyr-template-cli.svg">
5
+ </a>
6
+ <a href="https://github.com/CaoMeiYouRen/cmyr-template-cli/actions?query=workflow%3ARelease" target="_blank">
7
+ <img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/CaoMeiYouRen/cmyr-template-cli/Release">
8
+ </a>
9
+ <img src="https://img.shields.io/badge/node-%3E%3D12-blue.svg" />
10
+ <a href="https://github.com/CaoMeiYouRen/cmyr-template-cli#readme" target="_blank">
11
+ <img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" />
12
+ </a>
13
+ <a href="https://github.com/CaoMeiYouRen/cmyr-template-cli/graphs/commit-activity" target="_blank">
14
+ <img alt="Maintenance" src="https://img.shields.io/badge/Maintained%3F-yes-green.svg" />
15
+ </a>
16
+ <a href="https://github.com/CaoMeiYouRen/cmyr-template-cli/blob/master/LICENSE" target="_blank">
17
+ <img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-yellow.svg" />
18
+ </a>
19
+ </p>
2
20
 
3
- 草梅友仁自制的项目模板创建器
21
+
22
+ > 草梅友仁自制的项目模板创建器
23
+
24
+ ### 🏠 [主页](https://github.com/CaoMeiYouRen/cmyr-template-cli#readme)
25
+
26
+ [https://github.com/CaoMeiYouRen/cmyr-template-cli#readme](https://github.com/CaoMeiYouRen/cmyr-template-cli#readme)
27
+
28
+
29
+ ### ✨ [Demo](https://github.com/CaoMeiYouRen/cmyr-template-cli#readme)
30
+
31
+ [https://github.com/CaoMeiYouRen/cmyr-template-cli#readme](https://github.com/CaoMeiYouRen/cmyr-template-cli#readme)
32
+
33
+
34
+ ## 依赖要求
35
+
36
+
37
+ - node >=12
4
38
 
5
39
  ## 安装
6
40
 
@@ -11,13 +45,60 @@ npm i -g cmyr-template-cli
11
45
  # 或者 pnpm i -g cmyr-template-cli
12
46
  ```
13
47
 
48
+ ## 使用
14
49
 
50
+ ```sh
51
+ ct
52
+ # 或
53
+ ct create
54
+ ```
15
55
 
56
+ ## 开发
16
57
 
17
- ## 使用
58
+ ```sh
59
+ npm run dev
60
+ ```
18
61
 
62
+ ## 编译
19
63
 
20
- ``` sh
21
- ct create
64
+ ```sh
65
+ npm run build
22
66
  ```
23
67
 
68
+ ## Lint
69
+
70
+ ```sh
71
+ npm run lint
72
+ ```
73
+
74
+ ## Commit
75
+
76
+ ```sh
77
+ npm run commit
78
+ ```
79
+
80
+
81
+ ## 作者
82
+
83
+
84
+ 👤 **CaoMeiYouRen**
85
+
86
+ * Website: [https://blog.cmyr.ltd/](https://blog.cmyr.ltd/)
87
+ * GitHub: [@CaoMeiYouRen](https://github.com/CaoMeiYouRen)
88
+
89
+
90
+ ## 🤝贡献
91
+
92
+ 欢迎 贡献、提问或提出新功能!<br />如有问题请查看 [issues page](https://github.com/CaoMeiYouRen/cmyr-template-cli/issues). <br/>贡献或提出新功能可以查看[contributing guide](https://github.com/CaoMeiYouRen/cmyr-template-cli/blob/master/CONTRIBUTING.md).
93
+
94
+ ## 💰支持
95
+
96
+ 如果觉得这个项目有用的话请给一颗⭐️,非常感谢
97
+
98
+ ## 📝 License
99
+
100
+ Copyright © 2021 [CaoMeiYouRen](https://github.com/CaoMeiYouRen).<br />
101
+ This project is [MIT](https://github.com/CaoMeiYouRen/cmyr-template-cli/blob/master/LICENSE) licensed.
102
+
103
+ ***
104
+ _This README was generated with ❤️ by [cmyr-template-cli](https://github.com/CaoMeiYouRen/cmyr-template-cli)_
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
13
13
 
14
14
  const program = new commander.Command('ct')
15
15
  .description('草梅项目创建器');
16
- program.version("1.7.4" , '-v, --version');
16
+ program.version("1.8.1" , '-v, --version');
17
17
  const args = process.argv.slice(2);
18
18
  if (args.length === 0) {
19
19
  args.push('create');
package/dist/plopfile.js CHANGED
@@ -132,16 +132,8 @@ async function init(projectPath, answers) {
132
132
  });
133
133
  console.info(colors__default["default"].green(`请在远程 Git 仓库初始化 ${gitRemoteUrl}`));
134
134
  }
135
- const dependabotPath = path__default["default"].join(projectPath, '.github/dependabot.yml');
136
- const mergifyPath = path__default["default"].join(projectPath, '.github/mergify.yml');
137
- if (!isOpenSource || isRemoveDependabot) {
138
- if (await fs__default["default"].pathExists(dependabotPath)) {
139
- await fs__default["default"].remove(dependabotPath);
140
- }
141
- if (await fs__default["default"].pathExists(mergifyPath)) {
142
- await fs__default["default"].remove(mergifyPath);
143
- }
144
- }
135
+ await initDependabot(projectPath, answers);
136
+ await initYarn(projectPath, answers);
145
137
  const newPkg = await initProjectJson(projectPath, answers);
146
138
  if (isInitSemanticRelease) {
147
139
  await initSemanticRelease(projectPath);
@@ -204,6 +196,38 @@ async function getGitUserName() {
204
196
  const username = (await asyncExec('git config user.name')) || '';
205
197
  return username.trim();
206
198
  }
199
+ async function initDependabot(projectPath, answers) {
200
+ try {
201
+ const { isOpenSource, isRemoveDependabot } = answers;
202
+ const dependabotPath = path__default["default"].join(projectPath, '.github/dependabot.yml');
203
+ const mergifyPath = path__default["default"].join(projectPath, '.github/mergify.yml');
204
+ if (!isOpenSource || isRemoveDependabot) {
205
+ if (await fs__default["default"].pathExists(dependabotPath)) {
206
+ await fs__default["default"].remove(dependabotPath);
207
+ }
208
+ if (await fs__default["default"].pathExists(mergifyPath)) {
209
+ await fs__default["default"].remove(mergifyPath);
210
+ }
211
+ }
212
+ }
213
+ catch (error) {
214
+ console.error(error);
215
+ }
216
+ }
217
+ async function initYarn(projectPath, answers) {
218
+ try {
219
+ const { isRemoveYarn } = answers;
220
+ const yarnPath = path__default["default"].join(projectPath, 'yarn.lock');
221
+ if (isRemoveYarn) {
222
+ if (await fs__default["default"].pathExists(yarnPath)) {
223
+ await fs__default["default"].remove(yarnPath);
224
+ }
225
+ }
226
+ }
227
+ catch (error) {
228
+ console.error(error);
229
+ }
230
+ }
207
231
  async function initProjectJson(projectPath, answers) {
208
232
  const loading = ora__default["default"]('正在初始化 package.json ……').start();
209
233
  try {
@@ -247,6 +271,11 @@ async function initProjectJson(projectPath, answers) {
247
271
  },
248
272
  };
249
273
  }
274
+ if (isPublishToNpm) {
275
+ extData.publishConfig = {
276
+ access: 'public',
277
+ };
278
+ }
250
279
  const newPkg = Object.assign({}, pkg, pkgData, extData);
251
280
  await saveProjectJson(projectPath, newPkg);
252
281
  loading.succeed('package.json 初始化成功!');
@@ -553,6 +582,7 @@ async function initHusky(projectPath) {
553
582
  }
554
583
  }
555
584
  async function initCommitizen(projectPath) {
585
+ const loading = ora__default["default"]('正在初始化 commitizen ……').start();
556
586
  try {
557
587
  const pkg = await getProjectJson(projectPath);
558
588
  const devDependencies = {
@@ -576,9 +606,11 @@ async function initCommitizen(projectPath) {
576
606
  },
577
607
  };
578
608
  await saveProjectJson(projectPath, pkgData);
609
+ loading.succeed('commitizen 初始化成功!');
579
610
  }
580
611
  catch (error) {
581
612
  console.error(error);
613
+ loading.fail('commitizen 初始化失败!');
582
614
  }
583
615
  }
584
616
  async function sortProjectJson(projectPath) {
@@ -806,6 +838,15 @@ module.exports = function (plop) {
806
838
  return answers.isOpenSource;
807
839
  },
808
840
  },
841
+ {
842
+ type: 'confirm',
843
+ name: 'isRemoveYarn',
844
+ message: '是否移除 yarn ?',
845
+ default: false,
846
+ when(answers) {
847
+ return answers.isOpenSource;
848
+ },
849
+ },
809
850
  {
810
851
  type: 'confirm',
811
852
  name: 'isEnableAfdian',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cmyr-template-cli",
3
- "version": "1.7.5",
3
+ "version": "1.8.2",
4
4
  "description": "草梅友仁自制的项目模板创建器",
5
5
  "author": "CaoMeiYouRen",
6
6
  "license": "MIT",
@@ -49,7 +49,7 @@
49
49
  "@typescript-eslint/parser": "^4.9.0",
50
50
  "commitizen": "^4.2.2",
51
51
  "conventional-changelog-cli": "^2.1.1",
52
- "conventional-changelog-cmyr-config": "^1.2.3",
52
+ "conventional-changelog-cmyr-config": "^2.0.2",
53
53
  "cross-env": "^7.0.2",
54
54
  "cz-conventional-changelog": "^3.3.0",
55
55
  "cz-conventional-changelog-cmyr": "^1.0.0",
@@ -13,7 +13,7 @@ jobs:
13
13
  uses: actions/setup-node@v2
14
14
  with:
15
15
  node-version: "lts/*"
16
- cache: "yarn"
16
+ # cache: "yarn"
17
17
  - name: Cache multiple paths
18
18
  uses: actions/cache@v2
19
19
  with:
@@ -24,9 +24,9 @@ jobs:
24
24
  **/node_modules
25
25
  key: npm-${{ runner.os }}-${{ hashFiles('package.json') }}
26
26
  - run: yarn
27
- - run: npm run lint
28
- - run: npm run build
27
+ - run: yarn run lint
28
+ - run: yarn run build
29
29
  - env:
30
30
  GH_TOKEN: ${{ secrets.GH_TOKEN }}
31
31
  NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
32
- run: npm run release
32
+ run: yarn run release
@@ -10,7 +10,7 @@ jobs:
10
10
  uses: actions/setup-node@v2
11
11
  with:
12
12
  node-version: "lts/*"
13
- cache: "yarn"
13
+ # cache: "yarn"
14
14
  - name: Cache multiple paths
15
15
  uses: actions/cache@v2
16
16
  with:
@@ -21,5 +21,5 @@ jobs:
21
21
  **/node_modules
22
22
  key: npm-${{ runner.os }}-${{ hashFiles('package.json') }}
23
23
  - run: yarn
24
- - run: npm run lint
25
- - run: npm run build
24
+ - run: yarn run lint
25
+ - run: yarn run build
@@ -2,6 +2,12 @@
2
2
 
3
3
  在为此存储库做出贡献时,请首先通过 issue、电子邮件或任何其他方法与此存储库的所有者讨论您希望进行的更改,然后再进行更改。
4
4
 
5
+ **注意**:
6
+
7
+ - 提问之前请三思,不要浪费我们的时间
8
+ - 不要问那些你自己就能搞清楚的问题
9
+ - 不要问在文档中提过的问题
10
+
5
11
  ## 开发环境设置
6
12
 
7
13
  要设置开发环境,请按照以下步骤操作:
@@ -29,7 +35,7 @@
29
35
 
30
36
  ## 问题和功能请求
31
37
 
32
- 你在源代码中发现了一个错误,文档中有一个错误,或者你想要一个新功能? 看看[GitHub 讨论](<%= discussionsUrl %>)看看它是否已经在讨论中。您可以通过[在 GitHub 上提交问题](<%= issuesUrl %>)来帮助我们。在创建问题之前,请确保搜索问题存档 - 您的问题可能已经得到解决!
38
+ 你在源代码中发现了一个错误,文档中有一个错误,或者你想要一个新功能? 看看[GitHub 讨论](<%= discussionsUrl %>)看看它是否已经在讨论中。您可以通过[在 GitHub 上提交问题](<%= issuesUrl %>)来帮助我们。在创建问题之前,请确保搜索[问题存档](<%= issuesUrl %>?q=is%3Aissue+is%3Aclosed) - 您的问题可能已经得到解决!
33
39
 
34
40
  请尝试创建以下错误报告:
35
41
 
@@ -68,6 +74,7 @@
68
74
 
69
75
  - 若为 BUG 修复,则选择 `fix`
70
76
  - 若为新增功能,则选择 `feat`
77
+ - 若为性能优化,则选择 `perf`
71
78
  - 若为移除某些功能,则选择 `BREAKING CHANGE`
72
79
  - `BREAKING CHANGE` 和其他破坏性更新,若不是为了修复 BUG,原则上将拒绝该 PR
73
80
 
@@ -75,3 +82,6 @@
75
82
  5. 推送到分支 ( `git push origin feat/your_feature`)
76
83
 
77
84
  6. [打开一个新的 Pull Request](<%= repositoryUrl %>/compare?expand=1)
85
+
86
+ ***
87
+ _This CONTRIBUTING was generated with ❤️ by [cmyr-template-cli](https://github.com/CaoMeiYouRen/cmyr-template-cli)_