@vv0rkz/js-template 1.6.2 → 1.6.4

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 CHANGED
@@ -23,7 +23,7 @@ function askQuestion(query) {
23
23
  rl.question(query, (ans) => {
24
24
  rl.close()
25
25
  resolve(ans)
26
- })
26
+ }),
27
27
  )
28
28
  }
29
29
 
@@ -139,6 +139,12 @@ if (existsSync(packageJsonPath)) {
139
139
  }
140
140
  packageJson.devDependencies['@vv0rkz/js-template'] = '^1.4.0'
141
141
 
142
+ // Проверка и установка type: module для ES модулей
143
+ if (!packageJson.type || packageJson.type === 'commonjs') {
144
+ packageJson.type = 'module'
145
+ console.log(' ⚙️ Установлен "type": "module" (для ES модулей)')
146
+ }
147
+
142
148
  writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))
143
149
  console.log(' ✅ Скрипты добавлены')
144
150
  console.log(' npm run jst или npm run _')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vv0rkz/js-template",
3
- "version": "1.6.2",
3
+ "version": "1.6.4",
4
4
  "description": "Reusable setup for JS projects with husky, changelog, gh tools",
5
5
  "type": "module",
6
6
  "bin": {
@@ -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 (!versionBlock.includes('### ✨ Новые фичи') &&
55
- !versionBlock.includes('### ✨ Фичи') &&
56
- !versionBlock.includes('### 🚀')) {
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 + star
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
+ }