bump version to 1.9.14 and refactor code for consistency and readability
Some checks are pending
CI / general (push) Waiting to run

This commit is contained in:
mr. M 2025-01-27 23:31:47 +01:00
parent 073adf331b
commit 92c4d3eb49
No known key found for this signature in database
GPG key ID: CBD57A2AEDBDA1FB
6 changed files with 46 additions and 22 deletions

View file

@ -1,6 +1,6 @@
{
"name": "@zen-browser/surfer",
"version": "1.9.13",
"version": "1.9.14",
"description": "Simplifying building firefox forks!",
"main": "index.js",
"bin": {

View file

@ -20,7 +20,11 @@ import {
resolveAddonDownloadUrl,
unpackAddon,
} from './addon'
import { configPath, getFFVersionOrCandidate, shouldUseCandidate } from '../../utils'
import {
configPath,
getFFVersionOrCandidate,
shouldUseCandidate,
} from '../../utils'
import fs from 'fs-extra'
export function shouldSetupFirefoxSource() {
@ -109,10 +113,10 @@ async function unpackFirefoxSource(name: string): Promise<void> {
}
async function downloadFirefoxSource(version: string, isCandidate = false) {
let base = `https://archive.mozilla.org/pub/firefox/releases/${version}/source/`;
let base = `https://archive.mozilla.org/pub/firefox/releases/${version}/source/`
if (isCandidate) {
console.log('Using candidate build')
base = `https://archive.mozilla.org/pub/firefox/candidates/${version}-candidates/build1/source/`;
base = `https://archive.mozilla.org/pub/firefox/candidates/${version}-candidates/build1/source/`
}
const filename = `firefox-${version}.source.tar.xz`
@ -145,10 +149,10 @@ async function downloadFirefoxSource(version: string, isCandidate = false) {
export async function downloadInternals({
version,
force,
isCandidate = shouldUseCandidate()
isCandidate = shouldUseCandidate(),
}: {
version: string
force?: boolean,
force?: boolean
isCandidate?: boolean
}) {
// Provide a legible error if there is no version specified
@ -160,7 +164,7 @@ export async function downloadInternals({
}
if (isCandidate) {
version = config.version.candidate as string;
version = config.version.candidate as string
}
if (force && existsSync(ENGINE_DIR)) {

View file

@ -184,7 +184,14 @@ async function createMarFile(
// the contents of the folder <obj dir>/dist/${binaryName}
const binary =
(process as any).surferPlatform == 'darwin'
? join(OBJ_DIR, 'dist', config.binaryName, `${getCurrentBrandName()}.app`)
? process.env.JUST_MAR
? join(OBJ_DIR, 'dist', `${getCurrentBrandName()}.app`)
: join(
OBJ_DIR,
'dist',
config.binaryName,
`${getCurrentBrandName()}.app`
)
: join(OBJ_DIR, 'dist', config.binaryName)
const marPath = resolve(DIST_DIR, 'output.mar')

View file

@ -35,7 +35,7 @@ const ausPlatformsMap = {
],
macosArm: ['Darwin_aarch64-gcc3'],
win64: ['WINNT_x86_64-msvc', 'WINNT_x86_64-msvc-x64'],
winArm: ['WINNT_aarch64-msvc-aarch64']
winArm: ['WINNT_aarch64-msvc-aarch64'],
}
export async function getPlatformConfig() {
@ -48,13 +48,11 @@ export async function getPlatformConfig() {
}
function getReleaseMarName(releaseInfo: ReleaseInfo): string | undefined {
let releaseMarName;
let releaseMarName
if ((process as any).surferPlatform == 'win32') {
if (compatMode == 'x86_64') {
releaseMarName = 'windows.mar'
}
else if (compatMode == 'aarch64') {
} else if (compatMode == 'aarch64') {
releaseMarName = 'windows-arm64.mar'
}
}
@ -64,8 +62,7 @@ function getReleaseMarName(releaseInfo: ReleaseInfo): string | undefined {
if ((process as any).surferPlatform == 'linux') {
if (compatMode == 'x86_64') {
releaseMarName = 'linux.mar'
}
else if (compatMode == 'aarch64') {
} else if (compatMode == 'aarch64') {
releaseMarName = 'linux-aarch64.mar'
}
}
@ -126,18 +123,24 @@ async function writeUpdateFileToDisk(
function getTargets(): string[] {
if ((process as any).surferPlatform == 'win32') {
return compatMode == 'aarch64' ? ausPlatformsMap.winArm : ausPlatformsMap.win64;
return compatMode == 'aarch64'
? ausPlatformsMap.winArm
: ausPlatformsMap.win64
}
if ((process as any).surferPlatform == 'linux') {
return compatMode == 'aarch64' ? ausPlatformsMap.linuxArm : ausPlatformsMap.linux64;
return compatMode == 'aarch64'
? ausPlatformsMap.linuxArm
: ausPlatformsMap.linux64
}
if ((process as any).surferPlatform == 'darwin') {
return compatMode == 'aarch64' ? ausPlatformsMap.macosArm : ausPlatformsMap.macosIntel;
return compatMode == 'aarch64'
? ausPlatformsMap.macosArm
: ausPlatformsMap.macosIntel
}
log.error('Unknown platform')
return [];
return []
}
export async function generateBrowserUpdateFiles() {

View file

@ -16,7 +16,12 @@ import commander, { Command } from 'commander'
import { existsSync, readFileSync } from 'node:fs'
import { resolve } from 'node:path'
import { errorHandler, config as configInited, versionFormatter, getFFVersionOrCandidate } 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'

View file

@ -17,11 +17,16 @@ const firefoxTargets = JSON.parse(`{
export const shouldUseCandidate = (): boolean => {
const brandingKey = dynamicConfig.get('brand')
return brandingKey !== 'release' && (config.version.version !== config.version.candidate);
return (
brandingKey !== 'release' &&
config.version.version !== config.version.candidate
)
}
export const getFFVersionOrCandidate = () => {
return shouldUseCandidate() ? config.version.candidate : config.version.version
return shouldUseCandidate()
? config.version.candidate
: config.version.version
}
export const getLatestFF = async (