@vv0rkz/js-template 1.4.2 → 1.4.3
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/init.js +9 -1
- package/package.json +1 -1
package/bin/init.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { fileURLToPath } from 'url'
|
|
3
3
|
import { dirname, join } from 'path'
|
|
4
|
-
import { copyFileSync, mkdirSync, existsSync, readFileSync, writeFileSync, readdirSync, statSync } from 'fs'
|
|
4
|
+
import { copyFileSync, mkdirSync, existsSync, readFileSync, writeFileSync, readdirSync, statSync, unlinkSync } from 'fs'
|
|
5
5
|
import { execSync, spawnSync } from 'child_process'
|
|
6
6
|
import * as readline from 'readline'
|
|
7
7
|
|
|
@@ -160,6 +160,14 @@ try {
|
|
|
160
160
|
console.log('\n🔗 Активация husky...')
|
|
161
161
|
try {
|
|
162
162
|
execSync('npx husky init', { stdio: 'inherit', cwd: targetDir })
|
|
163
|
+
|
|
164
|
+
// Удаляем дефолтный pre-commit с npm test
|
|
165
|
+
const defaultPreCommit = join(targetDir, '.husky', 'pre-commit')
|
|
166
|
+
if (existsSync(defaultPreCommit)) {
|
|
167
|
+
unlinkSync(defaultPreCommit) // ← Теперь без await import
|
|
168
|
+
console.log(' 🧹 Удалён дефолтный pre-commit')
|
|
169
|
+
}
|
|
170
|
+
|
|
163
171
|
console.log(' ✅ Husky активирован')
|
|
164
172
|
} catch (error) {
|
|
165
173
|
console.log(' ⚠️ Husky уже инициализирован')
|