parent
52c07106b9
commit
3396664443
@ -0,0 +1,21 @@
|
||||
const path = require('path')
|
||||
const pkg = require('../package.json')
|
||||
const fs = require('fs')
|
||||
|
||||
function appendIntro (context, systemType, latest) {
|
||||
const partUpdateFile = `update-${systemType}-${pkg.version}.zip`
|
||||
|
||||
const partUpdateUrl = context.configuration.publish.url + partUpdateFile
|
||||
|
||||
const latestFilePath = path.join(context.outDir, latest)
|
||||
fs.appendFile(latestFilePath, `\npartPackage: ${partUpdateUrl}\nreleaseNotes: \n - 升级日志`, (err) => {
|
||||
if (err) {
|
||||
console.log('修改latest 失败')
|
||||
}
|
||||
})
|
||||
}
|
||||
exports.default = async function (context) {
|
||||
console.log('context222', context)
|
||||
appendIntro(context, 'mac', 'latest-mac.yml')
|
||||
appendIntro(context, 'win', 'latest.yml')
|
||||
}
|
@ -1,29 +1,19 @@
|
||||
const path = require('path')
|
||||
const AdmZip = require('adm-zip')
|
||||
const pkg = require('../package.json')
|
||||
const fs = require('fs')
|
||||
exports.default = async function (context) {
|
||||
console.log('context', context)
|
||||
let targetPath
|
||||
let latest = null
|
||||
let systemType = ''
|
||||
if (context.packager.platform.nodeName === 'darwin') {
|
||||
targetPath = path.join(context.appOutDir, `${context.packager.appInfo.productName}.app/Contents/Resources`)
|
||||
latest = 'latest-mac.yml'
|
||||
systemType = 'mac'
|
||||
} else {
|
||||
targetPath = path.join(context.appOutDir, './resources')
|
||||
latest = 'latest.yml'
|
||||
systemType = 'win'
|
||||
}
|
||||
const zip = new AdmZip()
|
||||
zip.addLocalFolder(targetPath)
|
||||
const partUpdateFile = `update-${pkg.version}.zip`
|
||||
const partUpdateFile = `update-${systemType}-${pkg.version}.zip`
|
||||
zip.writeZip(path.join(context.outDir, partUpdateFile))
|
||||
|
||||
const partUpdateUrl = 'http://dev-sidecar.docmirror.cn/update/' + partUpdateFile
|
||||
|
||||
const latestFilePath = path.join(context.outDir, latest)
|
||||
fs.appendFile(latestFilePath, `\npartPackage: ${partUpdateUrl}\nreleaseNotes: \n - 升级日志`, (err) => {
|
||||
if (err) {
|
||||
console.log('修改latest 失败')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -0,0 +1,13 @@
|
||||
import path from 'path'
|
||||
// const isDevelopment = process.env.NODE_ENV !== 'production'
|
||||
export default {
|
||||
getAppRootPath () {
|
||||
// if (isDevelopment) {
|
||||
// return app.getAppPath()
|
||||
// } else {
|
||||
// return path.join(app.getAppPath(), '../../')
|
||||
// }
|
||||
|
||||
return path.resolve('.')
|
||||
}
|
||||
}
|
Loading…
Reference in new issue