Π·Π΅Ρ€ΠΊΠ°Π»ΠΎ ΠΈΠ·
1
0
Π€ΠΎΡ€ΠΊΠ½ΡƒΡ‚ΡŒ 0
🌲 A drop-in module that adds autoUpdating capabilities to Electron apps
ΠŸΠ΅Ρ€Π΅ΠΉΡ‚ΠΈ ΠΊ Ρ„Π°ΠΉΠ»Ρƒ
dependabot[bot] fdd4faa6b4
chore: Bump micromatch from 4.0.2 to 4.0.8 (#156)
Bumps [micromatch](https://github.com/micromatch/micromatch) from 4.0.2 to 4.0.8.
- [Release notes](https://github.com/micromatch/micromatch/releases)
- [Changelog](https://github.com/micromatch/micromatch/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/micromatch/compare/4.0.2...4.0.8)

---
updated-dependencies:
- dependency-name: micromatch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-30 00:57:23 -04:00
.circleci chore: bump electronjs/node in .circleci/config.yml to 2.3.0 (#150) 2024-06-12 10:38:37 -03:00
.github chore: Bump amannn/action-semantic-pull-request from 5.5.2 to 5.5.3 (#153) 2024-07-01 00:29:38 -07:00
src feat: add support for static storage provided updates (#105) 2023-10-22 14:51:37 -07:00
test feat: add support for static storage provided updates (#105) 2023-10-22 14:51:37 -07:00
.gitignore feat: add support for static storage provided updates (#105) 2023-10-22 14:51:37 -07:00
.prettierrc.json feat: add support for static storage provided updates (#105) 2023-10-22 14:51:37 -07:00
.releaserc.json build: fixup .releasesrc.json (#128) 2023-10-24 11:15:53 -07:00
LICENSE Added LICENSE 2018-04-18 10:00:31 -07:00
README.md docs: code signing only required on macOS (#152) 2024-06-28 13:10:47 -04:00
package.json chore: bump continuousauth/npm to 2.1.0 (main) (#133) 2023-11-21 16:32:42 -08:00
screenshot.png add screenshot 2018-04-19 09:01:39 -07:00
tsconfig.json feat: add support for static storage provided updates (#105) 2023-10-22 14:51:37 -07:00
yarn.lock chore: Bump micromatch from 4.0.2 to 4.0.8 (#156) 2024-08-30 00:57:23 -04:00

README.md

update-electron-app

A drop-in module that adds autoUpdating capabilities to Electron apps

CircleCI build status npm version

Supports multiple update sources:

  • The free and open-source update.electronjs.org service.
  • Static file storage E.g. S3, Google Cloud Storage, etc.

screenshot

Requirements

Before using this module, make sure your Electron app meets these criteria:

  • Your app runs on macOS or Windows
  • Your builds are code signed (macOS only)
  • If using update.electronjs.org
    • Your app has a public GitHub repository
    • Your builds are published to GitHub Releases
  • If using static file storage
    • Your builds are published to S3 or other similar static file host using a tool like @electron-forge/publisher-s3

Installation

npm i update-electron-app

Usage

With update.electronjs.org

Drop this anywhere in your main process:

const { updateElectronApp } = require('update-electron-app')
updateElectronApp()

By default your repository URL is found in your app's package.json file.

You can also specify custom options:

const { updateElectronApp, UpdateSourceType } = require('update-electron-app')
updateElectronApp({
  updateSource: {
    type: UpdateSourceType.ElectronPublicUpdateService,
    repo: 'github-user/repo'
  },
  updateInterval: '1 hour',
  logger: require('electron-log')
})

With static file storage

const { updateElectronApp, UpdateSourceType } = require('update-electron-app')
updateElectronApp({
  updateSource: {
    type: UpdateSourceType.StaticStorage,
    baseUrl: `https://my-bucket.s3.amazonaws.com/my-app-updates/${process.platform}/${process.arch}`
  }
})

What happens?

Once you've called updateElectronApp as documented above, that's it! Here's what happens by default:

  • Your app will check for updates at startup, then every ten minutes. This interval is configurable.
  • No need to wait for your app's ready event; the module figures that out.
  • If an update is found, it will automatically be downloaded in the background.
  • When an update is finished downloading, a dialog is displayed allowing the user to restart the app now or later.

API

update(options)

Additional Options:

  • updateInterval String (optional) - How frequently to check for updates. Defaults to 10 minutes. Minimum allowed interval is 5 minutes. This is a human readable interval supported by the ms module
  • logger Object (optional) - A custom logger object that defines a log function. Defaults to console. See electron-log, a module that aggregates logs from main and renderer processes into a single file.
  • notifyUser Boolean (optional) - Defaults to true. When enabled the user will be prompted to apply the update immediately after download.

FAQ

What kinds of assets do I need to build?

For macOS, you'll need to build a .zip file. Use electron-forge or electron-installer-zip to package your app as a zip.

For Windows, you'll need to build a .exe and .nupkg files with electron-forge or electron-winstaller.

Why is my app launching multiple times?

Windows apps have an update process that requires multiple application restarts. You can use the electron-squirrel-startup module to improve this behavior.

Can I use this module by uploading my private app's builds to a public GitHub repository?

Yes :)

I want to manually upload my builds to a static storage solution, where do I put them?

If you publish your builds manually ensure the file structure is:

  • **/{platform}/{arch}/{artifact}

For example that means that these files should exist:

  • **/win32/x64/RELEASES
  • **/darwin/arm64/RELEASES.json
  • **/darwin/arm64/My App v1.0.0.zip (or something similar)
  • ...

License

MIT