GithubHelp home page GithubHelp logo

electron-delta / electron-delta Goto Github PK

View Code? Open in Web Editor NEW
35.0 1.0 2.0 3.54 MB

True delta updates for electronjs

Home Page: https://electrondelta.com/

JavaScript 91.06% NSIS 8.94%
electron-app electron-builder electron-updater electronjs delta-updates

electron-delta's Introduction

I'm working on macos delta updates. It's going to come soon. Help required!

@electron-delta/builder

True delta updates for electronjs apps. It reduces the bandwidth usage by 90%. Users download only the delta. It uses binary diffing (HDiffPatch library) to generate the delta.

Delta updates

Requirements

  1. The app must use electron-builder to build the app.
  2. Currently only Windows os is supported. MacOS support is arriving soon.
  3. Target must be nsis or nsis-web

Installation

Step 1:

npm install @electron-delta/builder -D

Step 2:

Create a file name called .electron-delta.js in the root of the project.

Step 3:

In the electron-builder config, mention the above file as afterAllArtifactBuild hook.

"build": {
    "appId": "com.electron.sample-app",
    "afterAllArtifactBuild": ".electron-delta.js",
    "win": {
      "target": ["nsis"],
      "publish": ["github"]
    },
    "nsis": {
      "oneClick": true,
      "perMachine": false,
    }
}

Step 4:

Paste the following code in the .electron-delta.js file. It will be executed after the app is built.

// .electron-delta.js
const DeltaBuilder = require("@electron-delta/builder");
const path = require("path");

const options = {
  productIconPath: path.join(__dirname, "icon.ico"),
  productName: "electron-sample-app",

  getPreviousReleases: async () => {
    return [
      {
        version: '0.0.12',
        url: 'https://github.com/electron-delta/electron-sample-app/releases/download/v0.0.12/electron-sample-app-0.0.12.exe'
      },
      {
        version: '0.0.11',
        url: 'https://github.com/electron-delta/electron-sample-app/releases/download/v0.0.11/electron-sample-app-0.0.11.exe'
      },
      {
        version: '0.0.9',
        url: 'https://github.com/electron-delta/electron-sample-app/releases/download/v0.0.9/electron-sample-app-0.0.9.exe'
      }
    ];
  },
  sign: async (filePath) => {
    // sign each delta executable
  },
};

exports.default = async function (context) {
  const deltaInstallerFiles = await DeltaBuilder.build({
    context,
    options,
  });
  return deltaInstallerFiles;
};

options

  • productIconPath: (required) Path to the icon file. The icon file must be a .ico file.
  • productName: (required) Name of the product.
  • getPreviousReleases: (required) Function to get the previous releases. It must return an array of objects. Each object must have version and url properties.
  • sign: (required) Function to sign the delta executable.
  • cache: (optional) Path to the cache directory. If not specified, the default cache directory will be used. The default cache directory is ~/.electron-delta/.
  • processName: (optional) Name of the process. If different from the product name.
  • latestVersion: (optional) Latest version of the product. If not specified, the latest version will be fetched process.env.npm_package_version.

electron-delta's People

Contributors

sandeep1995 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

electron-delta's Issues

Error with 7-Zip when I try to upload a new version and there are already previous ones

As described in the title, I have the following error:

7-Zip (a) 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21

Scanning the drive for archives:
1 file, 0 bytes

Extracting archive: ...\v0.0.1.exe
ERROR: ...\v0.0.1.exe
Can not open the file as archive

Can't open as archive: 1
Files: 0
Size:       0
Compressed: 0
  failedTask=build stackTrace=Error: Error: 7-zip exited with code 2

In the quick start described in this package (and also in the complete example code (https://github.com/electron-delta/electron-sample-app) you use files with the extension .exe, is that correct?

  getPreviousReleases: async () => {
    return [
      {
        version: '0.0.12',
        url: 'https://github.com/electron-delta/electron-sample-app/releases/download/v0.0.12/electron-sample-app-0.0.12.exe'
      },
      {
        version: '0.0.11',
        url: 'https://github.com/electron-delta/electron-sample-app/releases/download/v0.0.11/electron-sample-app-0.0.11.exe'
      },
      {
        version: '0.0.9',
        url: 'https://github.com/electron-delta/electron-sample-app/releases/download/v0.0.9/electron-sample-app-0.0.9.exe'
      }
    ];
  },

I also tried pointing to the source files in the .zip package, but I get the same error.

Thank you

Repo demonstrating an example

Hello,
I have a hard time understand how this works.
Does it supersede Electron-updater, and the delta file is pulled instead of the generated installer?
Would this work with a generic provider, or only Github?
Could I please trouble you for an example repo?
Thank you very much.

Issues with current version 0.1.17

In order for delta-updater to work normally, following code was used:

const deltaUpdater = new DeltaUpdater({
    logger: require('electron-log'),
    autoUpdater: require("electron-updater").autoUpdater,
});
try {
    deltaUpdater.boot({
        splashScreen: false
    });
    app.on('quit', () => {
        deltaUpdater.onQuit();
    });
} catch (error) {
    logger.error(error);
}
  1. without specifying splashScreen did not work.
  2. without app.on('quit', () => {deltaUpdater.onQuit()}) update installation does not start when app exit. More precisely, this.onQuit function does not work.

There were other issues too, but found out they were from electron-builder.

Set GitHub token from code

How can I set the GitHub token from code to access the list of my private repositories?
Right now I have to set the GH_TOKEN environment variable from PowerShell.

[Environment]::SetEnvironmentVariable("GH_TOKEN","<GitHub_token>","User")

To upload the build I can specify it in the JSON and it works, but to access the list of previous versions, in my case from a private repository, I do not know how to set it from code.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.