Browse Source

1

pull/88/head
xiaojunnuo 3 years ago
parent
commit
120d149c86
  1. 1
      packages/gui/.env
  2. 1
      packages/gui/pkg/after-all-artifact-build.js
  3. 7
      packages/gui/pkg/after-pack-content.js
  4. 17
      packages/gui/pkg/after-pack.js
  5. 7
      packages/gui/vue.config.js

1
packages/gui/.env

@ -1 +1,2 @@
VUE_APP_PUBLISH_URL=http://dev-sidecar.docmirror.cn/update/
VUE_APP_PUBLISH_PROVIDER=generic

1
packages/gui/pkg/after-all-artifact-build.js

@ -15,6 +15,7 @@ function appendIntro (context, systemType, latest) {
})
}
exports.default = async function (context) {
console.log('after-all-artifact-build', context)
appendIntro(context, 'mac', 'latest-mac.yml')
appendIntro(context, 'win', 'latest.yml')
appendIntro(context, 'linux', 'latest-linux.yml')

7
packages/gui/pkg/after-pack-content.js

@ -1,7 +0,0 @@
const fs = require('fs')
exports.default = async function (context) {
// console.log('context', context)
if (context.packager.platform.nodeName === 'linux') {
fs.copyFileSync('../build/app-update.yml', '../dist_electron/linux_unpacked/resources/app-update.yml')
}
}

17
packages/gui/pkg/after-pack.js

@ -1,6 +1,22 @@
const path = require('path')
const AdmZip = require('adm-zip')
const pkg = require('../package.json')
const fs = require('fs')
function writeAppUpdateYmlForLinux () {
const publishUrl = process.env.VUE_APP_PUBLISH_URL
const publishProvider = process.env.VUE_APP_PUBLISH_PROVIDER
// provider: generic
// url: 'http://dev-sidecar.docmirror.cn/update/preview/'
// updaterCacheDirName: '@docmirrordev-sidecar-gui-updater'
const fileContent = `provider: ${publishProvider}
url: '${publishUrl}'
updaterCacheDirName: '@docmirrordev-sidecar-gui-updater'
`
console.log('write linux app-update.yml,updateUrl:', publishUrl)
const filePath = path.resolve('./dist_electron/linux-unpacked/resources/app-update.yml')
fs.writeFileSync(filePath, fileContent)
}
exports.default = async function (context) {
// console.log('context', context)
let targetPath
@ -11,6 +27,7 @@ exports.default = async function (context) {
} else if (context.packager.platform.nodeName === 'linux') {
targetPath = path.join(context.appOutDir, './resources')
systemType = 'linux'
writeAppUpdateYmlForLinux()
} else {
targetPath = path.join(context.appOutDir, './resources')
systemType = 'win'

7
packages/gui/vue.config.js

@ -1,6 +1,7 @@
const path = require('path')
const webpack = require('webpack')
const publishUrl = process.env.VUE_APP_PUBLISH_URL
const publishProvider = process.env.VUE_APP_PUBLISH_PROVIDER
console.log('publish url', publishUrl)
module.exports = {
pages: {
@ -38,7 +39,7 @@ module.exports = {
builderOptions: {
afterPack: './pkg/after-pack.js',
afterAllArtifactBuild: './pkg/after-all-artifact-build.js',
afterPackContent: './pkg/after-pack-content.js',
// artifactBuildCompleted: './pkg/artifact-build-completed.js',
// builderOptions: {
// publish: ['github']// 此处写入github 就好,不用添加其他内容
// },
@ -68,12 +69,12 @@ module.exports = {
linux: {
icon: 'build/mac/',
target: [
'deb',
// 'deb',
'AppImage'
]
},
publish: {
provider: 'generic',
provider: publishProvider,
url: publishUrl
// url: 'http://dev-sidecar.docmirror.cn/update/preview/'
}

Loading…
Cancel
Save