3
votes

After searching on the web on how to make an installer and updater for my electron app I find that installer and update section is not soo easy, and I need extra help because this problem introduces more challenges.

I have a simple folder structure like this:

 - package.json
 - index.html
 - main.css
 - main.js

package.json

{
  "name": "myappname",
  "version": "1.0.0",
  "description": "my app description",
  "main": "main.js",
  "scripts": {
    "start": "electron main.js",
    "package-win": "electron-packager . --overwrite --asar=true --platform=win32 --arch=ia32 --icon=recurces/icons/win/001-pie-chart.ico --prune=false --out=release-builds --version-string.CompanyName=myCompany.inc --version-string.FileDescription=test --version-string.ProductName=test_5"
  },

  "author": "myName",
  "license": "BSD-3-Clause",
  "devDependencies": {
    "electron": "^1.6.2",
    "electron-packager": "^8.5.2"
  }
}

What I have done so far:

  • I have installed the electron modules.
  • I package my app with the electron packager.
  • and now I want to make the installer.

I have tried the winstaller but the documentation is not so easy to follow.

and then i try to give a chance to installForge.

Inside installForge is an option to make the updates, that's good but the problem I am facing now is that I dont host my app on GitHub or any other hosting provider I want my code to be in my computer and with express.js I have to make a FILE SERVER

The server dont work as expected

The code

var express = require('express');
var path = require('path');
var app = express();

// Define the port to run on
app.set('port', 3000);

app.use(express.static(path.join(__dirname, 'public')));

// Listen for requests
var server = app.listen(app.get('port'), function() {
  var port = server.address().port;
  console.log('Magic happens on port ' + port);
});

inside this project with express.js, I have a folder name dist/win

inside dist/win, I have 1 more package that has the 1.0.2 version how to get the files from that local server and update my electron app source.

How I can make a simple installer with a simple auto-update mechanism?