commit-pack 1.0.18 → 1.0.19
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/bin/index.mjs +0 -66
- package/lib/index.mjs +0 -50
- package/package.json +15 -1
package/bin/index.mjs
CHANGED
|
@@ -59,72 +59,6 @@ if (fs.existsSync(initFlagPath)) {
|
|
|
59
59
|
process.exit(0)
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
// 确保 devDependencies 存在
|
|
63
|
-
if (!packageJson.devDependencies) {
|
|
64
|
-
packageJson.devDependencies = {}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const devDependenciesWithVersion = {
|
|
68
|
-
commitizen: '4.2.4',
|
|
69
|
-
eslint: '8.57.1'
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const devDependencies = [
|
|
73
|
-
'@typescript-eslint/parser',
|
|
74
|
-
'@typescript-eslint/eslint-plugin',
|
|
75
|
-
'prettier',
|
|
76
|
-
'eslint-config-prettier',
|
|
77
|
-
'eslint-plugin-prettier',
|
|
78
|
-
'husky',
|
|
79
|
-
'lint-staged',
|
|
80
|
-
'@commitlint/cli',
|
|
81
|
-
'@commitlint/config-conventional',
|
|
82
|
-
'commitlint-config-cz',
|
|
83
|
-
'cz-customizable',
|
|
84
|
-
'cz-custom'
|
|
85
|
-
]
|
|
86
|
-
|
|
87
|
-
let dependenciesToInstall = []
|
|
88
|
-
|
|
89
|
-
// 检查并收集需要安装的依赖
|
|
90
|
-
for (const dep of devDependencies) {
|
|
91
|
-
if (!packageJson.devDependencies[dep]) {
|
|
92
|
-
dependenciesToInstall.push(dep)
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
for (const [dep, version] of Object.entries(devDependenciesWithVersion)) {
|
|
97
|
-
if (!packageJson.devDependencies[dep]) {
|
|
98
|
-
dependenciesToInstall.push(`${dep}@${version}`)
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// 安装缺失的依赖
|
|
103
|
-
if (dependenciesToInstall.length > 0) {
|
|
104
|
-
let installCommand = ''
|
|
105
|
-
|
|
106
|
-
switch (packageManager) {
|
|
107
|
-
case 'pnpm':
|
|
108
|
-
installCommand = `pnpm add -D ${dependenciesToInstall.join(' ')}`
|
|
109
|
-
break
|
|
110
|
-
case 'yarn':
|
|
111
|
-
installCommand = `yarn add ${dependenciesToInstall.join(' ')} --dev`
|
|
112
|
-
break
|
|
113
|
-
case 'bun':
|
|
114
|
-
installCommand = `bun add -d ${dependenciesToInstall.join(' ')}`
|
|
115
|
-
break
|
|
116
|
-
default:
|
|
117
|
-
installCommand = `npm install ${dependenciesToInstall.join(' ')} --save-dev`
|
|
118
|
-
break
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
console.log(chalk.green(`正在安装开发依赖:${dependenciesToInstall.join(', ')}`))
|
|
122
|
-
console.log(chalk.green(`执行命令:${installCommand}`))
|
|
123
|
-
execSync(installCommand, { stdio: 'inherit', cwd: projectRoot })
|
|
124
|
-
} else {
|
|
125
|
-
console.log(chalk.yellow('所有开发依赖已安装,无需安装'))
|
|
126
|
-
}
|
|
127
|
-
|
|
128
62
|
let isGitRepo = false
|
|
129
63
|
|
|
130
64
|
try {
|
package/lib/index.mjs
CHANGED
|
@@ -52,56 +52,6 @@ if (_fs.default.existsSync(initFlagPath)) {
|
|
|
52
52
|
console.log(_chalk.default.yellow('已检测到初始化标志文件,跳过初始化'));
|
|
53
53
|
process.exit(0);
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
// 确保 devDependencies 存在
|
|
57
|
-
if (!packageJson.devDependencies) {
|
|
58
|
-
packageJson.devDependencies = {};
|
|
59
|
-
}
|
|
60
|
-
const devDependenciesWithVersion = {
|
|
61
|
-
commitizen: '4.2.4',
|
|
62
|
-
eslint: '8.57.1'
|
|
63
|
-
};
|
|
64
|
-
const devDependencies = ['@typescript-eslint/parser', '@typescript-eslint/eslint-plugin', 'prettier', 'eslint-config-prettier', 'eslint-plugin-prettier', 'husky', 'lint-staged', '@commitlint/cli', '@commitlint/config-conventional', 'commitlint-config-cz', 'cz-customizable', 'cz-custom'];
|
|
65
|
-
let dependenciesToInstall = [];
|
|
66
|
-
|
|
67
|
-
// 检查并收集需要安装的依赖
|
|
68
|
-
for (const dep of devDependencies) {
|
|
69
|
-
if (!packageJson.devDependencies[dep]) {
|
|
70
|
-
dependenciesToInstall.push(dep);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
for (const [dep, version] of Object.entries(devDependenciesWithVersion)) {
|
|
74
|
-
if (!packageJson.devDependencies[dep]) {
|
|
75
|
-
dependenciesToInstall.push(`${dep}@${version}`);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// 安装缺失的依赖
|
|
80
|
-
if (dependenciesToInstall.length > 0) {
|
|
81
|
-
let installCommand = '';
|
|
82
|
-
switch (packageManager) {
|
|
83
|
-
case 'pnpm':
|
|
84
|
-
installCommand = `pnpm add -D ${dependenciesToInstall.join(' ')}`;
|
|
85
|
-
break;
|
|
86
|
-
case 'yarn':
|
|
87
|
-
installCommand = `yarn add ${dependenciesToInstall.join(' ')} --dev`;
|
|
88
|
-
break;
|
|
89
|
-
case 'bun':
|
|
90
|
-
installCommand = `bun add -d ${dependenciesToInstall.join(' ')}`;
|
|
91
|
-
break;
|
|
92
|
-
default:
|
|
93
|
-
installCommand = `npm install ${dependenciesToInstall.join(' ')} --save-dev`;
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
console.log(_chalk.default.green(`正在安装开发依赖:${dependenciesToInstall.join(', ')}`));
|
|
97
|
-
console.log(_chalk.default.green(`执行命令:${installCommand}`));
|
|
98
|
-
(0, _child_process.execSync)(installCommand, {
|
|
99
|
-
stdio: 'inherit',
|
|
100
|
-
cwd: projectRoot
|
|
101
|
-
});
|
|
102
|
-
} else {
|
|
103
|
-
console.log(_chalk.default.yellow('所有开发依赖已安装,无需安装'));
|
|
104
|
-
}
|
|
105
55
|
let isGitRepo = false;
|
|
106
56
|
try {
|
|
107
57
|
// 获取 Git 仓库的顶级目录
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "commit-pack",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.19",
|
|
4
4
|
"description": "A setup package to automatly check project's style and commit configuration",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -33,6 +33,20 @@
|
|
|
33
33
|
],
|
|
34
34
|
"author": "jett191",
|
|
35
35
|
"license": "MIT",
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@typescript-eslint/parser": "^8.12.2",
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "^8.12.2",
|
|
39
|
+
"prettier": "^3.3.3",
|
|
40
|
+
"eslint-config-prettier": "^9.1.0",
|
|
41
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
42
|
+
"husky": "^9.1.6",
|
|
43
|
+
"lint-staged": "^15.2.10",
|
|
44
|
+
"@commitlint/cli": "^19.5.0",
|
|
45
|
+
"@commitlint/config-conventional": "^19.5.0",
|
|
46
|
+
"commitlint-config-cz": "^0.13.3",
|
|
47
|
+
"cz-custom": "^0.0.2",
|
|
48
|
+
"cz-customizable": "^7.2.1"
|
|
49
|
+
},
|
|
36
50
|
"devDependencies": {
|
|
37
51
|
"@babel/cli": "^7.25.9",
|
|
38
52
|
"@babel/core": "^7.26.0",
|