Skip to content

Commit

Permalink
enable builds for windows 32-bit and arm64 installers
Browse files Browse the repository at this point in the history
  • Loading branch information
PalmerAL committed Mar 8, 2024
1 parent 6327c76 commit e78e260
Showing 1 changed file with 38 additions and 26 deletions.
64 changes: 38 additions & 26 deletions scripts/buildWindows.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,41 +14,49 @@ async function afterPackageBuilt (packagePath) {
fs.mkdirSync('dist/app')
}

let archSuffix

if (packagePath.includes('ia32')) {
archSuffix = '-ia32'
} else if (packagePath.includes('arm64')) {
archSuffix = '-arm64'
} else {
archSuffix = ''
}

/* create zip files */
var output = fs.createWriteStream('dist/app/' + 'Min-v' + version + '-windows' + (packagePath.includes('ia32') ? '-ia32' : '') + '.zip')
var output = fs.createWriteStream('dist/app/' + 'Min-v' + version + '-windows' + archSuffix + '.zip')
var archive = archiver('zip', {
zlib: { level: 9 }
})
archive.directory(packagePath, 'Min-v' + version)
archive.pipe(output)
await archive.finalize()

/* create installer for 64-bit */
if (!packagePath.includes('ia32')) {
const installer = require('electron-installer-windows')

const options = {
src: packagePath,
dest: 'dist/app/min-installer-x64',
icon: 'icons/icon256.ico',
animation: 'icons/windows-installer.gif',
licenseUrl: 'https://github.com/minbrowser/min/blob/master/LICENSE.txt',
noMsi: true
}

console.log('Creating package (this may take a while)')

fs.copyFileSync('LICENSE.txt', packagePath + '/LICENSE')

await installer(options)
.then(function () {
fs.renameSync('./dist/app/min-installer-x64/min-' + version + '-setup.exe', './dist/app/min-' + version + '-setup.exe')
})
.catch(err => {
console.error(err, err.stack)
process.exit(1)
})
/* create installer */
const installer = require('electron-installer-windows')

const options = {
src: packagePath,
dest: 'dist/app/min-installer' + archSuffix,
icon: 'icons/icon256.ico',
animation: 'icons/windows-installer.gif',
licenseUrl: 'https://github.com/minbrowser/min/blob/master/LICENSE.txt',
noMsi: true
}

console.log('Creating package (this may take a while)')

fs.copyFileSync('LICENSE.txt', packagePath + '/LICENSE')

await installer(options)
.then(function () {
fs.renameSync('./dist/app/min-installer' + archSuffix + '/min-' + version + '-setup.exe', './dist/app/min-' + version + archSuffix + '-setup.exe')
})
.catch(err => {
console.error(err, err.stack)
process.exit(1)
})
}

// creating multiple packages simultaneously causes errors in electron-rebuild, so do one arch at a time instead
Expand All @@ -58,3 +66,7 @@ createPackage('win32', { arch: Arch.x64 })
return createPackage('win32', { arch: Arch.ia32 })
})
.then(afterPackageBuilt)
.then(function () {
return createPackage('win32', { arch: Arch.arm64 })
})
.then(afterPackageBuilt)

0 comments on commit e78e260

Please sign in to comment.