dev-sidecar/packages/gui/pkg/after-pack.js

20 lines
701 B
JavaScript
Raw Normal View History

2021-04-03 09:23:22 +00:00
const path = require('path')
const AdmZip = require('adm-zip')
const pkg = require('../package.json')
exports.default = async function (context) {
// console.log('context', context)
2021-04-03 09:23:22 +00:00
let targetPath
2021-04-03 10:29:54 +00:00
let systemType = ''
2021-04-03 09:23:22 +00:00
if (context.packager.platform.nodeName === 'darwin') {
targetPath = path.join(context.appOutDir, `${context.packager.appInfo.productName}.app/Contents/Resources`)
2021-04-03 10:29:54 +00:00
systemType = 'mac'
2021-04-03 09:23:22 +00:00
} else {
targetPath = path.join(context.appOutDir, './resources')
2021-04-03 10:29:54 +00:00
systemType = 'win'
2021-04-03 09:23:22 +00:00
}
const zip = new AdmZip()
zip.addLocalFolder(targetPath)
2021-04-03 10:29:54 +00:00
const partUpdateFile = `update-${systemType}-${pkg.version}.zip`
2021-04-03 09:23:22 +00:00
zip.writeZip(path.join(context.outDir, partUpdateFile))
}