npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@alphamatica/app-updater

v1.0.15

Published

Electron auto-updater client for A-Updater service

Readme

@alphamatica/app-updater

npm version npm downloads license

Клиентский пакет для интеграции автоматических обновлений в Electron приложения.

Возможности

  • ✅ Поддержка Windows, macOS, Linux
  • ✅ Множество форматов: ZIP, TAR.GZ, DMG, EXE, AppImage
  • ✅ Автоматическая проверка обновлений
  • ✅ Отслеживание прогресса загрузки
  • ✅ Встроенный UI для диалогов обновления
  • ✅ Защита от повторных обновлений
  • ✅ События для интеграции с UI
  • ✅ TypeScript поддержка

Установка

yarn add @alphamatica/app-updater
# или
npm install @alphamatica/app-updater

Использование

Базовый пример

import { Updater } from '@alphamatica/app-updater';
import { app } from 'electron';

const updater = new Updater({
  serverUrl: 'https://updates.example.com',
  appSlug: 'my-app',
  currentVersion: app.getVersion(),
  channel: 'stable', // опционально, по умолчанию 'stable'
});

// События
updater.on('checking-for-update', () => {
  console.log('Проверка обновлений...');
});

updater.on('update-available', (info) => {
  console.log(`Доступна версия ${info.version}`);
  console.log(`Размер: ${info.fileSize} байт`);
  console.log(`Даунгрейд: ${info.isDowngrade}`);
});

updater.on('update-not-available', () => {
  console.log('Обновлений нет');
});

updater.on('download-progress', (progress) => {
  console.log(`Загрузка: ${progress.percent}%`);
  console.log(`Скорость: ${progress.bytesPerSecond} B/s`);
});

updater.on('update-downloaded', (info) => {
  console.log(`Версия ${info.version} загружена`);
});

updater.on('log', (message) => {
  console.log(`[Updater] ${message}`);
  // Отображение статуса установки в UI
});

updater.on('error', (error) => {
  console.error('Ошибка:', error.message);
});

// Проверить обновления
await updater.checkForUpdates();

// Скачать обновление
await updater.downloadUpdate();

// Установить и перезапустить
await updater.installUpdate();

С UI компонентом

import { Updater, UpdaterUI } from '@alphamatica/app-updater';

const updater = new Updater({
  serverUrl: 'https://updates.example.com',
  appSlug: 'my-app',
  currentVersion: app.getVersion(),
});

const ui = new UpdaterUI({
  updater,
  showNotification: true, // показывать диалоги
});

// Проверит обновления и покажет диалог если есть
await ui.checkForUpdates();

Автоматическая проверка

С интервалом (старый способ)

const updater = new Updater({
  serverUrl: 'https://updates.example.com',
  appSlug: 'my-app',
  currentVersion: app.getVersion(),
  checkInterval: 60 * 60 * 1000, // каждый час
  autoDownload: true,  // автоматически скачивать
  autoInstall: false,  // НЕ устанавливать автоматически
});

// Запустить периодическую проверку
updater.startAutoCheck();

// Остановить
updater.stopAutoCheck();

С cron-расписанием (рекомендуется)

const updater = new Updater({
  serverUrl: 'https://updates.example.com',
  appSlug: 'my-app',
  currentVersion: app.getVersion(),
  checkSchedule: '0 9,17 * * *', // каждый день в 9:00 и 17:00
  autoDownload: true,
  autoInstall: false,
});

// Запустить проверку по расписанию
updater.startAutoCheck();

Примеры cron-выражений:

  • '0 * * * *' - каждый час в начале часа
  • '0 0 * * *' - каждый день в полночь
  • '0 9,17 * * *' - каждый день в 9:00 и 17:00
  • '*/30 * * * *' - каждые 30 минут
  • '0 0 * * 1' - каждый понедельник в полночь
  • '0 12 * * 1-5' - каждый будний день в полдень

Формат cron: минута час день месяц день_недели

  • Минута: 0-59
  • Час: 0-23
  • День: 1-31
  • Месяц: 1-12
  • День недели: 0-7 (0 и 7 = воскресенье)

API

Updater

Конструктор

new Updater(config: UpdaterConfig)

UpdaterConfig:

  • serverUrl (string) - URL сервера обновлений
  • appSlug (string) - slug приложения
  • currentVersion (string) - текущая версия
  • channel (string, optional) - канал обновлений, по умолчанию 'stable'
  • autoDownload (boolean, optional) - автоматически скачивать
  • autoInstall (boolean, optional) - автоматически устанавливать
  • checkSchedule (string, optional) - cron-выражение для расписания проверок (рекомендуется)
  • checkInterval (number, optional) - интервал проверки в мс (устарело, используйте checkSchedule)

Методы

  • checkForUpdates(): Promise<UpdateInfo> - проверить обновления
  • downloadUpdate(): Promise<string> - скачать обновление
  • installUpdate(): Promise<void> - установить и перезапустить
  • startAutoCheck(): void - запустить периодическую проверку
  • stopAutoCheck(): void - остановить периодическую проверку
  • getUpdateInfo(): UpdateInfo | null - получить информацию об обновлении

События

  • checking-for-update - начало проверки
  • update-available - обновление доступно
  • update-not-available - обновлений нет
  • download-progress - прогресс загрузки
  • update-downloaded - загрузка завершена
  • log - информационные сообщения о процессе установки
  • error - ошибка

UpdaterUI

Конструктор

new UpdaterUI(options: UpdaterUIOptions)

UpdaterUIOptions:

  • updater (Updater) - экземпляр Updater
  • showNotification (boolean, optional) - показывать диалоги

Методы

  • checkForUpdates(): Promise<void> - проверить и показать UI

Поддерживаемые форматы

  • Windows: .zip, .exe
  • macOS: .zip, .tar.gz, .dmg
  • Linux: .tar.gz, .AppImage

DMG для macOS

Полная поддержка DMG образов для macOS:

  • Автоматическое монтирование и размонтирование DMG
  • Прямая установка без временной распаковки
  • Корректная очистка смонтированных томов
  • Автоматический перезапуск приложения

Типы

interface UpdateInfo {
  updateAvailable: boolean;
  version?: string;
  notes?: string;
  downloadUrl?: string;
  fileName?: string;
  fileSize?: number;
  checksum?: string;
  isDowngrade?: boolean;
}

interface DownloadProgress {
  percent: number;
  transferred: number;
  total: number;
  bytesPerSecond: number;
}

Защита от повторных обновлений

Автоматическая защита от одновременных попыток обновления:

  • Таймер автопроверки останавливается при начале скачивания
  • Повторные вызовы checkForUpdates() игнорируются во время активного обновления
  • Флаг сбрасывается при ошибках или после успешной установки

Лицензия

Proprietary. Copyright (c) 2026 Alphamatica. All rights reserved.