@vv0rkz/js-template 1.5.2 → 1.6.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.
Files changed (2) hide show
  1. package/bin/cli.js +44 -6
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -45,18 +45,56 @@ const commands = {
45
45
  process.exit(1)
46
46
  }
47
47
 
48
- // 2. Определяем тип bump из коммитов
49
- const commitMessages = execSync('git log --oneline -10', { encoding: 'utf8' })
48
+ // 2. Определяем тип bump из коммитов после последнего тега
49
+ let lastTag = 'HEAD~10' // fallback
50
+ try {
51
+ lastTag = execSync('git describe --tags --abbrev=0', { encoding: 'utf8' }).trim()
52
+ console.log(`📌 Последний тег: ${lastTag}`)
53
+ } catch (error) {
54
+ console.log('⚠️ Теги не найдены, анализирую последние 10 коммитов')
55
+ }
56
+
57
+ const commitMessages = execSync(`git log ${lastTag}..HEAD --oneline`, { encoding: 'utf8' })
50
58
  const bumpType = commitMessages.includes('feat:') ? 'minor' : 'patch'
51
59
 
60
+ console.log(`📊 Коммиты после ${lastTag}:`)
61
+ console.log(commitMessages)
62
+ console.log(`🔢 Определён bump type: ${bumpType}\n`)
63
+
52
64
  // 3. Создаём changelog
53
- const changelog = spawnSync(npxCmd, ['changelogen', '--release', '--bump', bumpType], { stdio: 'inherit' })
65
+ console.log('📝 Создание changelog...')
66
+ const changelog = spawnSync(npxCmd, ['changelogen', '--release', '--bump', bumpType], {
67
+ stdio: 'pipe',
68
+ encoding: 'utf8',
69
+ })
70
+
54
71
  if (changelog.status !== 0) {
55
- console.error('❌ Ошибка создания changelog')
72
+ console.error('❌ Ошибка создания changelog\n')
73
+
74
+ // Выводим полный текст ошибки
75
+ if (changelog.stdout) {
76
+ console.log('📤 Вывод команды:')
77
+ console.log(changelog.stdout)
78
+ }
79
+
80
+ if (changelog.stderr) {
81
+ console.log('📤 Ошибки:')
82
+ console.log(changelog.stderr)
83
+ }
84
+
85
+ console.log('\n💡 Возможные причины:')
86
+ console.log(' 1. Конфликт тегов - проверь: git tag')
87
+ console.log(' 2. Незакоммиченные изменения - проверь: git status')
88
+ console.log(' 3. Неправильный changelog.config.js')
89
+ console.log('\n🔧 Попробуй вручную:')
90
+ console.log(` npx changelogen --release --bump ${bumpType}`)
56
91
  process.exit(1)
57
92
  }
58
93
 
59
- // 4. Обновляем README ← ДОБАВЬ ЭТО
94
+ // Выводим успешный результат
95
+ console.log(changelog.stdout)
96
+
97
+ // 4. Обновляем README
60
98
  console.log('\n📝 Обновление README...')
61
99
  const updateReadme = spawnSync('node', [join(toolsDir, 'update-readme.js')], { stdio: 'inherit' })
62
100
  if (updateReadme.status !== 0) {
@@ -65,7 +103,7 @@ const commands = {
65
103
 
66
104
  console.log('\n✅ Релиз успешно создан!')
67
105
  console.log('💡 Теперь можно:')
68
- console.log(' npm run _ push-release # Запушить в main')
106
+ console.log(' npm run _ push-release # Создать PR и смерджить в main')
69
107
  },
70
108
 
71
109
  'update-readme': () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vv0rkz/js-template",
3
- "version": "1.5.2",
3
+ "version": "1.6.0",
4
4
  "description": "Reusable setup for JS projects with husky, changelog, gh tools",
5
5
  "type": "module",
6
6
  "bin": {