cmyr-template-cli 1.8.2 → 1.9.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 +13 -7
- package/package.json +1 -1
- /package/templates/{LICENSE → licenses/MIT} +0 -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.8.
|
|
16
|
+
program.version("1.8.2" , '-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 }; }
|
|
@@ -115,7 +115,7 @@ async function initProject(answers) {
|
|
|
115
115
|
}
|
|
116
116
|
async function init(projectPath, answers) {
|
|
117
117
|
var _a;
|
|
118
|
-
const { isOpenSource,
|
|
118
|
+
const { isOpenSource, gitRemoteUrl, isInitReadme, isInitContributing, isInitHusky, isInitSemanticRelease } = answers;
|
|
119
119
|
try {
|
|
120
120
|
await asyncExec('git --version', {
|
|
121
121
|
cwd: projectPath,
|
|
@@ -150,9 +150,7 @@ async function init(projectPath, answers) {
|
|
|
150
150
|
if (isInitContributing) {
|
|
151
151
|
await initContributing(projectPath, info);
|
|
152
152
|
}
|
|
153
|
-
|
|
154
|
-
await initLicense(projectPath, info);
|
|
155
|
-
}
|
|
153
|
+
await initLicense(projectPath, info);
|
|
156
154
|
}
|
|
157
155
|
await initGithubWorkflows(projectPath, answers);
|
|
158
156
|
}
|
|
@@ -332,6 +330,7 @@ async function getProjectInfo(projectPath, answers) {
|
|
|
332
330
|
authorName: author,
|
|
333
331
|
authorGithubUsername: githubUsername,
|
|
334
332
|
engines,
|
|
333
|
+
license,
|
|
335
334
|
licenseName: cleanText(license),
|
|
336
335
|
licenseUrl,
|
|
337
336
|
documentationUrl,
|
|
@@ -415,7 +414,14 @@ async function initContributing(projectPath, projectInfos) {
|
|
|
415
414
|
async function initLicense(projectPath, projectInfos) {
|
|
416
415
|
const loading = ora__default["default"]('正在初始化 LICENSE ……').start();
|
|
417
416
|
try {
|
|
418
|
-
|
|
417
|
+
let templatePath = '';
|
|
418
|
+
if (projectInfos.licenseName === 'MIT') {
|
|
419
|
+
templatePath = path__default["default"].join(__dirname, '../templates/licenses/MIT');
|
|
420
|
+
}
|
|
421
|
+
if (!templatePath) {
|
|
422
|
+
loading.fail('无效的 LICENSE Name');
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
419
425
|
const template = (await fs__default["default"].readFile(templatePath, 'utf8')).toString();
|
|
420
426
|
const newReadmePath = path__default["default"].join(projectPath, 'LICENSE');
|
|
421
427
|
const readmeContent = await ejs__default["default"].render(template, projectInfos, {
|
|
@@ -698,7 +704,7 @@ module.exports = function (plop) {
|
|
|
698
704
|
return input.trim().length !== 0;
|
|
699
705
|
},
|
|
700
706
|
default: '',
|
|
701
|
-
filter: (e) => e.trim(),
|
|
707
|
+
filter: (e) => lodash.kebabCase(e.trim()),
|
|
702
708
|
},
|
|
703
709
|
{
|
|
704
710
|
type: 'input',
|
package/package.json
CHANGED
|
File without changes
|