Add build info to each package
This commit is contained in:
41
package.ts
41
package.ts
@@ -1,6 +1,8 @@
|
|||||||
import * as builder from 'electron-builder'
|
import * as builder from 'electron-builder'
|
||||||
|
import * as fs from 'fs'
|
||||||
|
import * as path from 'path'
|
||||||
|
|
||||||
const linux: builder.CliOptions = {
|
const linuxAppImage: builder.CliOptions = {
|
||||||
x64: true,
|
x64: true,
|
||||||
ia32: true,
|
ia32: true,
|
||||||
armv7l: true,
|
armv7l: true,
|
||||||
@@ -20,12 +22,22 @@ const linuxSnap: builder.CliOptions = {
|
|||||||
publish: 'always',
|
publish: 'always',
|
||||||
}
|
}
|
||||||
|
|
||||||
const win: builder.CliOptions = {
|
const winPortable: builder.CliOptions = {
|
||||||
x64: true,
|
x64: true,
|
||||||
ia32: true,
|
ia32: true,
|
||||||
armv7l: false,
|
armv7l: false,
|
||||||
arm64: false,
|
arm64: false,
|
||||||
win: ['portable', 'nsis'],
|
win: ['portable'],
|
||||||
|
projectDir: './build/clean',
|
||||||
|
publish: 'always',
|
||||||
|
}
|
||||||
|
|
||||||
|
const winNsis: builder.CliOptions = {
|
||||||
|
x64: true,
|
||||||
|
ia32: true,
|
||||||
|
armv7l: false,
|
||||||
|
arm64: false,
|
||||||
|
win: ['nsis'],
|
||||||
projectDir: './build/clean',
|
projectDir: './build/clean',
|
||||||
publish: 'always',
|
publish: 'always',
|
||||||
}
|
}
|
||||||
@@ -53,29 +65,40 @@ const mac: builder.CliOptions = {
|
|||||||
async function executeBuild() {
|
async function executeBuild() {
|
||||||
switch (process.argv[2]) {
|
switch (process.argv[2]) {
|
||||||
case 'win':
|
case 'win':
|
||||||
await builder.build(win)
|
await buildWithOptions(winPortable, { platform: 'win', package: 'portable' })
|
||||||
|
await buildWithOptions(winNsis, { platform: 'win', package: 'nsis' })
|
||||||
break
|
break
|
||||||
case 'appx':
|
case 'appx':
|
||||||
await builder.build(winAppx)
|
await buildWithOptions(winAppx, { platform: 'win', package: 'appx' })
|
||||||
break
|
break
|
||||||
case 'linux':
|
case 'linux':
|
||||||
await builder.build(linux)
|
await buildWithOptions(linuxAppImage, { platform: 'linux', package: 'AppImage' })
|
||||||
break
|
break
|
||||||
case 'snap':
|
case 'snap':
|
||||||
try {
|
try {
|
||||||
await builder.build(linuxSnap)
|
await buildWithOptions(linuxSnap, { platform: 'linux', package: 'snap' })
|
||||||
} catch {
|
} catch {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 'mac':
|
case 'mac':
|
||||||
await builder.build(mac)
|
await buildWithOptions(mac, { platform: 'linux', package: 'dmg' })
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
await builder.build(mac)
|
await buildWithOptions(mac, { platform: 'linux', package: 'dmg' })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface BuildInfo {
|
||||||
|
platform: 'win' | 'linux' | 'mac'
|
||||||
|
package: 'portable' | 'nsis' | 'appx' | 'AppImage' | 'snap' | 'dmg' | 'zip' | 'mas'
|
||||||
|
}
|
||||||
|
|
||||||
|
async function buildWithOptions(options: builder.CliOptions, buildInfo: BuildInfo) {
|
||||||
|
fs.writeFileSync(path.join(options.projectDir!, 'buildOptions.json'), JSON.stringify(buildInfo))
|
||||||
|
await builder.build(options)
|
||||||
|
}
|
||||||
|
|
||||||
function build() {
|
function build() {
|
||||||
try {
|
try {
|
||||||
executeBuild()
|
executeBuild()
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import * as fs from 'fs-extra'
|
import * as fs from 'fs-extra'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
import { chdir } from 'process'
|
import { chdir } from 'process'
|
||||||
import { exec } from './util';
|
import { exec } from './util'
|
||||||
|
|
||||||
const targetDir = path.join('build', 'clean')
|
const targetDir = path.join('build', 'clean')
|
||||||
async function prepareRelease() {
|
async function prepareRelease() {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as fs from 'fs'
|
||||||
import * as log from 'electron-log'
|
import * as log from 'electron-log'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
import ConfigStorage from '../backend/src/ConfigStorage'
|
import ConfigStorage from '../backend/src/ConfigStorage'
|
||||||
@@ -7,10 +8,23 @@ import { ConnectionManager, updateNotifier } from '../backend/src/index'
|
|||||||
import { electronTelemetryFactory } from 'electron-telemetry'
|
import { electronTelemetryFactory } from 'electron-telemetry'
|
||||||
import { menuTemplate } from './MenuTemplate'
|
import { menuTemplate } from './MenuTemplate'
|
||||||
import { UpdateInfo } from '../events'
|
import { UpdateInfo } from '../events'
|
||||||
|
import { BuildInfo } from 'electron-telemetry/build/Model';
|
||||||
const isDev = require('electron-is-dev')
|
const isDev = require('electron-is-dev')
|
||||||
|
|
||||||
if (!isDev) {
|
if (!isDev) {
|
||||||
const electronTelemetry = electronTelemetryFactory('9b0c8ca04a361eb8160d98c5')
|
let buildOptions: BuildInfo = ({ platform: 'unknown', package: 'unknown' } as any)
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = JSON.parse(fs.readFileSync(path.join(__dirname, '..', '..', 'buildOptions.json')).toString())
|
||||||
|
if (typeof options.platform === 'string' && typeof options.package === 'string') {
|
||||||
|
buildOptions = options
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error)
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(buildOptions)
|
||||||
|
const electronTelemetry = electronTelemetryFactory('9b0c8ca04a361eb8160d98c5', buildOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
// const isDebugEnabled = Boolean(process.argv.find(arg => arg === 'debug'))
|
// const isDebugEnabled = Boolean(process.argv.find(arg => arg === 'debug'))
|
||||||
|
|||||||
@@ -1147,7 +1147,7 @@ electron-publish@20.38.5:
|
|||||||
|
|
||||||
"electron-telemetry@git+https://github.com/thomasnordquist/electron-telemetry.git#dist":
|
"electron-telemetry@git+https://github.com/thomasnordquist/electron-telemetry.git#dist":
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "git+https://github.com/thomasnordquist/electron-telemetry.git#24792a0d8d6c2b047855acfda7d740ee4e51b97f"
|
resolved "git+https://github.com/thomasnordquist/electron-telemetry.git#3d6c0c5e3fd9d8101dcb7a0435256572ed58b2b6"
|
||||||
dependencies:
|
dependencies:
|
||||||
axios "^0.18.0"
|
axios "^0.18.0"
|
||||||
pako "^1.0.8"
|
pako "^1.0.8"
|
||||||
|
|||||||
Reference in New Issue
Block a user