@vv0rkz/js-template 1.5.0 → 1.5.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/bin/cli.js +1 -1
- package/package.json +1 -1
- package/tools-gh/create-bug.js +2 -51
- package/tools-gh/create-issue.js +58 -0
- package/tools-gh/create-perf.js +2 -49
- package/tools-gh/create-refactor.js +2 -48
- package/tools-gh/create-task.js +2 -51
- package/tools-gh/setup-labels.js +1 -1
package/bin/cli.js
CHANGED
package/package.json
CHANGED
package/tools-gh/create-bug.js
CHANGED
|
@@ -1,53 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { createIssue } from './create-issue.js'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
const title = args.join(' ')
|
|
6
|
-
|
|
7
|
-
if (!title) {
|
|
8
|
-
console.log('❌ Использование: jst create-bug "описание бага"')
|
|
9
|
-
console.log(' или: npm run _ create-bug "описание бага"')
|
|
10
|
-
process.exit(1)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
try {
|
|
14
|
-
console.log('🐛 Создаю баг...')
|
|
15
|
-
|
|
16
|
-
// Создаем issue в GitHub
|
|
17
|
-
execSync(`gh issue create --title "Bug: ${title}" --body "Баг обнаружен" --label "bug" --assignee "@me"`, {
|
|
18
|
-
stdio: 'inherit',
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
console.log('🐛 Баг зарегистрирован!')
|
|
22
|
-
} catch (error) {
|
|
23
|
-
// Если ошибка с label - создаём его автоматически
|
|
24
|
-
if (error.message.includes("'bug' not found") || error.stderr?.includes("'bug' not found")) {
|
|
25
|
-
console.log("\n⚠️ Label 'bug' не найден. Создаю автоматически...")
|
|
26
|
-
|
|
27
|
-
try {
|
|
28
|
-
// Создаём label
|
|
29
|
-
execSync('gh label create bug --color "D73A4A" --description "Баг который нужно исправить"', { stdio: 'ignore' })
|
|
30
|
-
console.log("✅ Label 'bug' создан")
|
|
31
|
-
|
|
32
|
-
// Пытаемся создать баг ещё раз
|
|
33
|
-
console.log('🐛 Создаю баг...')
|
|
34
|
-
execSync(`gh issue create --title "Bug: ${title}" --body "Баг обнаружен" --label "bug" --assignee "@me"`, {
|
|
35
|
-
stdio: 'inherit',
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
console.log('🐛 Баг зарегистрирован!')
|
|
39
|
-
} catch (retryError) {
|
|
40
|
-
console.error('❌ Ошибка создания бага:', retryError.message)
|
|
41
|
-
console.log('\n💡 Попробуй:')
|
|
42
|
-
console.log(' npm run _ setup-labels')
|
|
43
|
-
process.exit(1)
|
|
44
|
-
}
|
|
45
|
-
} else {
|
|
46
|
-
console.error('❌ Ошибка создания бага:', error.message)
|
|
47
|
-
console.log('\n💡 Убедись что:')
|
|
48
|
-
console.log(' 1. Установлен GitHub CLI: gh --version')
|
|
49
|
-
console.log(' 2. Выполнена авторизация: gh auth login')
|
|
50
|
-
console.log(' 3. Создан репозиторий на GitHub')
|
|
51
|
-
process.exit(1)
|
|
52
|
-
}
|
|
53
|
-
}
|
|
4
|
+
createIssue('bug', '🐛', 'Исправление бага')
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { execSync, spawnSync } from 'child_process'
|
|
3
|
+
import { dirname, join } from 'path'
|
|
4
|
+
import { fileURLToPath } from 'url'
|
|
5
|
+
|
|
6
|
+
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Создаёт GitHub issue с автоматической настройкой labels
|
|
10
|
+
* @param {string} type - Тип issue (feat, fix, refactor, perf)
|
|
11
|
+
* @param {string} emoji - Эмодзи для вывода
|
|
12
|
+
* @param {string} description - Описание действия
|
|
13
|
+
*/
|
|
14
|
+
export function createIssue(type, emoji, description) {
|
|
15
|
+
console.log(`${emoji} Создаю задачу на ${description}...`)
|
|
16
|
+
|
|
17
|
+
const title = process.argv.slice(2).join(' ')
|
|
18
|
+
|
|
19
|
+
if (!title) {
|
|
20
|
+
console.log('❌ Укажи название задачи')
|
|
21
|
+
console.log(` Пример: npm run _ ${type} "Название задачи"`)
|
|
22
|
+
process.exit(1)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const issueTitle = `${type.charAt(0).toUpperCase() + type.slice(1)}: ${title}`
|
|
26
|
+
const issueBody = `${description}: ${title}`
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
execSync(`gh issue create --title "${issueTitle}" --body "${issueBody}" --label "${type}"`, { stdio: 'inherit' })
|
|
30
|
+
console.log('\n✅ Задача создана!')
|
|
31
|
+
} catch (error) {
|
|
32
|
+
// Если ошибка с label - запускаем setup-labels
|
|
33
|
+
if (error.message.includes('not found') || error.message.includes('label')) {
|
|
34
|
+
console.log(`\n⚠️ Label "${type}" не найден`)
|
|
35
|
+
console.log('🔧 Настраиваю labels...\n')
|
|
36
|
+
|
|
37
|
+
spawnSync('node', [join(__dirname, 'setup-labels.js')], { stdio: 'inherit' })
|
|
38
|
+
|
|
39
|
+
console.log('\n🔄 Повторяю создание задачи...\n')
|
|
40
|
+
try {
|
|
41
|
+
execSync(`gh issue create --title "${issueTitle}" --body "${issueBody}" --label "${type}"`, {
|
|
42
|
+
stdio: 'inherit',
|
|
43
|
+
})
|
|
44
|
+
console.log('\n✅ Задача создана!')
|
|
45
|
+
} catch (retryError) {
|
|
46
|
+
console.error('❌ Ошибка создания задачи:', retryError.message)
|
|
47
|
+
process.exit(1)
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
console.error('❌ Ошибка создания задачи:', error.message)
|
|
51
|
+
console.log('\n💡 Убедись что:')
|
|
52
|
+
console.log(' 1. Установлен GitHub CLI: gh --version')
|
|
53
|
+
console.log(' 2. Выполнена авторизация: gh auth login')
|
|
54
|
+
console.log(' 3. Создан репозиторий на GitHub')
|
|
55
|
+
process.exit(1)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
package/tools-gh/create-perf.js
CHANGED
|
@@ -1,51 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { createIssue } from './create-issue.js'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
const title = args.join(' ')
|
|
6
|
-
|
|
7
|
-
if (!title) {
|
|
8
|
-
console.log('❌ Использование: jst create-perf "описание оптимизации"')
|
|
9
|
-
console.log(' или: npm run _ create-perf "описание оптимизации"')
|
|
10
|
-
process.exit(1)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
try {
|
|
14
|
-
console.log('⚡ Создаю задачу на оптимизацию...')
|
|
15
|
-
|
|
16
|
-
execSync(`gh issue create --title "Perf: ${title}" --body "Оптимизация: ${title}" --label "perf"`, {
|
|
17
|
-
stdio: 'inherit',
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
console.log('⚡ Задача на оптимизацию создана!')
|
|
21
|
-
} catch (error) {
|
|
22
|
-
if (error.message.includes("'perf' not found") || error.stderr?.includes("'perf' not found")) {
|
|
23
|
-
console.log("\n⚠️ Label 'perf' не найден. Создаю автоматически...")
|
|
24
|
-
|
|
25
|
-
try {
|
|
26
|
-
execSync('gh label create perf --color "FF6B6B" --description "Оптимизация производительности"', {
|
|
27
|
-
stdio: 'ignore',
|
|
28
|
-
})
|
|
29
|
-
console.log("✅ Label 'perf' создан")
|
|
30
|
-
|
|
31
|
-
console.log('⚡ Создаю задачу на оптимизацию...')
|
|
32
|
-
execSync(`gh issue create --title "Perf: ${title}" --body "Оптимизация: ${title}" --label "perf"`, {
|
|
33
|
-
stdio: 'inherit',
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
console.log('⚡ Задача на оптимизацию создана!')
|
|
37
|
-
} catch (retryError) {
|
|
38
|
-
console.error('❌ Ошибка создания задачи:', retryError.message)
|
|
39
|
-
console.log('\n💡 Попробуй:')
|
|
40
|
-
console.log(' npm run _ setup-labels')
|
|
41
|
-
process.exit(1)
|
|
42
|
-
}
|
|
43
|
-
} else {
|
|
44
|
-
console.error('❌ Ошибка создания задачи:', error.message)
|
|
45
|
-
console.log('\n💡 Убедись что:')
|
|
46
|
-
console.log(' 1. Установлен GitHub CLI: gh --version')
|
|
47
|
-
console.log(' 2. Выполнена авторизация: gh auth login')
|
|
48
|
-
console.log(' 3. Создан репозиторий на GitHub')
|
|
49
|
-
process.exit(1)
|
|
50
|
-
}
|
|
51
|
-
}
|
|
4
|
+
createIssue('perf', '⚡', 'Оптимизация')
|
|
@@ -1,50 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { createIssue } from './create-issue.js'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
const title = args.join(' ')
|
|
6
|
-
|
|
7
|
-
if (!title) {
|
|
8
|
-
console.log('❌ Использование: jst create-refactor "описание рефакторинга"')
|
|
9
|
-
console.log(' или: npm run _ create-refactor "описание рефакторинга"')
|
|
10
|
-
process.exit(1)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
try {
|
|
14
|
-
console.log('♻️ Создаю задачу на рефакторинг...')
|
|
15
|
-
|
|
16
|
-
execSync(`gh issue create --title "Refactor: ${title}" --body "Рефакторинг: ${title}" --label "refactor"`, {
|
|
17
|
-
stdio: 'inherit',
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
console.log('♻️ Задача на рефакторинг создана!')
|
|
21
|
-
} catch (error) {
|
|
22
|
-
if (error.message.includes("'refactor' not found") || error.stderr?.includes("'refactor' not found")) {
|
|
23
|
-
console.log("\n⚠️ Label 'refactor' не найден. Создаю автоматически...")
|
|
24
|
-
|
|
25
|
-
try {
|
|
26
|
-
execSync('gh label create refactor --color "FEF2C0" --description "Рефакторинг/техдолг"', { stdio: 'ignore' })
|
|
27
|
-
console.log("✅ Label 'refactor' создан")
|
|
28
|
-
|
|
29
|
-
console.log('♻️ Создаю задачу на рефакторинг...')
|
|
30
|
-
execSync(`gh issue create --title "Refactor: ${title}" --body "Рефакторинг: ${title}" --label "refactor"`, {
|
|
31
|
-
stdio: 'inherit',
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
console.log('♻️ Задача на рефакторинг создана!')
|
|
35
|
-
} catch (retryError) {
|
|
36
|
-
console.error('❌ Ошибка создания задачи:', retryError.message)
|
|
37
|
-
console.log('\n💡 Попробуй:')
|
|
38
|
-
console.log(' npm run _ setup-labels')
|
|
39
|
-
process.exit(1)
|
|
40
|
-
}
|
|
41
|
-
} else {
|
|
42
|
-
console.error('❌ Ошибка создания задачи:', error.message)
|
|
43
|
-
console.log('\n💡 Убедись что:')
|
|
44
|
-
console.log(' 1. Установлен GitHub CLI: gh --version')
|
|
45
|
-
console.log(' 2. Выполнена авторизация: gh auth login')
|
|
46
|
-
console.log(' 3. Создан репозиторий на GitHub')
|
|
47
|
-
process.exit(1)
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
1
|
|
4
|
+
createIssue('refactor', '♻️', 'Рефакторинг')
|
package/tools-gh/create-task.js
CHANGED
|
@@ -1,53 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { createIssue } from './create-issue.js'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
const title = args.join(' ')
|
|
6
|
-
|
|
7
|
-
if (!title) {
|
|
8
|
-
console.log('❌ Использование: jst create-task "описание задачи"')
|
|
9
|
-
console.log(' или: npm run _ create-task "описание задачи"')
|
|
10
|
-
process.exit(1)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
try {
|
|
14
|
-
console.log('📝 Создаю задачу...')
|
|
15
|
-
|
|
16
|
-
// Пытаемся создать задачу с label
|
|
17
|
-
execSync(`gh issue create --title "Task: ${title}" --body "Задача: ${title}" --label "task"`, {
|
|
18
|
-
stdio: 'inherit',
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
console.log('✅ Задача создана! Используй номер в коммитах: feat: #номер описание')
|
|
22
|
-
} catch (error) {
|
|
23
|
-
// Если ошибка с label - создаём его автоматически
|
|
24
|
-
if (error.message.includes("'task' not found") || error.stderr?.includes("'task' not found")) {
|
|
25
|
-
console.log("\n⚠️ Label 'task' не найден. Создаю автоматически...")
|
|
26
|
-
|
|
27
|
-
try {
|
|
28
|
-
// Создаём label
|
|
29
|
-
execSync('gh label create task --color "0E8A16" --description "Задача для реализации"', { stdio: 'ignore' })
|
|
30
|
-
console.log("✅ Label 'task' создан")
|
|
31
|
-
|
|
32
|
-
// Пытаемся создать задачу ещё раз
|
|
33
|
-
console.log('📝 Создаю задачу...')
|
|
34
|
-
execSync(`gh issue create --title "Task: ${title}" --body "Задача: ${title}" --label "task"`, {
|
|
35
|
-
stdio: 'inherit',
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
console.log('✅ Задача создана!')
|
|
39
|
-
} catch (retryError) {
|
|
40
|
-
console.error('❌ Ошибка создания задачи:', retryError.message)
|
|
41
|
-
console.log('\n💡 Попробуй:')
|
|
42
|
-
console.log(' npm run _ setup-labels')
|
|
43
|
-
process.exit(1)
|
|
44
|
-
}
|
|
45
|
-
} else {
|
|
46
|
-
console.error('❌ Ошибка создания задачи:', error.message)
|
|
47
|
-
console.log('\n💡 Убедись что:')
|
|
48
|
-
console.log(' 1. Установлен GitHub CLI: gh --version')
|
|
49
|
-
console.log(' 2. Выполнена авторизация: gh auth login')
|
|
50
|
-
console.log(' 3. Создан репозиторий на GitHub')
|
|
51
|
-
process.exit(1)
|
|
52
|
-
}
|
|
53
|
-
}
|
|
4
|
+
createIssue('task', '✨', 'Новая фича')
|
package/tools-gh/setup-labels.js
CHANGED
|
@@ -7,7 +7,7 @@ const labels = [
|
|
|
7
7
|
{ name: 'task', color: '0E8A16', description: 'Новая фича' },
|
|
8
8
|
{ name: 'bug', color: 'D73A4A', description: 'Баг' },
|
|
9
9
|
{ name: 'refactor', color: 'FEF2C0', description: 'Рефакторинг/техдолг' },
|
|
10
|
-
{ name: 'perf', color: '
|
|
10
|
+
{ name: 'perf', color: '007bff', description: 'Оптимизация производительности' },
|
|
11
11
|
]
|
|
12
12
|
|
|
13
13
|
try {
|