cmyr-template-cli 1.11.0 → 1.12.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/dist/index.js +1 -1
- package/dist/plopfile.js +31 -5
- package/package.json +5 -5
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.12.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
|
@@ -52,7 +52,10 @@ if (!Promise.any) {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
const GITHUB_API_URL = 'https://api.github.com';
|
|
55
|
-
const
|
|
55
|
+
const NODEJS_URLS = [
|
|
56
|
+
'https://nodejs.org/zh-cn/download/',
|
|
57
|
+
'http://nodejs.cn/download/',
|
|
58
|
+
];
|
|
56
59
|
const REMOTES = [
|
|
57
60
|
'https://github.com',
|
|
58
61
|
'https://hub.fastgit.xyz',
|
|
@@ -173,6 +176,7 @@ async function init(projectPath, answers) {
|
|
|
173
176
|
loading.succeed('依赖安装成功!');
|
|
174
177
|
}
|
|
175
178
|
catch (error) {
|
|
179
|
+
console.error(error);
|
|
176
180
|
loading.fail('依赖安装失败!');
|
|
177
181
|
process.exit(1);
|
|
178
182
|
}
|
|
@@ -690,12 +694,34 @@ async function getAuthorWebsiteFromGithubAPI(githubUsername) {
|
|
|
690
694
|
return '';
|
|
691
695
|
}
|
|
692
696
|
}
|
|
697
|
+
async function getFastNodeUrl() {
|
|
698
|
+
const loading = ora__default["default"]('正在选择 Node.js 网址');
|
|
699
|
+
loading.start();
|
|
700
|
+
try {
|
|
701
|
+
const fast = await Promise.any(NODEJS_URLS.map((url) => axios__default["default"]({
|
|
702
|
+
url,
|
|
703
|
+
method: 'HEAD',
|
|
704
|
+
timeout: 15 * 1000,
|
|
705
|
+
})));
|
|
706
|
+
loading.succeed(`成功选择了 Node.js 网址 - ${fast.config.url}`);
|
|
707
|
+
return fast.config.url;
|
|
708
|
+
}
|
|
709
|
+
catch (error) {
|
|
710
|
+
console.error(error);
|
|
711
|
+
loading.fail('选择 Node.js 网址失败!');
|
|
712
|
+
}
|
|
713
|
+
}
|
|
693
714
|
async function getLtsNodeVersion() {
|
|
694
|
-
var _a, _b;
|
|
715
|
+
var _a, _b, _c;
|
|
695
716
|
try {
|
|
696
|
-
const
|
|
697
|
-
|
|
698
|
-
|
|
717
|
+
const url = await getFastNodeUrl();
|
|
718
|
+
if (!url) {
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
721
|
+
const html = (await axios__default["default"].get(url)).data;
|
|
722
|
+
const version = (_b = (_a = html.match(/<strong>(.*)<\/strong>/)) === null || _a === void 0 ? void 0 : _a[1]) === null || _b === void 0 ? void 0 : _b.trim();
|
|
723
|
+
console.log(`当前 Node.js 的 lts 版本为 ${version}`);
|
|
724
|
+
return (_c = version === null || version === void 0 ? void 0 : version.split('.')) === null || _c === void 0 ? void 0 : _c[0];
|
|
699
725
|
}
|
|
700
726
|
catch (error) {
|
|
701
727
|
console.error(error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cmyr-template-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.2",
|
|
4
4
|
"description": "草梅友仁自制的项目模板创建器",
|
|
5
5
|
"author": "CaoMeiYouRen",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"build:prod": "npm run build && rimraf temp && cross-env NODE_ENV=production ct create"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@rollup/plugin-commonjs": "^
|
|
35
|
+
"@rollup/plugin-commonjs": "^22.0.0",
|
|
36
36
|
"@rollup/plugin-json": "^4.1.0",
|
|
37
37
|
"@rollup/plugin-node-resolve": "^13.0.5",
|
|
38
38
|
"@rollup/plugin-replace": "^4.0.0",
|
|
@@ -56,20 +56,20 @@
|
|
|
56
56
|
"debug": "^4.3.1",
|
|
57
57
|
"eslint": "^7.14.0",
|
|
58
58
|
"eslint-config-cmyr": "^1.1.14",
|
|
59
|
-
"husky": "^
|
|
59
|
+
"husky": "^8.0.1",
|
|
60
60
|
"lint-staged": "^12.0.2",
|
|
61
61
|
"rimraf": "^3.0.2",
|
|
62
62
|
"rollup": "^2.33.3",
|
|
63
63
|
"rollup-plugin-terser": "^7.0.2",
|
|
64
64
|
"semantic-release": "^19.0.2",
|
|
65
65
|
"ts-node": "^10.2.1",
|
|
66
|
-
"ts-node-dev": "^
|
|
66
|
+
"ts-node-dev": "^2.0.0",
|
|
67
67
|
"typescript": "^4.1.2",
|
|
68
68
|
"validate-commit-msg": "^2.14.0"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"@lint-md/core": "^0.2.1",
|
|
72
|
-
"axios": "^0.
|
|
72
|
+
"axios": "^0.27.1",
|
|
73
73
|
"colors": "^1.4.0",
|
|
74
74
|
"commander": "^9.0.0",
|
|
75
75
|
"dayjs": "^1.9.6",
|