Wednesday, 24 May 2017

Avoid install Electron with package installer electron-windows-installer

I'm using:

https://www.npmjs.com/package/electron-windows-installer

For creating a installer of my app that it's build with electron and angular 1.4.

Everytime I execute the installer package, Electron is being installed. I want to check that Electron is installed or not in the machine, and if is installed do nothing, and continue with the installation.

My code is estracted from the npm page:

'use strinct';

var gulp = require('gulp');
var path = require('path'); 
var winInstaller = require('electron-windows-installer');

gulp.task('create-windows-installer', function(done) {
  var executablePath = process.cwd();
  var iconRelativePath = '\\installer\\sh_icons\\SH.ico';
  var iconAbsolutePath = path.join(executablePath, iconRelativePath);
  var iconAbsoluteUri = 'file:///' + iconAbsolutePath;

  winInstaller({
    appDirectory: 'build/Sh-win32-x64',
    outputDirectory: 'release',
    iconUrl: iconAbsoluteUri,
    exe: 'Sh.exe',
    title: 'Sh',
    setupExe: 'Sh.exe',
    setupMsi: 'Sh.msi',
    setupIcon: './installer/sh_icons/sh.ico',
    loadingGif: './installer/sh_icons/installer.gif',
    arch: 'ia64'
  }).then(done).catch(done);
});

Thanks in advance



via user1432966

No comments:

Post a Comment