bump version to 1.8.2 and add support for candidate builds in Firefox source setup
Some checks are pending
CI / general (push) Waiting to run

This commit is contained in:
mr. M 2024-12-30 23:53:42 +01:00
parent 0b109c2dd4
commit c0d4dd8eef
No known key found for this signature in database
GPG key ID: CBD57A2AEDBDA1FB
5 changed files with 32 additions and 11 deletions

View file

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

View file

@ -20,7 +20,7 @@ import {
resolveAddonDownloadUrl,
unpackAddon,
} from './addon'
import { configPath } from '../../utils'
import { configPath, shouldUseCandidate } from '../../utils'
import fs from 'fs-extra'
export function shouldSetupFirefoxSource() {
@ -30,8 +30,8 @@ export function shouldSetupFirefoxSource() {
)
}
export async function setupFirefoxSource(version: string) {
const firefoxSourceTar = await downloadFirefoxSource(version)
export async function setupFirefoxSource(version: string, isCandidate = false) {
const firefoxSourceTar = await downloadFirefoxSource(version, isCandidate)
await unpackFirefoxSource(firefoxSourceTar)
@ -108,8 +108,12 @@ async function unpackFirefoxSource(name: string): Promise<void> {
log.info(`Unpacked Firefox source to ${ENGINE_DIR}`)
}
async function downloadFirefoxSource(version: string) {
const base = `https://archive.mozilla.org/pub/firefox/releases/${version}/source/`
async function downloadFirefoxSource(version: string, isCandidate = false) {
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/`;
}
const filename = `firefox-${version}.source.tar.xz`
const url = base + filename
@ -141,9 +145,11 @@ async function downloadFirefoxSource(version: string) {
export async function downloadInternals({
version,
force,
isCandidate = shouldUseCandidate()
}: {
version: string
force?: boolean
force?: boolean,
isCandidate?: boolean
}) {
// Provide a legible error if there is no version specified
if (!version) {
@ -153,6 +159,10 @@ export async function downloadInternals({
process.exit(1)
}
if (isCandidate) {
version = config.version.candidate as string;
}
if (force && existsSync(ENGINE_DIR)) {
log.info('Removing existing workspace')
rmSync(ENGINE_DIR, { recursive: true })
@ -168,7 +178,7 @@ export async function downloadInternals({
}
if (!existsSync(ENGINE_DIR)) {
await setupFirefoxSource(version)
await setupFirefoxSource(version, isCandidate)
}
for (const addon of getAddons()) {

View file

@ -297,15 +297,15 @@ function configureBrandingNsis(
!define HelpLink "https://github.com/zen-browser/desktop/issues"
; The OFFICIAL define is a workaround to support different urls for Release and
; Beta since they share the same branding when building with other branches that
; set the update channel to beta.
; Stable since they share the same branding when building with other branches that
; set the update channel to stable.
!define OFFICIAL
!define URLStubDownloadX86 "https://download.mozilla.org/?os=win&lang=\${AB_CD}&product=firefox-latest"
!define URLStubDownloadAMD64 "https://download.mozilla.org/?os=win64&lang=\${AB_CD}&product=firefox-latest"
!define URLStubDownloadAArch64 "https://download.mozilla.org/?os=win64-aarch64&lang=\${AB_CD}&product=firefox-latest"
!define URLManualDownload "https://zen-browser.app/download"
!define URLSystemRequirements "https://www.mozilla.org/firefox/system-requirements/"
!define Channel "release"
!define Channel "stable"
# The installer's certificate name and issuer expected by the stub installer
!define CertNameDownload "${brandingConfig.brandFullName}"

View file

@ -131,6 +131,10 @@ export interface Config {
* The version of the selected product you are forking
*/
version?: string
/*
* Release candidate version
*/
candidate?: string
}
buildOptions: {
windowsUseSymbolicLinks: boolean

View file

@ -4,6 +4,8 @@
import axios from 'axios'
import { log } from '../log'
import { SupportedProducts } from './config'
import { config } from '..'
import { dynamicConfig } from '.'
const firefoxTargets = JSON.parse(`{
"${SupportedProducts.Firefox}": "LATEST_FIREFOX_VERSION",
@ -13,6 +15,11 @@ const firefoxTargets = JSON.parse(`{
"${SupportedProducts.FirefoxNightly}": "FIREFOX_NIGHTLY"
}`)
export const shouldUseCandidate = (): boolean => {
const brandingKey = dynamicConfig.get('brand')
return brandingKey !== 'stable' && (config.version.version !== config.version.candidate);
}
export const getLatestFF = async (
product: SupportedProducts = SupportedProducts.Firefox
): Promise<string> => {