@alphamatica/app-updater 1.0.1 → 1.0.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/CHANGELOG.md CHANGED
@@ -1,52 +1,87 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [1.0.1] - 2025-12-14
9
-
10
- ### Changed
11
-
12
- - License changed to Proprietary (UNLICENSED)
13
-
14
- ## [1.0.0] - 2025-12-14
15
-
16
- ### Added
17
-
18
- - Initial release
19
- - `Updater` class for checking, downloading, and installing updates
20
- - `UpdaterUI` class for showing update dialogs in Electron
21
- - Support for multiple platforms: Windows, macOS, Linux
22
- - Support for multiple architectures: x64, arm64, ia32
23
- - Support for multiple file types: zip, tar.gz, AppImage, exe, dmg
24
- - Automatic update checking with configurable interval
25
- - Download progress tracking
26
- - Server-controlled updates and downgrades
27
- - Event-based API for update lifecycle
28
- - TypeScript support with full type definitions
29
-
30
- ### Features
31
-
32
- - **Updater**
33
- - `checkForUpdates()` - Check for available updates
34
- - `downloadUpdate()` - Download the update file
35
- - `installUpdate()` - Install update and restart application
36
- - `startAutoCheck()` / `stopAutoCheck()` - Automatic periodic checking
37
- - Event emitter for update lifecycle events
38
-
39
- - **UpdaterUI**
40
- - Native Electron dialogs for update notifications
41
- - Progress dialog during download
42
- - Confirmation dialogs for install/restart
43
-
44
- ### Configuration
45
-
46
- - `serverUrl` - URL of the A-Updater server
47
- - `appSlug` - Application identifier
48
- - `currentVersion` - Current application version
49
- - `channel` - Update channel (default: 'stable')
50
- - `autoDownload` - Automatically download updates
51
- - `autoInstall` - Automatically install updates
52
- - `checkInterval` - Interval for automatic checking (ms)
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.3] - 2025-12-15
9
+
10
+ ### Fixed
11
+
12
+ - UI now forcibly disables `autoInstall` to prevent automatic installation when using UI dialogs
13
+ - Added `findUpdateRoot()` to correctly handle archives with nested folders (e.g., `win-unpacked/`)
14
+ - Fixed helper scripts to use correct source directory when archive contains nested app folder
15
+
16
+ ### Added
17
+
18
+ - Debug logging in `installUpdate()` to diagnose installation issues
19
+ - `disableAutoInstall()` method for programmatic control
20
+
21
+ ## [1.0.2] - 2025-12-15
22
+
23
+ ### Fixed
24
+
25
+ - Fixed incorrect update extraction path (was extracting to `resources/` instead of app root)
26
+ - Fixed Windows update installation (cannot replace running executable)
27
+ - Added helper scripts for Windows and Linux/macOS to properly replace files after app exit
28
+
29
+ ### Added
30
+
31
+ - Automatic cleanup of old temporary update files on startup
32
+ - New modern UI for all update dialogs (update available, download progress, install, error)
33
+ - Progress throttling to prevent percentage jumps during download
34
+ - Download speed display in progress window
35
+ - Installing spinner window
36
+
37
+ ### Changed
38
+
39
+ - All update windows now use `alwaysOnTop: true` to stay visible
40
+ - Replaced system dialogs with custom styled windows
41
+ - macOS now also uses helper script for more reliable updates
42
+
43
+ ## [1.0.1] - 2025-12-14
44
+
45
+ ### Changed
46
+
47
+ - License changed to Proprietary (UNLICENSED)
48
+
49
+ ## [1.0.0] - 2025-12-14
50
+
51
+ ### Added
52
+
53
+ - Initial release
54
+ - `Updater` class for checking, downloading, and installing updates
55
+ - `UpdaterUI` class for showing update dialogs in Electron
56
+ - Support for multiple platforms: Windows, macOS, Linux
57
+ - Support for multiple architectures: x64, arm64, ia32
58
+ - Support for multiple file types: zip, tar.gz, AppImage, exe, dmg
59
+ - Automatic update checking with configurable interval
60
+ - Download progress tracking
61
+ - Server-controlled updates and downgrades
62
+ - Event-based API for update lifecycle
63
+ - TypeScript support with full type definitions
64
+
65
+ ### Features
66
+
67
+ - **Updater**
68
+ - `checkForUpdates()` - Check for available updates
69
+ - `downloadUpdate()` - Download the update file
70
+ - `installUpdate()` - Install update and restart application
71
+ - `startAutoCheck()` / `stopAutoCheck()` - Automatic periodic checking
72
+ - Event emitter for update lifecycle events
73
+
74
+ - **UpdaterUI**
75
+ - Native Electron dialogs for update notifications
76
+ - Progress dialog during download
77
+ - Confirmation dialogs for install/restart
78
+
79
+ ### Configuration
80
+
81
+ - `serverUrl` - URL of the A-Updater server
82
+ - `appSlug` - Application identifier
83
+ - `currentVersion` - Current application version
84
+ - `channel` - Update channel (default: 'stable')
85
+ - `autoDownload` - Automatically download updates
86
+ - `autoInstall` - Automatically install updates
87
+ - `checkInterval` - Interval for automatic checking (ms)
package/LICENSE CHANGED
@@ -1,7 +1,7 @@
1
- Copyright (c) 2024 Alphamatica. All rights reserved.
2
-
3
- This software is proprietary and confidential.
4
- Unauthorized copying, modification, distribution, or use of this software,
5
- via any medium, is strictly prohibited.
6
-
7
- For licensing inquiries, contact: info@alphamatica.com
1
+ Copyright (c) 2024 Alphamatica. All rights reserved.
2
+
3
+ This software is proprietary and confidential.
4
+ Unauthorized copying, modification, distribution, or use of this software,
5
+ via any medium, is strictly prohibited.
6
+
7
+ For licensing inquiries, contact: info@alphamatica.com
package/README.md CHANGED
@@ -1,186 +1,186 @@
1
- # @alphamatica/app-updater
2
-
3
- [![npm version](https://img.shields.io/npm/v/@alphamatica/app-updater.svg)](https://www.npmjs.com/package/@alphamatica/app-updater)
4
- [![npm downloads](https://img.shields.io/npm/dm/@alphamatica/app-updater.svg)](https://www.npmjs.com/package/@alphamatica/app-updater)
5
- [![license](https://img.shields.io/badge/license-Proprietary-red.svg)](https://www.npmjs.com/package/@alphamatica/app-updater)
6
-
7
- Клиентский пакет для интеграции автоматических обновлений в Electron приложения.
8
-
9
- ## Установка
10
-
11
- ```bash
12
- yarn add @alphamatica/app-updater
13
- # или
14
- npm install @alphamatica/app-updater
15
- ```
16
-
17
- ## Использование
18
-
19
- ### Базовый пример
20
-
21
- ```typescript
22
- import { Updater } from '@alphamatica/app-updater';
23
- import { app } from 'electron';
24
-
25
- const updater = new Updater({
26
- serverUrl: 'https://updates.example.com',
27
- appSlug: 'my-app',
28
- currentVersion: app.getVersion(),
29
- channel: 'stable', // опционально, по умолчанию 'stable'
30
- });
31
-
32
- // События
33
- updater.on('checking-for-update', () => {
34
- console.log('Проверка обновлений...');
35
- });
36
-
37
- updater.on('update-available', (info) => {
38
- console.log(`Доступна версия ${info.version}`);
39
- console.log(`Размер: ${info.fileSize} байт`);
40
- console.log(`Даунгрейд: ${info.isDowngrade}`);
41
- });
42
-
43
- updater.on('update-not-available', () => {
44
- console.log('Обновлений нет');
45
- });
46
-
47
- updater.on('download-progress', (progress) => {
48
- console.log(`Загрузка: ${progress.percent}%`);
49
- console.log(`Скорость: ${progress.bytesPerSecond} B/s`);
50
- });
51
-
52
- updater.on('update-downloaded', (info) => {
53
- console.log(`Версия ${info.version} загружена`);
54
- });
55
-
56
- updater.on('error', (error) => {
57
- console.error('Ошибка:', error.message);
58
- });
59
-
60
- // Проверить обновления
61
- await updater.checkForUpdates();
62
-
63
- // Скачать обновление
64
- await updater.downloadUpdate();
65
-
66
- // Установить и перезапустить
67
- await updater.installUpdate();
68
- ```
69
-
70
- ### С UI компонентом
71
-
72
- ```typescript
73
- import { Updater, UpdaterUI } from '@alphamatica/app-updater';
74
-
75
- const updater = new Updater({
76
- serverUrl: 'https://updates.example.com',
77
- appSlug: 'my-app',
78
- currentVersion: app.getVersion(),
79
- });
80
-
81
- const ui = new UpdaterUI({
82
- updater,
83
- showNotification: true, // показывать диалоги
84
- });
85
-
86
- // Проверит обновления и покажет диалог если есть
87
- await ui.checkForUpdates();
88
- ```
89
-
90
- ### Автоматическая проверка
91
-
92
- ```typescript
93
- const updater = new Updater({
94
- serverUrl: 'https://updates.example.com',
95
- appSlug: 'my-app',
96
- currentVersion: app.getVersion(),
97
- checkInterval: 60 * 60 * 1000, // каждый час
98
- autoDownload: true, // автоматически скачивать
99
- autoInstall: false, // НЕ устанавливать автоматически
100
- });
101
-
102
- // Запустить периодическую проверку
103
- updater.startAutoCheck();
104
-
105
- // Остановить
106
- updater.stopAutoCheck();
107
- ```
108
-
109
- ## API
110
-
111
- ### Updater
112
-
113
- #### Конструктор
114
-
115
- ```typescript
116
- new Updater(config: UpdaterConfig)
117
- ```
118
-
119
- **UpdaterConfig:**
120
- - `serverUrl` (string) - URL сервера обновлений
121
- - `appSlug` (string) - slug приложения
122
- - `currentVersion` (string) - текущая версия
123
- - `channel` (string, optional) - канал обновлений, по умолчанию 'stable'
124
- - `autoDownload` (boolean, optional) - автоматически скачивать
125
- - `autoInstall` (boolean, optional) - автоматически устанавливать
126
- - `checkInterval` (number, optional) - интервал проверки в мс
127
-
128
- #### Методы
129
-
130
- - `checkForUpdates(): Promise<UpdateInfo>` - проверить обновления
131
- - `downloadUpdate(): Promise<string>` - скачать обновление
132
- - `installUpdate(): Promise<void>` - установить и перезапустить
133
- - `startAutoCheck(): void` - запустить периодическую проверку
134
- - `stopAutoCheck(): void` - остановить периодическую проверку
135
- - `getUpdateInfo(): UpdateInfo | null` - получить информацию об обновлении
136
-
137
- #### События
138
-
139
- - `checking-for-update` - начало проверки
140
- - `update-available` - обновление доступно
141
- - `update-not-available` - обновлений нет
142
- - `download-progress` - прогресс загрузки
143
- - `update-downloaded` - загрузка завершена
144
- - `error` - ошибка
145
-
146
- ### UpdaterUI
147
-
148
- #### Конструктор
149
-
150
- ```typescript
151
- new UpdaterUI(options: UpdaterUIOptions)
152
- ```
153
-
154
- **UpdaterUIOptions:**
155
- - `updater` (Updater) - экземпляр Updater
156
- - `showNotification` (boolean, optional) - показывать диалоги
157
-
158
- #### Методы
159
-
160
- - `checkForUpdates(): Promise<void>` - проверить и показать UI
161
-
162
- ## Типы
163
-
164
- ```typescript
165
- interface UpdateInfo {
166
- updateAvailable: boolean;
167
- version?: string;
168
- notes?: string;
169
- downloadUrl?: string;
170
- fileName?: string;
171
- fileSize?: number;
172
- checksum?: string;
173
- isDowngrade?: boolean;
174
- }
175
-
176
- interface DownloadProgress {
177
- percent: number;
178
- transferred: number;
179
- total: number;
180
- bytesPerSecond: number;
181
- }
182
- ```
183
-
184
- ## Лицензия
185
-
186
- Proprietary. Copyright (c) 2025 Alphamatica. All rights reserved.
1
+ # @alphamatica/app-updater
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@alphamatica/app-updater.svg)](https://www.npmjs.com/package/@alphamatica/app-updater)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@alphamatica/app-updater.svg)](https://www.npmjs.com/package/@alphamatica/app-updater)
5
+ [![license](https://img.shields.io/badge/license-Proprietary-red.svg)](https://www.npmjs.com/package/@alphamatica/app-updater)
6
+
7
+ Клиентский пакет для интеграции автоматических обновлений в Electron приложения.
8
+
9
+ ## Установка
10
+
11
+ ```bash
12
+ yarn add @alphamatica/app-updater
13
+ # или
14
+ npm install @alphamatica/app-updater
15
+ ```
16
+
17
+ ## Использование
18
+
19
+ ### Базовый пример
20
+
21
+ ```typescript
22
+ import { Updater } from '@alphamatica/app-updater';
23
+ import { app } from 'electron';
24
+
25
+ const updater = new Updater({
26
+ serverUrl: 'https://updates.example.com',
27
+ appSlug: 'my-app',
28
+ currentVersion: app.getVersion(),
29
+ channel: 'stable', // опционально, по умолчанию 'stable'
30
+ });
31
+
32
+ // События
33
+ updater.on('checking-for-update', () => {
34
+ console.log('Проверка обновлений...');
35
+ });
36
+
37
+ updater.on('update-available', (info) => {
38
+ console.log(`Доступна версия ${info.version}`);
39
+ console.log(`Размер: ${info.fileSize} байт`);
40
+ console.log(`Даунгрейд: ${info.isDowngrade}`);
41
+ });
42
+
43
+ updater.on('update-not-available', () => {
44
+ console.log('Обновлений нет');
45
+ });
46
+
47
+ updater.on('download-progress', (progress) => {
48
+ console.log(`Загрузка: ${progress.percent}%`);
49
+ console.log(`Скорость: ${progress.bytesPerSecond} B/s`);
50
+ });
51
+
52
+ updater.on('update-downloaded', (info) => {
53
+ console.log(`Версия ${info.version} загружена`);
54
+ });
55
+
56
+ updater.on('error', (error) => {
57
+ console.error('Ошибка:', error.message);
58
+ });
59
+
60
+ // Проверить обновления
61
+ await updater.checkForUpdates();
62
+
63
+ // Скачать обновление
64
+ await updater.downloadUpdate();
65
+
66
+ // Установить и перезапустить
67
+ await updater.installUpdate();
68
+ ```
69
+
70
+ ### С UI компонентом
71
+
72
+ ```typescript
73
+ import { Updater, UpdaterUI } from '@alphamatica/app-updater';
74
+
75
+ const updater = new Updater({
76
+ serverUrl: 'https://updates.example.com',
77
+ appSlug: 'my-app',
78
+ currentVersion: app.getVersion(),
79
+ });
80
+
81
+ const ui = new UpdaterUI({
82
+ updater,
83
+ showNotification: true, // показывать диалоги
84
+ });
85
+
86
+ // Проверит обновления и покажет диалог если есть
87
+ await ui.checkForUpdates();
88
+ ```
89
+
90
+ ### Автоматическая проверка
91
+
92
+ ```typescript
93
+ const updater = new Updater({
94
+ serverUrl: 'https://updates.example.com',
95
+ appSlug: 'my-app',
96
+ currentVersion: app.getVersion(),
97
+ checkInterval: 60 * 60 * 1000, // каждый час
98
+ autoDownload: true, // автоматически скачивать
99
+ autoInstall: false, // НЕ устанавливать автоматически
100
+ });
101
+
102
+ // Запустить периодическую проверку
103
+ updater.startAutoCheck();
104
+
105
+ // Остановить
106
+ updater.stopAutoCheck();
107
+ ```
108
+
109
+ ## API
110
+
111
+ ### Updater
112
+
113
+ #### Конструктор
114
+
115
+ ```typescript
116
+ new Updater(config: UpdaterConfig)
117
+ ```
118
+
119
+ **UpdaterConfig:**
120
+ - `serverUrl` (string) - URL сервера обновлений
121
+ - `appSlug` (string) - slug приложения
122
+ - `currentVersion` (string) - текущая версия
123
+ - `channel` (string, optional) - канал обновлений, по умолчанию 'stable'
124
+ - `autoDownload` (boolean, optional) - автоматически скачивать
125
+ - `autoInstall` (boolean, optional) - автоматически устанавливать
126
+ - `checkInterval` (number, optional) - интервал проверки в мс
127
+
128
+ #### Методы
129
+
130
+ - `checkForUpdates(): Promise<UpdateInfo>` - проверить обновления
131
+ - `downloadUpdate(): Promise<string>` - скачать обновление
132
+ - `installUpdate(): Promise<void>` - установить и перезапустить
133
+ - `startAutoCheck(): void` - запустить периодическую проверку
134
+ - `stopAutoCheck(): void` - остановить периодическую проверку
135
+ - `getUpdateInfo(): UpdateInfo | null` - получить информацию об обновлении
136
+
137
+ #### События
138
+
139
+ - `checking-for-update` - начало проверки
140
+ - `update-available` - обновление доступно
141
+ - `update-not-available` - обновлений нет
142
+ - `download-progress` - прогресс загрузки
143
+ - `update-downloaded` - загрузка завершена
144
+ - `error` - ошибка
145
+
146
+ ### UpdaterUI
147
+
148
+ #### Конструктор
149
+
150
+ ```typescript
151
+ new UpdaterUI(options: UpdaterUIOptions)
152
+ ```
153
+
154
+ **UpdaterUIOptions:**
155
+ - `updater` (Updater) - экземпляр Updater
156
+ - `showNotification` (boolean, optional) - показывать диалоги
157
+
158
+ #### Методы
159
+
160
+ - `checkForUpdates(): Promise<void>` - проверить и показать UI
161
+
162
+ ## Типы
163
+
164
+ ```typescript
165
+ interface UpdateInfo {
166
+ updateAvailable: boolean;
167
+ version?: string;
168
+ notes?: string;
169
+ downloadUrl?: string;
170
+ fileName?: string;
171
+ fileSize?: number;
172
+ checksum?: string;
173
+ isDowngrade?: boolean;
174
+ }
175
+
176
+ interface DownloadProgress {
177
+ percent: number;
178
+ transferred: number;
179
+ total: number;
180
+ bytesPerSecond: number;
181
+ }
182
+ ```
183
+
184
+ ## Лицензия
185
+
186
+ Proprietary. Copyright (c) 2025 Alphamatica. All rights reserved.
package/dist/ui.d.ts CHANGED
@@ -6,16 +6,21 @@ export interface UpdaterUIOptions {
6
6
  }
7
7
  export declare class UpdaterUI {
8
8
  private updater;
9
- private progressWindow;
9
+ private currentWindow;
10
10
  private options;
11
+ private lastProgress;
12
+ private progressThrottleTimer;
11
13
  constructor(options: UpdaterUIOptions);
12
14
  private setupListeners;
13
15
  private setupIPC;
16
+ private createWindow;
17
+ private closeCurrentWindow;
14
18
  private showUpdateDialog;
15
- private showInstallDialog;
16
19
  private showProgressWindow;
20
+ private showInstallDialog;
21
+ private showInstallingWindow;
22
+ private showErrorDialog;
17
23
  private updateProgress;
18
- private closeProgressWindow;
19
24
  checkForUpdates(): Promise<void>;
20
25
  }
21
26
  //# sourceMappingURL=ui.d.ts.map
package/dist/ui.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,qBAAa,SAAS;IACpB,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,cAAc,CAA8B;IACpD,OAAO,CAAC,OAAO,CAA6B;gBAEhC,OAAO,EAAE,gBAAgB;IAYrC,OAAO,CAAC,cAAc;IAoBtB,OAAO,CAAC,QAAQ;YAkBF,gBAAgB;YAiBhB,iBAAiB;IAkB/B,OAAO,CAAC,kBAAkB;IA4E1B,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,mBAAmB;IAOrB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;CAGvC"}
1
+ {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAmJD,qBAAa,SAAS;IACpB,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,aAAa,CAA8B;IACnD,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,YAAY,CAAiC;IACrD,OAAO,CAAC,qBAAqB,CAA+B;gBAEhD,OAAO,EAAE,gBAAgB;IAerC,OAAO,CAAC,cAAc;IAoBtB,OAAO,CAAC,QAAQ;IAkBhB,OAAO,CAAC,YAAY;IAyBpB,OAAO,CAAC,kBAAkB;IAO1B,OAAO,CAAC,gBAAgB;IA0CxB,OAAO,CAAC,kBAAkB;IA0D1B,OAAO,CAAC,iBAAiB;IA0CzB,OAAO,CAAC,oBAAoB;IAuB5B,OAAO,CAAC,eAAe;IA8CvB,OAAO,CAAC,cAAc;IAgBhB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;CAGvC"}