@alphamatica/app-updater 1.0.0 → 1.0.2

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,46 +1,74 @@
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.0] - 2024-12-14
9
-
10
- ### Added
11
-
12
- - Initial release
13
- - `Updater` class for checking, downloading, and installing updates
14
- - `UpdaterUI` class for showing update dialogs in Electron
15
- - Support for multiple platforms: Windows, macOS, Linux
16
- - Support for multiple architectures: x64, arm64, ia32
17
- - Support for multiple file types: zip, tar.gz, AppImage, exe, dmg
18
- - Automatic update checking with configurable interval
19
- - Download progress tracking
20
- - Server-controlled updates and downgrades
21
- - Event-based API for update lifecycle
22
- - TypeScript support with full type definitions
23
-
24
- ### Features
25
-
26
- - **Updater**
27
- - `checkForUpdates()` - Check for available updates
28
- - `downloadUpdate()` - Download the update file
29
- - `installUpdate()` - Install update and restart application
30
- - `startAutoCheck()` / `stopAutoCheck()` - Automatic periodic checking
31
- - Event emitter for update lifecycle events
32
-
33
- - **UpdaterUI**
34
- - Native Electron dialogs for update notifications
35
- - Progress dialog during download
36
- - Confirmation dialogs for install/restart
37
-
38
- ### Configuration
39
-
40
- - `serverUrl` - URL of the A-Updater server
41
- - `appSlug` - Application identifier
42
- - `currentVersion` - Current application version
43
- - `channel` - Update channel (default: 'stable')
44
- - `autoDownload` - Automatically download updates
45
- - `autoInstall` - Automatically install updates
46
- - `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.2] - 2025-12-15
9
+
10
+ ### Fixed
11
+
12
+ - Fixed incorrect update extraction path (was extracting to `resources/` instead of app root)
13
+ - Fixed Windows update installation (cannot replace running executable)
14
+ - Added helper scripts for Windows and Linux/macOS to properly replace files after app exit
15
+
16
+ ### Added
17
+
18
+ - Automatic cleanup of old temporary update files on startup
19
+ - New modern UI for all update dialogs (update available, download progress, install, error)
20
+ - Progress throttling to prevent percentage jumps during download
21
+ - Download speed display in progress window
22
+ - Installing spinner window
23
+
24
+ ### Changed
25
+
26
+ - All update windows now use `alwaysOnTop: true` to stay visible
27
+ - Replaced system dialogs with custom styled windows
28
+ - macOS now also uses helper script for more reliable updates
29
+
30
+ ## [1.0.1] - 2025-12-14
31
+
32
+ ### Changed
33
+
34
+ - License changed to Proprietary (UNLICENSED)
35
+
36
+ ## [1.0.0] - 2025-12-14
37
+
38
+ ### Added
39
+
40
+ - Initial release
41
+ - `Updater` class for checking, downloading, and installing updates
42
+ - `UpdaterUI` class for showing update dialogs in Electron
43
+ - Support for multiple platforms: Windows, macOS, Linux
44
+ - Support for multiple architectures: x64, arm64, ia32
45
+ - Support for multiple file types: zip, tar.gz, AppImage, exe, dmg
46
+ - Automatic update checking with configurable interval
47
+ - Download progress tracking
48
+ - Server-controlled updates and downgrades
49
+ - Event-based API for update lifecycle
50
+ - TypeScript support with full type definitions
51
+
52
+ ### Features
53
+
54
+ - **Updater**
55
+ - `checkForUpdates()` - Check for available updates
56
+ - `downloadUpdate()` - Download the update file
57
+ - `installUpdate()` - Install update and restart application
58
+ - `startAutoCheck()` / `stopAutoCheck()` - Automatic periodic checking
59
+ - Event emitter for update lifecycle events
60
+
61
+ - **UpdaterUI**
62
+ - Native Electron dialogs for update notifications
63
+ - Progress dialog during download
64
+ - Confirmation dialogs for install/restart
65
+
66
+ ### Configuration
67
+
68
+ - `serverUrl` - URL of the A-Updater server
69
+ - `appSlug` - Application identifier
70
+ - `currentVersion` - Current application version
71
+ - `channel` - Update channel (default: 'stable')
72
+ - `autoDownload` - Automatically download updates
73
+ - `autoInstall` - Automatically install updates
74
+ - `checkInterval` - Interval for automatic checking (ms)
package/LICENSE CHANGED
@@ -1,21 +1,7 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 Alphamatica
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
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/npm/l/@alphamatica/app-updater.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
- MIT
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;IAYrC,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"}