cmyr-template-cli 1.8.1 → 1.9.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.8.0" , '-v, --version');
16
+ program.version("1.9.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
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
+ var lodash = require('lodash');
4
5
  var fs = require('fs-extra');
5
6
  var path = require('path');
6
7
  var ora = require('ora');
@@ -9,7 +10,6 @@ var axios = require('axios');
9
10
  var child_process = require('child_process');
10
11
  var colors = require('colors');
11
12
  var ejs = require('ejs');
12
- var lodash = require('lodash');
13
13
  var core = require('@lint-md/core');
14
14
 
15
15
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -53,8 +53,7 @@ const GITHUB_API_URL = 'https://api.github.com';
53
53
  const NODEJS_URL = 'https://nodejs.org/zh-cn/download/';
54
54
  const REMOTES = [
55
55
  'https://github.com',
56
- 'https://hub.fastgit.org',
57
- 'https://github.com.cnpmjs.org',
56
+ 'https://hub.fastgit.xyz',
58
57
  'https://download.fastgit.org',
59
58
  ];
60
59
  async function downloadGitRepo(repository, destination, options = {}) {
@@ -115,7 +114,7 @@ async function initProject(answers) {
115
114
  }
116
115
  async function init(projectPath, answers) {
117
116
  var _a;
118
- const { isOpenSource, isRemoveDependabot, gitRemoteUrl, isInitReadme, isInitContributing, isInitHusky, isInitSemanticRelease } = answers;
117
+ const { isOpenSource, gitRemoteUrl, isInitReadme, isInitContributing, isInitHusky, isInitSemanticRelease } = answers;
119
118
  try {
120
119
  await asyncExec('git --version', {
121
120
  cwd: projectPath,
@@ -150,9 +149,7 @@ async function init(projectPath, answers) {
150
149
  if (isInitContributing) {
151
150
  await initContributing(projectPath, info);
152
151
  }
153
- if (info.licenseName === 'MIT') {
154
- await initLicense(projectPath, info);
155
- }
152
+ await initLicense(projectPath, info);
156
153
  }
157
154
  await initGithubWorkflows(projectPath, answers);
158
155
  }
@@ -271,6 +268,11 @@ async function initProjectJson(projectPath, answers) {
271
268
  },
272
269
  };
273
270
  }
271
+ if (isPublishToNpm) {
272
+ extData.publishConfig = {
273
+ access: 'public',
274
+ };
275
+ }
274
276
  const newPkg = Object.assign({}, pkg, pkgData, extData);
275
277
  await saveProjectJson(projectPath, newPkg);
276
278
  loading.succeed('package.json 初始化成功!');
@@ -327,6 +329,7 @@ async function getProjectInfo(projectPath, answers) {
327
329
  authorName: author,
328
330
  authorGithubUsername: githubUsername,
329
331
  engines,
332
+ license,
330
333
  licenseName: cleanText(license),
331
334
  licenseUrl,
332
335
  documentationUrl,
@@ -410,7 +413,14 @@ async function initContributing(projectPath, projectInfos) {
410
413
  async function initLicense(projectPath, projectInfos) {
411
414
  const loading = ora__default["default"]('正在初始化 LICENSE ……').start();
412
415
  try {
413
- const templatePath = path__default["default"].join(__dirname, '../templates/LICENSE');
416
+ let templatePath = '';
417
+ if (projectInfos.licenseName === 'MIT') {
418
+ templatePath = path__default["default"].join(__dirname, '../templates/licenses/MIT');
419
+ }
420
+ if (!templatePath) {
421
+ loading.fail('无效的 LICENSE Name');
422
+ return;
423
+ }
414
424
  const template = (await fs__default["default"].readFile(templatePath, 'utf8')).toString();
415
425
  const newReadmePath = path__default["default"].join(projectPath, 'LICENSE');
416
426
  const readmeContent = await ejs__default["default"].render(template, projectInfos, {
@@ -693,7 +703,7 @@ module.exports = function (plop) {
693
703
  return input.trim().length !== 0;
694
704
  },
695
705
  default: '',
696
- filter: (e) => e.trim(),
706
+ filter: (e) => lodash.kebabCase(e.trim()),
697
707
  },
698
708
  {
699
709
  type: 'input',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cmyr-template-cli",
3
- "version": "1.8.1",
3
+ "version": "1.9.2",
4
4
  "description": "草梅友仁自制的项目模板创建器",
5
5
  "author": "CaoMeiYouRen",
6
6
  "license": "MIT",
@@ -61,7 +61,7 @@
61
61
  "rimraf": "^3.0.2",
62
62
  "rollup": "^2.33.3",
63
63
  "rollup-plugin-terser": "^7.0.2",
64
- "semantic-release": "^18.0.0",
64
+ "semantic-release": "^19.0.2",
65
65
  "ts-node": "^10.2.1",
66
66
  "ts-node-dev": "^1.0.0",
67
67
  "typescript": "^4.1.2",
@@ -69,9 +69,9 @@
69
69
  },
70
70
  "dependencies": {
71
71
  "@lint-md/core": "^0.2.1",
72
- "axios": "^0.24.0",
72
+ "axios": "^0.26.0",
73
73
  "colors": "^1.4.0",
74
- "commander": "^8.2.0",
74
+ "commander": "^9.0.0",
75
75
  "dayjs": "^1.9.6",
76
76
  "download-git-repo": "^3.0.2",
77
77
  "ejs": "^3.1.6",
@@ -2,6 +2,14 @@
2
2
 
3
3
  在为此存储库做出贡献时,请首先通过 issue、电子邮件或任何其他方法与此存储库的所有者讨论您希望进行的更改,然后再进行更改。
4
4
 
5
+ **建议阅读过 [贡献者公约](https://www.contributor-covenant.org/zh-cn/version/2/0/code_of_conduct/) 后再来参与贡献**
6
+
7
+ **注意**:
8
+
9
+ - 提问之前请三思,不要浪费我们的时间
10
+ - 不要问那些你自己就能搞清楚的问题
11
+ - 不要问在文档中提过的问题
12
+
5
13
  ## 开发环境设置
6
14
 
7
15
  要设置开发环境,请按照以下步骤操作:
@@ -29,7 +37,7 @@
29
37
 
30
38
  ## 问题和功能请求
31
39
 
32
- 你在源代码中发现了一个错误,文档中有一个错误,或者你想要一个新功能? 看看[GitHub 讨论](<%= discussionsUrl %>)看看它是否已经在讨论中。您可以通过[在 GitHub 上提交问题](<%= issuesUrl %>)来帮助我们。在创建问题之前,请确保搜索问题存档 - 您的问题可能已经得到解决!
40
+ 你在源代码中发现了一个错误,文档中有一个错误,或者你想要一个新功能? 看看[GitHub 讨论](<%= discussionsUrl %>)看看它是否已经在讨论中。您可以通过[在 GitHub 上提交问题](<%= issuesUrl %>)来帮助我们。在创建问题之前,请确保搜索[问题存档](<%= issuesUrl %>?q=is%3Aissue+is%3Aclosed) - 您的问题可能已经得到解决!
33
41
 
34
42
  请尝试创建以下错误报告:
35
43
 
File without changes