cmyr-template-cli 1.7.6 → 1.8.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 +1 -1
- package/dist/plopfile.js +43 -10
- package/package.json +2 -2
- package/templates/CONTRIBUTING.md +4 -0
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.
|
|
16
|
+
program.version("1.7.6" , '-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
|
-
|
|
136
|
-
|
|
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 {
|
|
@@ -809,6 +833,15 @@ module.exports = function (plop) {
|
|
|
809
833
|
return answers.isOpenSource;
|
|
810
834
|
},
|
|
811
835
|
},
|
|
836
|
+
{
|
|
837
|
+
type: 'confirm',
|
|
838
|
+
name: 'isRemoveYarn',
|
|
839
|
+
message: '是否移除 yarn ?',
|
|
840
|
+
default: false,
|
|
841
|
+
when(answers) {
|
|
842
|
+
return answers.isOpenSource;
|
|
843
|
+
},
|
|
844
|
+
},
|
|
812
845
|
{
|
|
813
846
|
type: 'confirm',
|
|
814
847
|
name: 'isEnableAfdian',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cmyr-template-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
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": "^
|
|
52
|
+
"conventional-changelog-cmyr-config": "^2.0.0",
|
|
53
53
|
"cross-env": "^7.0.2",
|
|
54
54
|
"cz-conventional-changelog": "^3.3.0",
|
|
55
55
|
"cz-conventional-changelog-cmyr": "^1.0.0",
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
|
|
69
69
|
- 若为 BUG 修复,则选择 `fix`
|
|
70
70
|
- 若为新增功能,则选择 `feat`
|
|
71
|
+
- 若为性能优化,则选择 `perf`
|
|
71
72
|
- 若为移除某些功能,则选择 `BREAKING CHANGE`
|
|
72
73
|
- `BREAKING CHANGE` 和其他破坏性更新,若不是为了修复 BUG,原则上将拒绝该 PR
|
|
73
74
|
|
|
@@ -75,3 +76,6 @@
|
|
|
75
76
|
5. 推送到分支 ( `git push origin feat/your_feature`)
|
|
76
77
|
|
|
77
78
|
6. [打开一个新的 Pull Request](<%= repositoryUrl %>/compare?expand=1)
|
|
79
|
+
|
|
80
|
+
***
|
|
81
|
+
_This CONTRIBUTING was generated with ❤️ by [cmyr-template-cli](https://github.com/CaoMeiYouRen/cmyr-template-cli)_
|