Use proper provisioning profile for OSX builds
This commit is contained in:
@@ -32,7 +32,6 @@
|
|||||||
"publish": [
|
"publish": [
|
||||||
"github"
|
"github"
|
||||||
],
|
],
|
||||||
"provisioningProfile": "res/MQTT_Explorer_Store_Distribution_Profile.provisionprofile",
|
|
||||||
"entitlements": "res/entitlements.mas.plist"
|
"entitlements": "res/entitlements.mas.plist"
|
||||||
},
|
},
|
||||||
"linux": {
|
"linux": {
|
||||||
@@ -91,6 +90,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"about-window": "^1.12.1",
|
"about-window": "^1.12.1",
|
||||||
|
"dot-prop": "^5.0.0",
|
||||||
"electron-log": "^2.2.17",
|
"electron-log": "^2.2.17",
|
||||||
"electron-telemetry": "git+https://github.com/thomasnordquist/electron-telemetry.git#dist",
|
"electron-telemetry": "git+https://github.com/thomasnordquist/electron-telemetry.git#dist",
|
||||||
"electron-updater": "^4.0.6",
|
"electron-updater": "^4.0.6",
|
||||||
|
|||||||
41
package.ts
41
package.ts
@@ -1,6 +1,7 @@
|
|||||||
import * as builder from 'electron-builder'
|
import * as builder from 'electron-builder'
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
|
import * as dotProp from 'dot-prop'
|
||||||
|
|
||||||
const linuxAppImage: builder.CliOptions = {
|
const linuxAppImage: builder.CliOptions = {
|
||||||
x64: true,
|
x64: true,
|
||||||
@@ -53,7 +54,7 @@ const mac: builder.CliOptions = {
|
|||||||
armv7l: false,
|
armv7l: false,
|
||||||
arm64: false,
|
arm64: false,
|
||||||
projectDir: './build/clean',
|
projectDir: './build/clean',
|
||||||
publish: 'always',
|
publish: 'never',
|
||||||
}
|
}
|
||||||
|
|
||||||
async function executeBuild() {
|
async function executeBuild() {
|
||||||
@@ -88,20 +89,36 @@ type Packages = 'portable' | 'nsis' | 'appx' | 'AppImage' | 'snap' | 'dmg' | 'zi
|
|||||||
|
|
||||||
async function buildWithOptions(options: builder.CliOptions, buildInfo: BuildInfo) {
|
async function buildWithOptions(options: builder.CliOptions, buildInfo: BuildInfo) {
|
||||||
fs.writeFileSync(path.join(options.projectDir!, 'buildOptions.json'), JSON.stringify(buildInfo))
|
fs.writeFileSync(path.join(options.projectDir!, 'buildOptions.json'), JSON.stringify(buildInfo))
|
||||||
ensureAppNameForPackage(options, buildInfo.package)
|
|
||||||
|
|
||||||
await builder.build({
|
|
||||||
...options,
|
|
||||||
[buildInfo.platform]: [buildInfo.package],
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// AppX must hav a different name since the store name is already taken (but not used)
|
|
||||||
function ensureAppNameForPackage(options: builder.CliOptions, packageOption: Packages) {
|
|
||||||
const jsonLocation = path.join((options.projectDir as string), 'package.json')
|
const jsonLocation = path.join((options.projectDir as string), 'package.json')
|
||||||
|
const packageJsonStr = fs.readFileSync(jsonLocation).toString()
|
||||||
|
|
||||||
const packageJson = JSON.parse(fs.readFileSync(jsonLocation).toString())
|
const packageJson = JSON.parse(fs.readFileSync(jsonLocation).toString())
|
||||||
packageJson.build.productName = packageOption === 'appx' ? 'MQTT-Explorer' : 'MQTT Explorer'
|
|
||||||
fs.writeFileSync(jsonLocation, JSON.stringify(packageJson, undefined, ' '))
|
// AppX must have a different name since the store name is already taken (but not used)
|
||||||
|
if (buildInfo.package === 'appx') {
|
||||||
|
dotProp.set(packageJson, 'build.productName', 'MQTT-Explorer')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buildInfo.platform === 'mac') {
|
||||||
|
console.log(buildInfo.package)
|
||||||
|
const provisioningProfile = (buildInfo.package === 'mas') ? 'res/MQTT_Explorer_Store_Distribution_Profile.provisionprofile' : 'res/MQTTExplorerdmg.provisionprofile'
|
||||||
|
dotProp.set(packageJson, 'build.mac.provisioningProfile', provisioningProfile)
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Write modified package.json
|
||||||
|
fs.writeFileSync(jsonLocation, JSON.stringify(packageJson))
|
||||||
|
await builder.build({
|
||||||
|
...options,
|
||||||
|
[buildInfo.platform]: [buildInfo.package],
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
throw error
|
||||||
|
} finally {
|
||||||
|
// Roll back changes to package.json
|
||||||
|
fs.writeFileSync(jsonLocation, packageJsonStr)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function build() {
|
function build() {
|
||||||
|
|||||||
BIN
res/MQTTExplorerdmg.provisionprofile
Normal file
BIN
res/MQTTExplorerdmg.provisionprofile
Normal file
Binary file not shown.
@@ -1131,6 +1131,13 @@ dot-prop@^4.1.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
is-obj "^1.0.0"
|
is-obj "^1.0.0"
|
||||||
|
|
||||||
|
dot-prop@^5.0.0:
|
||||||
|
version "5.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-5.0.0.tgz#64b7968af349c3a9f966aa12658dbd5829f6b953"
|
||||||
|
integrity sha512-RTmaF2jx3nOBO2GvtFqjnDLycjFUMqt+2pwRx7JVYa81lDauoj9aNkyrJI2ikR58FbBIchiIlRiGG+muLJ4oHQ==
|
||||||
|
dependencies:
|
||||||
|
is-obj "^1.0.0"
|
||||||
|
|
||||||
dotenv-expand@^4.2.0:
|
dotenv-expand@^4.2.0:
|
||||||
version "4.2.0"
|
version "4.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/dotenv-expand/-/dotenv-expand-4.2.0.tgz#def1f1ca5d6059d24a766e587942c21106ce1275"
|
resolved "https://registry.yarnpkg.com/dotenv-expand/-/dotenv-expand-4.2.0.tgz#def1f1ca5d6059d24a766e587942c21106ce1275"
|
||||||
|
|||||||
Reference in New Issue
Block a user