🐛 Fix branding crash

This commit is contained in:
trickypr 2022-07-14 13:21:58 +10:00
parent 3f1d1ea255
commit 3ab25b85cd
2 changed files with 18 additions and 14 deletions

View file

@ -9,7 +9,12 @@ import { BUILD_TARGETS, CONFIGS_DIR, ENGINE_DIR } from '../constants'
import { internalMozconfg } from '../constants/mozconfig'
import { log } from '../log'
import { patchCheck } from '../middleware/patch-check'
import { configDispatch, dynamicConfig, stringTemplate } from '../utils'
import {
BrandInfo,
configDispatch,
dynamicConfig,
stringTemplate,
} from '../utils'
const platform: Record<string, string> = {
win32: 'windows',
@ -30,7 +35,7 @@ const applyConfig = async (os: string) => {
changeset = stdout.trim()
} catch (e) {
log.warning(
'Melon expects that you are building your browser with git as your version control'
'Gluon expects that you are building your browser with git as your version control'
)
log.warning(
'If you are using some other version control system, please migrate to git'
@ -96,8 +101,8 @@ const applyConfig = async (os: string) => {
// We need to install the browser display version inside of browser/config/version.txt
// and browser/config/version_display.txt
const brandingConfig = config.brands[brandingKey]
const version = brandingConfig.release.displayVersion || '1.0.0'
const brandingConfig: BrandInfo | undefined = config.brands[brandingKey]
const version = brandingConfig?.release?.displayVersion || '1.0.0'
log.debug(`Writing ${version} to the browser version files`)
writeFileSync(join(ENGINE_DIR, 'browser/config/version.txt'), version)

View file

@ -69,6 +69,14 @@ export interface ReleaseInfo {
}
}
export interface BrandInfo {
backgroundColor: string
brandShorterName: string
brandShortName: string
brandFullName: string
release: ReleaseInfo
}
export interface GithubAddonInfo {
platform: 'github'
id: string
@ -136,16 +144,7 @@ export interface Config {
windowsUseSymbolicLinks: boolean
}
addons: Record<string, AddonInfo>
brands: Record<
string,
{
backgroundColor: string
brandShorterName: string
brandShortName: string
brandFullName: string
release: ReleaseInfo
}
>
brands: Record<string, BrandInfo>
}
export const defaultBrandsConfig = {