mirror of
https://github.com/desktop/desktop
synced 2024-11-05 20:49:32 +00:00
46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
'use strict'
|
|
|
|
const fs = require('fs-extra')
|
|
const cp = require('child_process')
|
|
const path = require('path')
|
|
const distInfo = require('./dist-info')
|
|
|
|
const distPath = distInfo.getDistPath()
|
|
const productName = distInfo.getProductName()
|
|
|
|
if (process.platform === 'darwin') {
|
|
packageOSX()
|
|
} else if (process.platform === 'win32') {
|
|
packageWindows()
|
|
} else {
|
|
console.error(`I dunno how to package for ${process.platform} :(`)
|
|
process.exit(1)
|
|
}
|
|
|
|
function packageOSX () {
|
|
const dest = distInfo.getOSXZipPath()
|
|
fs.removeSync(dest)
|
|
|
|
cp.execSync(`ditto -ck --keepParent ${distPath}/${productName}.app ${dest}`)
|
|
console.log(`Zipped to ${dest}`)
|
|
}
|
|
|
|
function packageWindows () {
|
|
const electronInstaller = require('electron-winstaller')
|
|
const outputDir = path.join(distPath, '..', 'installer')
|
|
// TODO: We'll need to sign this shit.
|
|
electronInstaller
|
|
.createWindowsInstaller({
|
|
appDirectory: distPath,
|
|
outputDirectory: outputDir,
|
|
authors: distInfo.getCompanyName(),
|
|
exe: `${productName}.exe`
|
|
})
|
|
.then(() => console.log(`Installers created in ${outputDir}`))
|
|
.catch(e => {
|
|
console.error(`Error packaging: ${e}`)
|
|
process.exit(1)
|
|
})
|
|
}
|