How to use the electron-installer-common.wrapError function in electron-installer-common

To help you get started, we’ve selected a few electron-installer-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github electron-userland / electron-installer-windows / src / installer.js View on Github external
createPackage () {
    this.options.logger(`Creating package at ${this.stagingDir}`)

    const cmd = path.join(this.vendorDir, 'nuget', 'nuget.exe')
    const args = [
      'pack',
      this.specPath,
      '-BasePath',
      this.stagingAppDir,
      '-OutputDirectory',
      path.join(this.stagingDir, 'nuget'),
      '-NoDefaultExcludes'
    ]

    return common.wrapError('creating package with NuGet', async () => spawn(cmd, args, this.options.logger))
  }
github electron-userland / electron-installer-windows / src / installer.js View on Github external
async syncRemoteReleases () {
    if (!this.options.remoteReleases) {
      return
    }

    this.options.logger(`Syncing package at ${this.stagingDir}`)

    const cmd = path.join(this.vendorDir, 'squirrel', 'SyncReleases.exe')
    const args = [
      '--url',
      this.options.remoteReleases,
      '--releaseDir',
      this.squirrelDir
    ]

    return common.wrapError('syncing remote releases', async () => {
      await fs.ensureDir(this.squirrelDir, '0755')
      return spawn(cmd, args, this.options.logger)
    })
  }
}
github electron-userland / electron-installer-windows / src / installer.js View on Github external
copySquirrelUpdater () {
    const updateSrc = path.join(this.vendorDir, 'squirrel', 'Squirrel.exe')
    const updateDest = path.join(this.stagingAppDir, 'Update.exe')
    return common.wrapError('copying Squirrel updater', async () => fs.copy(updateSrc, updateDest))
  }
github electron-userland / electron-installer-windows / src / installer.js View on Github external
findPackage () {
    const packagePattern = path.join(this.stagingDir, 'nuget', '*.nupkg')
    this.options.logger(`Finding package with pattern ${packagePattern}`)

    return common.wrapError('finding package with pattern', async () => {
      const files = await glob(packagePattern)
      return files[0]
    })
  }
github electron-userland / electron-installer-debian / src / installer.js View on Github external
copyScripts () {
    const scriptNames = ['preinst', 'postinst', 'prerm', 'postrm']

    return common.wrapError('creating script files', async () =>
      Promise.all(_.map(this.options.scripts, async (item, key) => {
        if (scriptNames.includes(key)) {
          const scriptFile = path.join(this.stagingDir, 'DEBIAN', key)
          this.options.logger(`Creating script file at ${scriptFile}`)

          await fs.copy(item, scriptFile)
          return fs.chmod(scriptFile, 0o755)
        } else {
          throw new Error(`Wrong executable script name: ${key}`)
        }
      }))
    )
  }
github electron-userland / electron-installer-debian / src / installer.js View on Github external
createControl () {
    const src = path.resolve(__dirname, '../resources/control.ejs')
    const dest = path.join(this.stagingDir, 'DEBIAN', 'control')
    this.options.logger(`Creating control file at ${dest}`)

    return common.wrapError('creating control file', async () => this.createTemplatedFile(src, dest))
  }
github electron-userland / electron-installer-windows / src / installer.js View on Github external
createSpec () {
    const src = path.resolve(__dirname, '../resources/spec.ejs')
    this.options.logger(`Creating spec file at ${this.specPath}`)

    return common.wrapError('creating spec file', async () => this.createTemplatedFile(src, this.specPath))
  }
github electron-userland / electron-installer-redhat / src / installer.js View on Github external
async createSpec () {
    const src = path.resolve(__dirname, '../resources/spec.ejs')
    this.options.logger(`Creating spec file at ${this.specPath}`)

    return common.wrapError('creating spec file', async () => this.createTemplatedFile(src, this.specPath))
  }