diff --git a/package.json b/package.json index b8bbd40..2958ae2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@zen-browser/surfer", - "version": "1.8.3", + "version": "1.8.5", "description": "Simplifying building firefox forks!", "main": "index.js", "bin": { diff --git a/src/commands/download/firefox.ts b/src/commands/download/firefox.ts index be34e70..8d56589 100644 --- a/src/commands/download/firefox.ts +++ b/src/commands/download/firefox.ts @@ -20,7 +20,7 @@ import { resolveAddonDownloadUrl, unpackAddon, } from './addon' -import { configPath, shouldUseCandidate } from '../../utils' +import { configPath, getFFVersionOrCandidate, shouldUseCandidate } from '../../utils' import fs from 'fs-extra' export function shouldSetupFirefoxSource() { @@ -81,7 +81,7 @@ async function unpackFirefoxSource(name: string): Promise { ]) const archiveDir = resolve( MELON_TMP_DIR, - 'firefox-' + config.version.version + 'firefox-' + getFFVersionOrCandidate() ) if (existsSync(ENGINE_DIR)) { // remove the existing engine directory diff --git a/src/commands/updates/browser.ts b/src/commands/updates/browser.ts index 2683b64..0fe8e96 100644 --- a/src/commands/updates/browser.ts +++ b/src/commands/updates/browser.ts @@ -10,6 +10,7 @@ import { dynamicConfig, ensureEmpty, generateHash, + getFFVersionOrCandidate, getSize, ReleaseInfo, } from '../../utils' @@ -186,7 +187,7 @@ export async function generateBrowserUpdateFiles() { '@type': 'minor', '@displayVersion': version, '@appVersion': version, - '@platformVersion': config.version.version, + '@platformVersion': getFFVersionOrCandidate(), '@buildID': platform.Build.BuildID, patch: { diff --git a/src/constants/mozconfig.ts b/src/constants/mozconfig.ts index 4593636..7aee049 100644 --- a/src/constants/mozconfig.ts +++ b/src/constants/mozconfig.ts @@ -1,4 +1,5 @@ import { config } from '..' +import { getFFVersionOrCandidate } from '../utils' const otherBuildModes = `# You can change to other build modes by running: # $ surfer set buildMode [dev|debug|release]` @@ -48,7 +49,7 @@ ac_add_options --with-branding=browser/branding/${brand} ac_add_options --enable-unverified-updates ac_add_options --enable-update-channel=${brand} -export ZEN_FIREFOX_VERSION=${config.version.version} +export ZEN_FIREFOX_VERSION=${getFFVersionOrCandidate()} export MOZ_APPUPDATE_HOST=${ config.updateHostname || 'localhost:7648 # This should not resolve' } diff --git a/src/index.ts b/src/index.ts index 0fcddd5..92218d2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -16,7 +16,7 @@ import commander, { Command } from 'commander' import { existsSync, readFileSync } from 'node:fs' import { resolve } from 'node:path' -import { errorHandler, config as configInited, versionFormatter } from './utils' +import { errorHandler, config as configInited, versionFormatter, getFFVersionOrCandidate } from './utils' import { commands } from './cmds' import { BIN_NAME, ENGINE_DIR } from './constants' import { updateCheck } from './middleware/update-check' @@ -41,7 +41,7 @@ if (existsSync(resolve(ENGINE_DIR, 'browser', 'config', 'version.txt'))) { .toString() .replace(/\n/g, '') - if (version !== config.version.version) reportedFFVersion = version + if (version !== getFFVersionOrCandidate()) reportedFFVersion = version } export const bin_name = BIN_NAME diff --git a/src/utils/version.ts b/src/utils/version.ts index 33e09d8..21506c1 100644 --- a/src/utils/version.ts +++ b/src/utils/version.ts @@ -20,6 +20,10 @@ export const shouldUseCandidate = (): boolean => { return brandingKey !== 'stable' && (config.version.version !== config.version.candidate); } +export const getFFVersionOrCandidate = () => { + return shouldUseCandidate() ? config.version.candidate : config.version.version +} + export const getLatestFF = async ( product: SupportedProducts = SupportedProducts.Firefox ): Promise => {