Allow to pack dev releases

This commit is contained in:
Thomas Nordquist
2019-03-19 19:23:04 +01:00
parent aa8d066fe1
commit 8c23f1f27c

View File

@@ -75,7 +75,7 @@ async function executeBuild() {
await buildWithOptions(mac, { platform: 'mac', package: 'zip' }) await buildWithOptions(mac, { platform: 'mac', package: 'zip' })
break break
default: default:
throw new Error('No target selected') await buildWithOptions({ ...mac, projectDir: '' }, { platform: 'mac', package: 'mas-dev' })
} }
} }
@@ -88,7 +88,7 @@ type Packages = 'portable' | 'nsis' | 'appx' | 'AppImage' | 'snap' | 'dmg' | '
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(buildInfo.package) ensureAppNameForPackage(options, buildInfo.package)
await builder.build({ await builder.build({
...options, ...options,
@@ -97,8 +97,8 @@ async function buildWithOptions(options: builder.CliOptions, buildInfo: BuildInf
} }
// AppX must hav a different name since the store name is already taken (but not used) // AppX must hav a different name since the store name is already taken (but not used)
function ensureAppNameForPackage(packageOption: Packages) { function ensureAppNameForPackage(options: builder.CliOptions, packageOption: Packages) {
const jsonLocation = path.join('build', 'clean', 'package.json') const jsonLocation = path.join((options.projectDir as string), 'package.json')
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' packageJson.build.productName = packageOption === 'appx' ? 'MQTT-Explorer' : 'MQTT Explorer'
fs.writeFileSync(jsonLocation, JSON.stringify(packageJson, undefined, ' ')) fs.writeFileSync(jsonLocation, JSON.stringify(packageJson, undefined, ' '))