cmyr-template-cli 1.6.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 +1 -1
- package/dist/plopfile.js +195 -16
- package/package.json +1 -1
- 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 +13 -14
- package/templates/LICENSE +21 -0
- package/templates/commitlint.config.js +20 -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.
|
|
16
|
+
program.version("1.6.0" , '-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,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var path = require('path');
|
|
5
4
|
var fs = require('fs-extra');
|
|
5
|
+
var path = require('path');
|
|
6
6
|
var ora = require('ora');
|
|
7
7
|
var download = require('download-git-repo');
|
|
8
8
|
var axios = require('axios');
|
|
@@ -32,8 +32,8 @@ function _interopNamespace(e) {
|
|
|
32
32
|
return Object.freeze(n);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
|
|
36
35
|
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
|
|
36
|
+
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
|
|
37
37
|
var ora__default = /*#__PURE__*/_interopDefaultLegacy(ora);
|
|
38
38
|
var download__default = /*#__PURE__*/_interopDefaultLegacy(download);
|
|
39
39
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
@@ -106,8 +106,16 @@ async function asyncExec(cmd, options) {
|
|
|
106
106
|
});
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
|
+
async function initProject(answers) {
|
|
110
|
+
const { name, template } = answers;
|
|
111
|
+
const projectPath = path__default["default"].join(process.cwd(), name);
|
|
112
|
+
await downloadGitRepo(`CaoMeiYouRen/${template}`, projectPath);
|
|
113
|
+
await init(projectPath, answers);
|
|
114
|
+
return '- 下载项目模板成功!';
|
|
115
|
+
}
|
|
109
116
|
async function init(projectPath, answers) {
|
|
110
|
-
|
|
117
|
+
var _a;
|
|
118
|
+
const { isOpenSource, isRemoveDependabot, gitRemoteUrl, isInitReadme, isInitContributing, isInitHusky } = answers;
|
|
111
119
|
try {
|
|
112
120
|
await asyncExec('git --version', {
|
|
113
121
|
cwd: projectPath,
|
|
@@ -134,7 +142,7 @@ async function init(projectPath, answers) {
|
|
|
134
142
|
await fs__default["default"].remove(mergifyPath);
|
|
135
143
|
}
|
|
136
144
|
}
|
|
137
|
-
await initProjectJson(projectPath, answers);
|
|
145
|
+
const newPkg = await initProjectJson(projectPath, answers);
|
|
138
146
|
if (isOpenSource) {
|
|
139
147
|
const info = await getProjectInfo(projectPath, answers);
|
|
140
148
|
if (info) {
|
|
@@ -144,14 +152,19 @@ async function init(projectPath, answers) {
|
|
|
144
152
|
if (isInitContributing) {
|
|
145
153
|
await initContributing(projectPath, info);
|
|
146
154
|
}
|
|
155
|
+
if (info.licenseName === 'MIT') {
|
|
156
|
+
await initLicense(projectPath, info);
|
|
157
|
+
}
|
|
158
|
+
if (isInitHusky) {
|
|
159
|
+
await initHusky(projectPath, info);
|
|
160
|
+
}
|
|
147
161
|
}
|
|
162
|
+
await initGithubWorkflows(projectPath, info);
|
|
148
163
|
}
|
|
164
|
+
await initConfig(projectPath);
|
|
149
165
|
await asyncExec('git add .', {
|
|
150
166
|
cwd: projectPath,
|
|
151
167
|
});
|
|
152
|
-
await asyncExec('git commit -m "chore: init"', {
|
|
153
|
-
cwd: projectPath,
|
|
154
|
-
});
|
|
155
168
|
const loading = ora__default["default"]('正在安装依赖……').start();
|
|
156
169
|
try {
|
|
157
170
|
await asyncExec(`${PACKAGE_MANAGER} i`, {
|
|
@@ -161,17 +174,29 @@ async function init(projectPath, answers) {
|
|
|
161
174
|
}
|
|
162
175
|
catch (error) {
|
|
163
176
|
loading.fail('依赖安装失败!');
|
|
177
|
+
process.exit(1);
|
|
178
|
+
}
|
|
179
|
+
await asyncExec('git add .', {
|
|
180
|
+
cwd: projectPath,
|
|
181
|
+
});
|
|
182
|
+
if ((_a = newPkg === null || newPkg === void 0 ? void 0 : newPkg.scripts) === null || _a === void 0 ? void 0 : _a.lint) {
|
|
183
|
+
await asyncExec(`${PACKAGE_MANAGER} run lint`, {
|
|
184
|
+
cwd: projectPath,
|
|
185
|
+
});
|
|
164
186
|
}
|
|
165
187
|
await asyncExec('git add .', {
|
|
166
188
|
cwd: projectPath,
|
|
167
189
|
});
|
|
190
|
+
await asyncExec('git commit -m "chore: init"', {
|
|
191
|
+
cwd: projectPath,
|
|
192
|
+
});
|
|
168
193
|
}
|
|
169
194
|
catch (error) {
|
|
170
195
|
console.error(error);
|
|
171
196
|
}
|
|
172
197
|
}
|
|
173
198
|
async function getGitUserName() {
|
|
174
|
-
const username = (await asyncExec('git config user.name'));
|
|
199
|
+
const username = (await asyncExec('git config user.name')) || '';
|
|
175
200
|
return username.trim();
|
|
176
201
|
}
|
|
177
202
|
async function initProjectJson(projectPath, answers) {
|
|
@@ -182,7 +207,7 @@ async function initProjectJson(projectPath, answers) {
|
|
|
182
207
|
const homepage = `${repositoryUrl}#readme`;
|
|
183
208
|
const issuesUrl = `${repositoryUrl}/issues`;
|
|
184
209
|
const gitUrl = `git+${repositoryUrl}.git`;
|
|
185
|
-
const nodeVersion = await getLtsNodeVersion() || '
|
|
210
|
+
const nodeVersion = await getLtsNodeVersion() || '16';
|
|
186
211
|
const node = Number(nodeVersion) - 4;
|
|
187
212
|
const pkgPath = path__default["default"].join(projectPath, 'package.json');
|
|
188
213
|
const pkg = await fs__default["default"].readJSON(pkgPath);
|
|
@@ -208,11 +233,20 @@ async function initProjectJson(projectPath, answers) {
|
|
|
208
233
|
bugs: {
|
|
209
234
|
url: issuesUrl,
|
|
210
235
|
},
|
|
236
|
+
devDependencies: {
|
|
237
|
+
'conventional-changelog-cli': '^2.1.1',
|
|
238
|
+
'conventional-changelog-cmyr-config': `^${await getNpmPackageVersion('conventional-changelog-cmyr-config')}`,
|
|
239
|
+
...pkg === null || pkg === void 0 ? void 0 : pkg.devDependencies,
|
|
240
|
+
},
|
|
241
|
+
changelog: {
|
|
242
|
+
language: 'zh',
|
|
243
|
+
},
|
|
211
244
|
};
|
|
212
245
|
}
|
|
213
246
|
const newPkg = Object.assign({}, pkg, pkgData, extData);
|
|
214
247
|
await fs__default["default"].writeFile(pkgPath, JSON.stringify(newPkg, null, 2));
|
|
215
248
|
loading.succeed('package.json 初始化成功!');
|
|
249
|
+
return newPkg;
|
|
216
250
|
}
|
|
217
251
|
catch (error) {
|
|
218
252
|
console.error(error);
|
|
@@ -249,6 +283,7 @@ async function getProjectInfo(projectPath, answers) {
|
|
|
249
283
|
const discussionsUrl = `${repositoryUrl}/discussions`;
|
|
250
284
|
const pullRequestsUrl = `${repositoryUrl}/pulls`;
|
|
251
285
|
const projectInfos = {
|
|
286
|
+
...answers,
|
|
252
287
|
currentYear: new Date().getFullYear(),
|
|
253
288
|
name,
|
|
254
289
|
description,
|
|
@@ -343,6 +378,143 @@ async function initContributing(projectPath, projectInfos) {
|
|
|
343
378
|
console.error(error);
|
|
344
379
|
}
|
|
345
380
|
}
|
|
381
|
+
async function initLicense(projectPath, projectInfos) {
|
|
382
|
+
const loading = ora__default["default"]('正在初始化 LICENSE ……').start();
|
|
383
|
+
try {
|
|
384
|
+
const templatePath = path__default["default"].join(__dirname, '../templates/LICENSE');
|
|
385
|
+
const template = (await fs__default["default"].readFile(templatePath, 'utf8')).toString();
|
|
386
|
+
const newReadmePath = path__default["default"].join(projectPath, 'LICENSE');
|
|
387
|
+
const readmeContent = await ejs__default["default"].render(template, projectInfos, {
|
|
388
|
+
debug: false,
|
|
389
|
+
async: true,
|
|
390
|
+
});
|
|
391
|
+
if (await fs__default["default"].pathExists(newReadmePath)) {
|
|
392
|
+
await fs__default["default"].remove(newReadmePath);
|
|
393
|
+
}
|
|
394
|
+
await fs__default["default"].writeFile(newReadmePath, lodash.unescape(readmeContent));
|
|
395
|
+
loading.succeed('LICENSE 初始化成功!');
|
|
396
|
+
}
|
|
397
|
+
catch (error) {
|
|
398
|
+
loading.fail('LICENSE 初始化失败!');
|
|
399
|
+
console.error(error);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
async function initConfig(projectPath) {
|
|
403
|
+
try {
|
|
404
|
+
const files = ['.editorconfig', 'commitlint.config.js'];
|
|
405
|
+
files.forEach(async (file) => {
|
|
406
|
+
const templatePath = path__default["default"].join(__dirname, '../templates/', file);
|
|
407
|
+
const newPath = path__default["default"].join(projectPath, file);
|
|
408
|
+
if (await fs__default["default"].pathExists(newPath)) {
|
|
409
|
+
await fs__default["default"].remove(newPath);
|
|
410
|
+
}
|
|
411
|
+
await fs__default["default"].copyFile(templatePath, newPath);
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
catch (error) {
|
|
415
|
+
console.error(error);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
async function initGithubWorkflows(projectPath, projectInfos) {
|
|
419
|
+
const loading = ora__default["default"]('正在初始化 Github Workflows ……').start();
|
|
420
|
+
try {
|
|
421
|
+
const { isPublishToNpm } = projectInfos;
|
|
422
|
+
const files = ['.github/workflows/test.yml'];
|
|
423
|
+
const dir = path__default["default"].join(projectPath, '.github/workflows');
|
|
424
|
+
if (!await fs__default["default"].pathExists(dir)) {
|
|
425
|
+
await fs__default["default"].mkdirp(dir);
|
|
426
|
+
}
|
|
427
|
+
const releaseYml = '.github/workflows/release.yml';
|
|
428
|
+
if (isPublishToNpm) {
|
|
429
|
+
files.push(releaseYml);
|
|
430
|
+
const oldReleaseYml = path__default["default"].join(projectPath, '.github/release.yml');
|
|
431
|
+
if (await fs__default["default"].pathExists(oldReleaseYml)) {
|
|
432
|
+
await fs__default["default"].remove(oldReleaseYml);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
else {
|
|
436
|
+
const oldReleaseYml = path__default["default"].join(projectPath, releaseYml);
|
|
437
|
+
if (await fs__default["default"].pathExists(oldReleaseYml)) {
|
|
438
|
+
await fs__default["default"].remove(oldReleaseYml);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
files.forEach(async (file) => {
|
|
442
|
+
const templatePath = path__default["default"].join(__dirname, '../templates/', file);
|
|
443
|
+
const newPath = path__default["default"].join(projectPath, file);
|
|
444
|
+
if (await fs__default["default"].pathExists(newPath)) {
|
|
445
|
+
await fs__default["default"].remove(newPath);
|
|
446
|
+
}
|
|
447
|
+
await fs__default["default"].copyFile(templatePath, newPath);
|
|
448
|
+
});
|
|
449
|
+
loading.succeed('Github Workflows 初始化成功!');
|
|
450
|
+
}
|
|
451
|
+
catch (error) {
|
|
452
|
+
loading.fail('Github Workflows 初始化失败!');
|
|
453
|
+
console.error(error);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
async function initHusky(projectPath, projectInfos) {
|
|
457
|
+
var _a, _b;
|
|
458
|
+
const loading = ora__default["default"]('正在初始化 husky ……').start();
|
|
459
|
+
try {
|
|
460
|
+
const files = ['.husky/commit-msg', '.husky/pre-commit'];
|
|
461
|
+
const dir = path__default["default"].join(projectPath, '.husky');
|
|
462
|
+
if (!await fs__default["default"].pathExists(dir)) {
|
|
463
|
+
await fs__default["default"].mkdirp(dir);
|
|
464
|
+
}
|
|
465
|
+
files.forEach(async (file) => {
|
|
466
|
+
const templatePath = path__default["default"].join(__dirname, '../templates/', file);
|
|
467
|
+
const newPath = path__default["default"].join(projectPath, file);
|
|
468
|
+
if (await fs__default["default"].pathExists(newPath)) {
|
|
469
|
+
await fs__default["default"].remove(newPath);
|
|
470
|
+
}
|
|
471
|
+
await fs__default["default"].copyFile(templatePath, newPath);
|
|
472
|
+
});
|
|
473
|
+
const extnames = ['js', 'ts'];
|
|
474
|
+
const pkgPath = path__default["default"].join(projectPath, 'package.json');
|
|
475
|
+
const pkg = await fs__default["default"].readJSON(pkgPath);
|
|
476
|
+
if ((_a = pkg === null || pkg === void 0 ? void 0 : pkg.dependencies) === null || _a === void 0 ? void 0 : _a.vue) {
|
|
477
|
+
extnames.push('vue');
|
|
478
|
+
}
|
|
479
|
+
if ((_b = pkg === null || pkg === void 0 ? void 0 : pkg.dependencies) === null || _b === void 0 ? void 0 : _b.react) {
|
|
480
|
+
extnames.push('jsx', 'tsx');
|
|
481
|
+
}
|
|
482
|
+
const keyname = `*.{${extnames.join(',')}}`;
|
|
483
|
+
const devDependencies = {
|
|
484
|
+
'@commitlint/cli': '^15.0.0',
|
|
485
|
+
'@commitlint/config-conventional': '^15.0.0',
|
|
486
|
+
commitizen: '^4.2.3',
|
|
487
|
+
'cz-conventional-changelog': '^3.3.0',
|
|
488
|
+
husky: '^7.0.4',
|
|
489
|
+
'lint-staged': '^12.1.2',
|
|
490
|
+
};
|
|
491
|
+
const pkgData = {
|
|
492
|
+
devDependencies: {
|
|
493
|
+
...devDependencies,
|
|
494
|
+
...pkg === null || pkg === void 0 ? void 0 : pkg.devDependencies,
|
|
495
|
+
},
|
|
496
|
+
husky: undefined,
|
|
497
|
+
config: {
|
|
498
|
+
commitizen: {
|
|
499
|
+
path: 'cz-conventional-changelog',
|
|
500
|
+
},
|
|
501
|
+
},
|
|
502
|
+
'lint-staged': {
|
|
503
|
+
[keyname]: [
|
|
504
|
+
'npm run lint',
|
|
505
|
+
'git add',
|
|
506
|
+
],
|
|
507
|
+
},
|
|
508
|
+
};
|
|
509
|
+
const newPkg = Object.assign({}, pkg, pkgData);
|
|
510
|
+
await fs__default["default"].writeFile(pkgPath, JSON.stringify(newPkg, null, 2));
|
|
511
|
+
loading.succeed('husky 初始化成功!');
|
|
512
|
+
}
|
|
513
|
+
catch (error) {
|
|
514
|
+
loading.fail('husky 初始化失败!');
|
|
515
|
+
console.error(error);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
346
518
|
async function getAuthorWebsiteFromGithubAPI(githubUsername) {
|
|
347
519
|
try {
|
|
348
520
|
const userData = (await axios__default["default"].get(`${GITHUB_API_URL}/users/${githubUsername}`)).data;
|
|
@@ -366,6 +538,10 @@ async function getLtsNodeVersion() {
|
|
|
366
538
|
return '';
|
|
367
539
|
}
|
|
368
540
|
}
|
|
541
|
+
async function getNpmPackageVersion(name) {
|
|
542
|
+
const version = (await asyncExec(`${PACKAGE_MANAGER} view ${name} version`)) || '';
|
|
543
|
+
return version.trim();
|
|
544
|
+
}
|
|
369
545
|
function lintMd(markdown) {
|
|
370
546
|
const rules = {
|
|
371
547
|
'no-empty-code': 0,
|
|
@@ -379,13 +555,7 @@ function lintMd(markdown) {
|
|
|
379
555
|
}
|
|
380
556
|
|
|
381
557
|
module.exports = function (plop) {
|
|
382
|
-
plop.setActionType('initProject',
|
|
383
|
-
const { name, template } = answers;
|
|
384
|
-
const projectPath = path__default["default"].join(process.cwd(), name);
|
|
385
|
-
await downloadGitRepo(`CaoMeiYouRen/${template}`, projectPath);
|
|
386
|
-
await init(projectPath, answers);
|
|
387
|
-
return '- 下载项目模板成功!';
|
|
388
|
-
});
|
|
558
|
+
plop.setActionType('initProject', initProject);
|
|
389
559
|
plop.setGenerator('create', {
|
|
390
560
|
description: '草梅项目创建器',
|
|
391
561
|
async prompts(inquirer) {
|
|
@@ -484,6 +654,15 @@ module.exports = function (plop) {
|
|
|
484
654
|
return answers.isOpenSource;
|
|
485
655
|
},
|
|
486
656
|
},
|
|
657
|
+
{
|
|
658
|
+
type: 'confirm',
|
|
659
|
+
name: 'isInitHusky',
|
|
660
|
+
message: '是否初始化 husky?',
|
|
661
|
+
default: false,
|
|
662
|
+
when(answers) {
|
|
663
|
+
return answers.isOpenSource;
|
|
664
|
+
},
|
|
665
|
+
},
|
|
487
666
|
{
|
|
488
667
|
type: 'confirm',
|
|
489
668
|
name: 'isInitReadme',
|
package/package.json
CHANGED
|
@@ -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
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
1. Clone 本项目
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
|
-
git clone <%= repositoryUrl
|
|
12
|
+
git clone <%= repositoryUrl %>.git
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
2. 安装依赖
|
|
@@ -19,10 +19,9 @@
|
|
|
19
19
|
# 或 yarn
|
|
20
20
|
# 或 pnpm i
|
|
21
21
|
```
|
|
22
|
-
|
|
22
|
+
<% if (devCommand) { -%>
|
|
23
23
|
3. 运行开发环境
|
|
24
24
|
|
|
25
|
-
<% if (devCommand) { -%>
|
|
26
25
|
```sh
|
|
27
26
|
<%= devCommand %>
|
|
28
27
|
```
|
|
@@ -34,12 +33,12 @@
|
|
|
34
33
|
|
|
35
34
|
请尝试创建以下错误报告:
|
|
36
35
|
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
36
|
+
- *可重现*。包括重现问题的步骤。
|
|
37
|
+
- *具体的*。包括尽可能多的细节:哪个版本,什么环境等。
|
|
38
|
+
- *独特的*。不要复制现有的已打开问题。
|
|
39
|
+
- *范围仅限于单个错误*。每个报告一个错误。
|
|
41
40
|
|
|
42
|
-
|
|
41
|
+
**更好的是:提交带有修复或新功能的 Pull Requests!**
|
|
43
42
|
|
|
44
43
|
### 如何提交拉取请求
|
|
45
44
|
|
|
@@ -65,14 +64,14 @@
|
|
|
65
64
|
#若觉得修改太多也可分开提交。先 git add 一部分,执行 git cz 提交后再提交另外一部分
|
|
66
65
|
```
|
|
67
66
|
|
|
68
|
-
|
|
67
|
+
关于选项,参考 [semantic-release](https://github.com/semantic-release/semantic-release) 的文档
|
|
69
68
|
|
|
70
|
-
- 若为 BUG 修复,则选择 `fix`
|
|
71
|
-
- 若为新增功能,则选择 `feat
|
|
72
|
-
- 若为移除某些功能,则选择 `perf` 或填写 `BREAKING CHANGE`
|
|
73
|
-
|
|
69
|
+
- 若为 BUG 修复,则选择 `fix`
|
|
70
|
+
- 若为新增功能,则选择 `feat`
|
|
71
|
+
- 若为移除某些功能,则选择 `perf` 或填写 `BREAKING CHANGE`
|
|
72
|
+
- `perf` 和其他破坏性更新,若不是为了修复 BUG,原则上将拒绝该 PR
|
|
74
73
|
|
|
75
74
|
|
|
76
75
|
5. 推送到分支 ( `git push origin feat/your_feature`)
|
|
77
76
|
|
|
78
|
-
6. [打开一个新的 Pull Request](<%= repositoryUrl %>/compare?expand=1)
|
|
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.
|
|
@@ -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
|
+
}
|