text: const createWindowsInstaller = require('electron-winstaller').createWindowsInstaller
  const path = require('path')
  const rimraf = require('rimraf')
  
  deleteOutputFolder()
    .then(getInstallerConfig)
    .then(createWindowsInstaller)
    .catch((error) => {
      console.log('err')
      console.error(error.message || error)
      process.exit(1)
    })
  
  function getInstallerConfig () {
    const rootPath = path.join(__dirname, '..')
    const outPath = path.join(rootPath, 'dist')
    return Promise.resolve({
      appDirectory: path.join(outPath, 'win-unpacked'),
      noMsi: true,
      outputDirectory: path.join(outPath, 'windows-installer'),
      setupExe: 'CryptoSD-Installer.exe',
      // loadingGif: path.join(rootPath, 'static', 'loading.gif'),
      setupIcon: path.join(rootPath, 'images', 'logoICO.ico'),
      skipUpdateIcon: true
    })
  }
  
  function deleteOutputFolder () {
    return new Promise((resolve, reject) => {
      rimraf(path.join(__dirname, '..', 'out', 'windows-installer'), (error) => {
        error ? reject(error) : resolve()
      })
    })
  }