@vv0rkz/js-template 1.6.2 → 1.6.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/package.json +1 -1
- package/tools-gh/update-readme.js +36 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { readFileSync, writeFileSync, existsSync } from 'fs'
|
|
3
2
|
import { execSync } from 'child_process'
|
|
3
|
+
import { existsSync, readFileSync, writeFileSync } from 'fs'
|
|
4
4
|
|
|
5
5
|
console.log('🎨 Обновляю README релизами с демо...')
|
|
6
6
|
|
|
@@ -51,9 +51,11 @@ versionBlocks.forEach((versionBlock) => {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
// Пропускаем если нет фич (поддержка разных форматов заголовков)
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
if (
|
|
55
|
+
!versionBlock.includes('### ✨ Новые фичи') &&
|
|
56
|
+
!versionBlock.includes('### ✨ Фичи') &&
|
|
57
|
+
!versionBlock.includes('### 🚀')
|
|
58
|
+
) {
|
|
57
59
|
console.log(`⏭️ Пропускаем ${version} - нет фич`)
|
|
58
60
|
return
|
|
59
61
|
}
|
|
@@ -65,9 +67,7 @@ versionBlocks.forEach((versionBlock) => {
|
|
|
65
67
|
|
|
66
68
|
for (const line of lines) {
|
|
67
69
|
// Поддержка разных форматов заголовков фич
|
|
68
|
-
if (line.includes('### ✨ Новые фичи') ||
|
|
69
|
-
line.includes('### ✨ Фичи') ||
|
|
70
|
-
line.includes('### 🚀')) {
|
|
70
|
+
if (line.includes('### ✨ Новые фичи') || line.includes('### ✨ Фичи') || line.includes('### 🚀')) {
|
|
71
71
|
inFeaturesSection = true
|
|
72
72
|
continue
|
|
73
73
|
}
|
|
@@ -124,4 +124,32 @@ if (readme.includes('<!-- AUTOGENERATED_SECTION START -->')) {
|
|
|
124
124
|
const endIndex = readme.indexOf(endMarker, startIndex + startMarker.length)
|
|
125
125
|
|
|
126
126
|
if (startIndex !== -1 && endIndex !== -1) {
|
|
127
|
-
readme = readme.substring(0, startIndex +
|
|
127
|
+
readme = readme.substring(0, startIndex + startMarker.length) + '\n' + prettyChangelog + readme.substring(endIndex)
|
|
128
|
+
console.log('✅ Секция обновлена')
|
|
129
|
+
}
|
|
130
|
+
} else {
|
|
131
|
+
console.log('⚠️ Маркер <!-- AUTOGENERATED_SECTION START --> не найден в README.md')
|
|
132
|
+
console.log('💡 Добавь в README.md:')
|
|
133
|
+
console.log(' <!-- AUTOGENERATED_SECTION START -->')
|
|
134
|
+
console.log(' <!-- AUTOGENERATED_SECTION END -->')
|
|
135
|
+
process.exit(1)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Сохраняем
|
|
139
|
+
writeFileSync('README.md', readme)
|
|
140
|
+
console.log('✅ README обновлён с релизами, у которых есть демо!')
|
|
141
|
+
|
|
142
|
+
// Пытаемся закоммитить и запушить
|
|
143
|
+
try {
|
|
144
|
+
const status = execSync('git status --porcelain README.md').toString().trim()
|
|
145
|
+
if (status) {
|
|
146
|
+
execSync('git add README.md', { stdio: 'inherit' })
|
|
147
|
+
execSync('git commit -m "docs: update README with demo releases"', { stdio: 'inherit' })
|
|
148
|
+
execSync('git push', { stdio: 'inherit' })
|
|
149
|
+
console.log('🚀 Изменения запушены!')
|
|
150
|
+
} else {
|
|
151
|
+
console.log('💡 README не изменился')
|
|
152
|
+
}
|
|
153
|
+
} catch (error) {
|
|
154
|
+
console.log('💡 README обновлён локально (не удалось запушить автоматически)')
|
|
155
|
+
}
|