Update product name depending on package

This commit is contained in:
Thomas Nordquist
2019-03-07 10:23:26 +01:00
parent 94558b9a6f
commit 354a0cbf84

View File

@@ -81,11 +81,14 @@ async function executeBuild() {
export interface BuildInfo {
platform: 'win' | 'linux' | 'mac'
package: 'portable' | 'nsis' | 'appx' | 'AppImage' | 'snap' | 'dmg' | 'zip' | 'mas' | 'mas-dev'
package: Packages
}
type Packages = 'portable' | 'nsis' | 'appx' | 'AppImage' | 'snap' | 'dmg' | 'zip' | 'mas' | 'mas-dev'
async function buildWithOptions(options: builder.CliOptions, buildInfo: BuildInfo) {
fs.writeFileSync(path.join(options.projectDir!, 'buildOptions.json'), JSON.stringify(buildInfo))
ensureAppNameForPackage(buildInfo.package)
await builder.build({
...options,
@@ -93,6 +96,14 @@ async function buildWithOptions(options: builder.CliOptions, buildInfo: BuildInf
})
}
// AppX must hav a different name since the store name is already taken (but not used)
function ensureAppNameForPackage(packageOption: Packages) {
const jsonLocation = path.join('build', 'clean', 'package.json')
const packageJson = JSON.parse(fs.readFileSync(jsonLocation).toString())
packageJson.build.productName = packageOption === 'appx' ? 'MQTT-Explorer' : 'MQTT Explorer'
fs.writeFileSync(jsonLocation, JSON.stringify(packageJson, undefined, ' '))
}
function build() {
try {
executeBuild()