Skip to content

Commit 982af31

Browse files
committed
chore: bump version to v1.3.2
1 parent 871269a commit 982af31

8 files changed

Lines changed: 242 additions & 123 deletions

File tree

package.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "khmtools",
3-
"version": "1.3.1",
3+
"version": "1.3.2",
44
"description": "A collection of useful tools for Kingdom Hall Media operations",
55
"main": "main.js",
66
"scripts": {
@@ -13,7 +13,9 @@
1313
"publish-mac": "electron-builder build --mac --arm64 --publish always",
1414
"publish-win": "electron-builder build --win --x64 --publish always",
1515
"publish-linux": "electron-builder build --linux --publish always",
16-
"release": "node scripts/release.js"
16+
"publish-all": "electron-builder build --mac --win --linux --publish always",
17+
"release": "node scripts/release.js",
18+
"test-updater": "cross-env NODE_ENV=development electron . --enable-logging"
1719
},
1820
"keywords": [],
1921
"author": "KHM Tools Team",
@@ -43,6 +45,12 @@
4345
"owner": "advenimus",
4446
"repo": "khmtools"
4547
},
48+
"files": [
49+
"**/*",
50+
"!node_modules",
51+
"!dist",
52+
"!.git"
53+
],
4654
"mac": {
4755
"category": "public.app-category.utilities",
4856
"icon": "assets/mac_logo.icns",
@@ -81,6 +89,7 @@
8189
],
8290
"publisherName": "KHM Tools Team",
8391
"verifyUpdateCodeSignature": false,
92+
"requestedExecutionLevel": "asInvoker",
8493
"fileAssociations": []
8594
},
8695
"linux": {

preload.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ contextBridge.exposeInMainWorld('electronAPI', {
2323
onUpdateDownloaded: (callback) => ipcRenderer.on('update-downloaded', (_, info) => callback(info)),
2424
onUpdateError: (callback) => ipcRenderer.on('update-error', (_, err) => callback(err)),
2525
installUpdate: () => ipcRenderer.send('install-update'),
26+
checkForUpdatesManually: () => ipcRenderer.invoke('check-for-updates-manually'),
2627
onOpenDefaultTool: (callback) => ipcRenderer.on('open-default-tool', (_, toolId) => callback(toolId)),
2728
openExternal: (url) => shell.openExternal(url),
2829

release_notes/RELEASE_NOTES_SAMPLE.MD

Lines changed: 0 additions & 77 deletions
This file was deleted.

release_notes/release_template.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
(BE SURE TO RETURN RAW MARKDOWN WHEN REFERENCING THIS)
2+
3+
# KHM Tools v[VERSION] Release Notes 🚀
4+
5+
## 📋 Changelog
6+
7+
### 🚀 [Category] Enhancements
8+
- **🔧 [Feature/Fix Title]** - Brief description of the change
9+
- **📝 [Feature/Fix Title]** - Brief description of the change
10+
- **🛠️ [Feature/Fix Title]** - Brief description of the change
11+
- **🔄 [Feature/Fix Title]** - Brief description of the change
12+
13+
### 🎨 UI/UX Improvements
14+
- **📍 [Feature/Fix Title]** - Brief description of the change
15+
- **💬 [Feature/Fix Title]** - Brief description of the change
16+
- **🔗 [Feature/Fix Title]** - Brief description of the change
17+
18+
### ⚙️ Developer Experience
19+
- **🧪 [Feature/Fix Title]** - Brief description of the change
20+
- **🏗️ [Feature/Fix Title]** - Brief description of the change
21+
- **📊 [Feature/Fix Title]** - Brief description of the change
22+
23+
## 🔧 Bug Fixes & System Improvements
24+
25+
### **[Category Name]**
26+
- 🐛 **[Bug Fix Title]** - Description of what was fixed
27+
- 🔄 **[Improvement Title]** - Description of the improvement
28+
- 🎯 **[Enhancement Title]** - Description of the enhancement
29+
- 💾 **[Feature Title]** - Description of the feature
30+
31+
## ✨ New Features
32+
33+
### **[Feature Category]**
34+
- 🚀 **[Feature Name]** - Description of the new feature
35+
- 🍎 **[Platform-specific feature]** - Description with platform context
36+
- 🔒 **[Security/Permission feature]** - Description of security improvements
37+
- 🏷️ **[Branding/Identity feature]** - Description of branding changes
38+
39+
## 🎨 User Interface Enhancements
40+
41+
### **[UI Category]**
42+
- 📋 **[Interface improvement]** - Description of UI changes
43+
- 🎛️ **[Navigation improvement]** - Description of navigation changes
44+
- 💾 **[Workflow improvement]** - Description of workflow enhancements
45+
46+
## 🛠️ Technical Improvements
47+
48+
### **[Technical Category]**
49+
- 🔄 **[Code improvement]** - Description of technical changes
50+
- 🎯 **[Performance improvement]** - Description of performance gains
51+
- 📝 **[Infrastructure improvement]** - Description of infrastructure changes
52+
53+
---
54+
55+
## 📥 Download
56+
57+
Get the latest version from the [Releases page](https://github.com/advenimus/khmtools/releases/tag/v[VERSION])
58+
59+
**Platform Downloads:**
60+
- 🍎 **macOS**: `KHM-Tools-[VERSION]-mac-arm64.dmg`
61+
- 🪟 **Windows**: `KHM-Tools-[VERSION]-win-x64.exe`
62+
- 🐧 **Linux**: `KHM-Tools-[VERSION]-linux.AppImage`
63+
64+
## 🔄 Upgrade Notes
65+
66+
- [Important upgrade information]
67+
- [Breaking changes or migration notes]
68+
- [New default settings or behaviors]
69+
70+
---
71+
72+
**Full Changelog**: https://github.com/advenimus/khmtools/commits/v[VERSION]

renderer.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,8 +359,18 @@ if (window.electronAPI) {
359359
window.electronAPI.onUpdateError((err) => {
360360
console.error('Update error:', err);
361361

362+
// Determine error message based on error type
363+
let errorMessage = 'Unable to check for updates automatically.';
364+
if (err.message && err.message.includes('net::')) {
365+
errorMessage = 'Network error checking for updates.';
366+
} else if (err.message && err.message.includes('404')) {
367+
errorMessage = 'Update server not found.';
368+
} else if (err.error && err.error.includes('ENOTFOUND')) {
369+
errorMessage = 'Cannot connect to update server.';
370+
}
371+
362372
// Show a notification with a link to the releases page
363-
updateMessage.innerHTML = `Unable to download automatic update. <a href="#" id="releases-link" style="color: #fff; text-decoration: underline;">Visit releases page</a>`;
373+
updateMessage.innerHTML = `${errorMessage} <a href="#" id="releases-link" style="color: #fff; text-decoration: underline;">Visit releases page</a>`;
364374
updateButton.style.display = 'none';
365375
updateNotification.classList.remove('hidden');
366376

@@ -375,7 +385,6 @@ if (window.electronAPI) {
375385
});
376386
}
377387
}, 100);
378-
// You could also show this to the user if desired
379388

380389
// Make sure the dismiss button works
381390
if (dismissUpdateButton) {

scripts/release.js

Lines changed: 71 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ async function getVersionIncrement() {
5858
}
5959
}
6060

61-
async function updateVersion(incrementType) {
61+
function calculateNewVersion(incrementType) {
6262
const packagePath = path.join(process.cwd(), 'package.json');
6363
const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
6464
const currentVersion = packageJson.version;
@@ -83,14 +83,23 @@ async function updateVersion(incrementType) {
8383
}
8484

8585
const newVersion = `${major}.${minor}.${patch}`;
86+
87+
log(`\n📋 Version will be updated: ${currentVersion}${newVersion}`, 'yellow');
88+
89+
return { currentVersion, newVersion };
90+
}
91+
92+
function writeVersionToPackage(newVersion) {
93+
const packagePath = path.join(process.cwd(), 'package.json');
94+
const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
95+
const currentVersion = packageJson.version;
96+
8697
packageJson.version = newVersion;
8798

8899
// Write updated package.json
89100
fs.writeFileSync(packagePath, JSON.stringify(packageJson, null, 2) + '\n');
90101

91102
log(`\n✅ Version updated: ${currentVersion}${newVersion}`, 'green');
92-
93-
return newVersion;
94103
}
95104

96105
async function getBuildMethod() {
@@ -103,7 +112,7 @@ async function getBuildMethod() {
103112
return choice === '1' ? 'local' : 'github';
104113
}
105114

106-
async function buildLocally() {
115+
async function buildLocally(newVersion) {
107116
log('\n🏗️ Local Build', 'bright');
108117
log('Which platform(s) to build for?', 'cyan');
109118
console.log(' 1) macOS only');
@@ -112,6 +121,10 @@ async function buildLocally() {
112121

113122
const choice = await question('\nSelect (1-3): ');
114123

124+
// Write version to package.json before building
125+
log('\n📝 Updating package.json version...', 'blue');
126+
writeVersionToPackage(newVersion);
127+
115128
log('\n🚀 Starting build...', 'yellow');
116129

117130
try {
@@ -143,20 +156,57 @@ async function buildLocally() {
143156

144157
async function getReleaseNotes() {
145158
log('\n📝 Release Notes', 'bright');
146-
log('Enter release notes (Markdown supported, including emojis)', 'cyan');
147-
log('Type each line and press Enter. When done, type "DONE" on a new line:', 'yellow');
159+
log('Choose input method:', 'cyan');
160+
console.log(' 1) Paste multi-line text (recommended)');
161+
console.log(' 2) Enter line by line manually');
148162

149-
const lines = [];
163+
const choice = await question('\nSelect (1-2): ');
150164

151-
while (true) {
152-
const line = await question('');
153-
if (line.toUpperCase() === 'DONE') {
154-
break;
165+
if (choice === '2') {
166+
log('\nManual entry mode - type each line and press Enter. When done, type "DONE" on a new line:', 'yellow');
167+
const lines = [];
168+
169+
while (true) {
170+
const line = await question('');
171+
if (line.toUpperCase() === 'DONE') {
172+
break;
173+
}
174+
lines.push(line);
155175
}
156-
lines.push(line);
176+
177+
return lines.join('\n');
157178
}
158179

159-
return lines.join('\n');
180+
// Paste mode - temporarily close readline and use raw stdin
181+
log('\n📋 Paste Mode Active', 'yellow');
182+
log('Paste your release notes below and press Ctrl+D when finished:', 'cyan');
183+
log('(The text will appear as you paste it)\n', 'yellow');
184+
185+
// Close readline temporarily
186+
rl.pause();
187+
188+
return new Promise((resolve) => {
189+
const chunks = [];
190+
191+
process.stdin.resume();
192+
process.stdin.setEncoding('utf8');
193+
194+
process.stdin.on('data', (chunk) => {
195+
chunks.push(chunk);
196+
});
197+
198+
process.stdin.on('end', () => {
199+
const fullInput = chunks.join('').trim();
200+
201+
// Resume readline for future questions
202+
process.stdin.removeAllListeners('data');
203+
process.stdin.removeAllListeners('end');
204+
rl.resume();
205+
206+
log('\n✅ Release notes captured!', 'green');
207+
resolve(fullInput);
208+
});
209+
});
160210
}
161211

162212
async function buildViaGitHub(version) {
@@ -166,7 +216,11 @@ async function buildViaGitHub(version) {
166216
log('\n🚀 Preparing GitHub release...', 'yellow');
167217

168218
try {
169-
// Check for uncommitted changes
219+
// Write version to package.json before committing
220+
log('📝 Updating package.json version...', 'blue');
221+
writeVersionToPackage(version);
222+
223+
// Check for uncommitted changes (including the version update)
170224
const status = execCommand('git status --porcelain', true);
171225
if (status) {
172226
log('Uncommitted changes detected. Committing...', 'blue');
@@ -247,14 +301,14 @@ async function main() {
247301
// Get version increment type
248302
const incrementType = await getVersionIncrement();
249303

250-
// Update version
251-
const newVersion = await updateVersion(incrementType);
304+
// Calculate new version (but don't write it yet)
305+
const { currentVersion, newVersion } = calculateNewVersion(incrementType);
252306

253307
// Get build method
254308
const buildMethod = await getBuildMethod();
255309

256310
if (buildMethod === 'local') {
257-
await buildLocally();
311+
await buildLocally(newVersion);
258312
log('\n✅ Done! Check the dist/ directory for build artifacts.', 'green');
259313
} else {
260314
await buildViaGitHub(newVersion);

0 commit comments

Comments
 (0)