@vv0rkz/js-template 1.2.1 → 1.3.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/bin/cli.js +5 -0
- package/bin/init.js +12 -0
- package/package.json +1 -1
- package/tools-gh/setup-labels.js +59 -0
package/bin/cli.js
CHANGED
|
@@ -26,6 +26,10 @@ const commands = {
|
|
|
26
26
|
spawnSync('node', [join(toolsDir, 'init-readme.js')], { stdio: 'inherit' })
|
|
27
27
|
},
|
|
28
28
|
|
|
29
|
+
'setup-labels': () => {
|
|
30
|
+
spawnSync('node', [join(toolsDir, 'setup-labels.js')], { stdio: 'inherit' })
|
|
31
|
+
},
|
|
32
|
+
|
|
29
33
|
changelog: () => {
|
|
30
34
|
// БЕЗ shell: true
|
|
31
35
|
spawnSync(npxCmd, ['changelogen', ...commandArgs], { stdio: 'inherit' })
|
|
@@ -105,6 +109,7 @@ if (commands[command]) {
|
|
|
105
109
|
📋 ПРОЕКТ:
|
|
106
110
|
jst init Инициализация проекта
|
|
107
111
|
jst init-readme Создать стартовый README.md
|
|
112
|
+
jst setup-labels Настроить GitHub labels
|
|
108
113
|
|
|
109
114
|
🔧 РАЗРАБОТКА:
|
|
110
115
|
jst changelog Создать changelog
|
package/bin/init.js
CHANGED
|
@@ -107,6 +107,18 @@ try {
|
|
|
107
107
|
} catch (error) {
|
|
108
108
|
console.log(' ⚠️ Husky уже инициализирован')
|
|
109
109
|
}
|
|
110
|
+
// 7. Настройка GitHub labels
|
|
111
|
+
console.log('\n🏷️ Настройка GitHub labels...')
|
|
112
|
+
try {
|
|
113
|
+
execSync('gh auth status', { stdio: 'ignore' })
|
|
114
|
+
const setupLabels = spawnSync('node', [join(toolsDir, 'setup-labels.js')], { stdio: 'inherit' })
|
|
115
|
+
if (setupLabels.status === 0) {
|
|
116
|
+
console.log(' ✅ Labels настроены')
|
|
117
|
+
}
|
|
118
|
+
} catch (error) {
|
|
119
|
+
console.log(' ⏭️ Пропущено (GitHub CLI не настроен)')
|
|
120
|
+
console.log(' Запусти позже: npm run _ setup-labels')
|
|
121
|
+
}
|
|
110
122
|
|
|
111
123
|
console.log(`
|
|
112
124
|
🎉 JS Template успешно установлен!
|
package/package.json
CHANGED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { execSync } from 'child_process'
|
|
3
|
+
|
|
4
|
+
console.log('🏷️ Настройка GitHub labels...\n')
|
|
5
|
+
|
|
6
|
+
const labels = [
|
|
7
|
+
{ name: 'task', color: '0E8A16', description: 'Задача для реализации' },
|
|
8
|
+
{ name: 'bug', color: 'D73A4A', description: 'Баг который нужно исправить' },
|
|
9
|
+
{ name: 'enhancement', color: 'A2EEEF', description: 'Улучшение функционала' },
|
|
10
|
+
{ name: 'documentation', color: '0075CA', description: 'Документация' },
|
|
11
|
+
{ name: 'question', color: 'D876E3', description: 'Вопрос' },
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
// Проверяем что gh установлен и авторизован
|
|
16
|
+
execSync('gh auth status', { stdio: 'ignore' })
|
|
17
|
+
} catch (error) {
|
|
18
|
+
console.error('❌ GitHub CLI не установлен или не авторизован')
|
|
19
|
+
console.log('💡 Установи: https://cli.github.com/')
|
|
20
|
+
console.log(' И выполни: gh auth login')
|
|
21
|
+
process.exit(1)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Получаем существующие labels
|
|
25
|
+
let existingLabels = []
|
|
26
|
+
try {
|
|
27
|
+
const output = execSync('gh label list --json name', { encoding: 'utf8' })
|
|
28
|
+
existingLabels = JSON.parse(output).map((l) => l.name)
|
|
29
|
+
} catch (error) {
|
|
30
|
+
console.log('⚠️ Не удалось получить список labels (возможно репозиторий пустой)')
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Создаём недостающие labels
|
|
34
|
+
let created = 0
|
|
35
|
+
let skipped = 0
|
|
36
|
+
|
|
37
|
+
for (const label of labels) {
|
|
38
|
+
if (existingLabels.includes(label.name)) {
|
|
39
|
+
console.log(` ⏭️ ${label.name} (уже существует)`)
|
|
40
|
+
skipped++
|
|
41
|
+
continue
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
execSync(`gh label create "${label.name}" --color "${label.color}" --description "${label.description}"`, {
|
|
46
|
+
stdio: 'ignore',
|
|
47
|
+
})
|
|
48
|
+
console.log(` ✅ ${label.name}`)
|
|
49
|
+
created++
|
|
50
|
+
} catch (error) {
|
|
51
|
+
console.log(` ⚠️ ${label.name} (ошибка создания)`)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
console.log(`\n📊 Итого: создано ${created}, пропущено ${skipped}`)
|
|
56
|
+
|
|
57
|
+
if (created > 0) {
|
|
58
|
+
console.log('✅ Labels настроены!')
|
|
59
|
+
}
|