mirror of
https://github.com/zen-browser/surfer.git
synced 2025-07-08 01:10:03 +02:00
bump version to 1.9.14 and refactor code for consistency and readability
Some checks are pending
CI / general (push) Waiting to run
Some checks are pending
CI / general (push) Waiting to run
This commit is contained in:
parent
073adf331b
commit
92c4d3eb49
6 changed files with 46 additions and 22 deletions
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@zen-browser/surfer",
|
"name": "@zen-browser/surfer",
|
||||||
"version": "1.9.13",
|
"version": "1.9.14",
|
||||||
"description": "Simplifying building firefox forks!",
|
"description": "Simplifying building firefox forks!",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|
|
@ -20,7 +20,11 @@ import {
|
||||||
resolveAddonDownloadUrl,
|
resolveAddonDownloadUrl,
|
||||||
unpackAddon,
|
unpackAddon,
|
||||||
} from './addon'
|
} from './addon'
|
||||||
import { configPath, getFFVersionOrCandidate, shouldUseCandidate } from '../../utils'
|
import {
|
||||||
|
configPath,
|
||||||
|
getFFVersionOrCandidate,
|
||||||
|
shouldUseCandidate,
|
||||||
|
} from '../../utils'
|
||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
|
|
||||||
export function shouldSetupFirefoxSource() {
|
export function shouldSetupFirefoxSource() {
|
||||||
|
@ -109,10 +113,10 @@ async function unpackFirefoxSource(name: string): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function downloadFirefoxSource(version: string, isCandidate = false) {
|
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) {
|
if (isCandidate) {
|
||||||
console.log('Using candidate build')
|
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`
|
const filename = `firefox-${version}.source.tar.xz`
|
||||||
|
|
||||||
|
@ -145,10 +149,10 @@ async function downloadFirefoxSource(version: string, isCandidate = false) {
|
||||||
export async function downloadInternals({
|
export async function downloadInternals({
|
||||||
version,
|
version,
|
||||||
force,
|
force,
|
||||||
isCandidate = shouldUseCandidate()
|
isCandidate = shouldUseCandidate(),
|
||||||
}: {
|
}: {
|
||||||
version: string
|
version: string
|
||||||
force?: boolean,
|
force?: boolean
|
||||||
isCandidate?: boolean
|
isCandidate?: boolean
|
||||||
}) {
|
}) {
|
||||||
// Provide a legible error if there is no version specified
|
// Provide a legible error if there is no version specified
|
||||||
|
@ -160,7 +164,7 @@ export async function downloadInternals({
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isCandidate) {
|
if (isCandidate) {
|
||||||
version = config.version.candidate as string;
|
version = config.version.candidate as string
|
||||||
}
|
}
|
||||||
|
|
||||||
if (force && existsSync(ENGINE_DIR)) {
|
if (force && existsSync(ENGINE_DIR)) {
|
||||||
|
|
|
@ -184,7 +184,14 @@ async function createMarFile(
|
||||||
// the contents of the folder <obj dir>/dist/${binaryName}
|
// the contents of the folder <obj dir>/dist/${binaryName}
|
||||||
const binary =
|
const binary =
|
||||||
(process as any).surferPlatform == 'darwin'
|
(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)
|
: join(OBJ_DIR, 'dist', config.binaryName)
|
||||||
|
|
||||||
const marPath = resolve(DIST_DIR, 'output.mar')
|
const marPath = resolve(DIST_DIR, 'output.mar')
|
||||||
|
|
|
@ -35,7 +35,7 @@ const ausPlatformsMap = {
|
||||||
],
|
],
|
||||||
macosArm: ['Darwin_aarch64-gcc3'],
|
macosArm: ['Darwin_aarch64-gcc3'],
|
||||||
win64: ['WINNT_x86_64-msvc', 'WINNT_x86_64-msvc-x64'],
|
win64: ['WINNT_x86_64-msvc', 'WINNT_x86_64-msvc-x64'],
|
||||||
winArm: ['WINNT_aarch64-msvc-aarch64']
|
winArm: ['WINNT_aarch64-msvc-aarch64'],
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getPlatformConfig() {
|
export async function getPlatformConfig() {
|
||||||
|
@ -48,13 +48,11 @@ export async function getPlatformConfig() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getReleaseMarName(releaseInfo: ReleaseInfo): string | undefined {
|
function getReleaseMarName(releaseInfo: ReleaseInfo): string | undefined {
|
||||||
|
let releaseMarName
|
||||||
let releaseMarName;
|
|
||||||
if ((process as any).surferPlatform == 'win32') {
|
if ((process as any).surferPlatform == 'win32') {
|
||||||
if (compatMode == 'x86_64') {
|
if (compatMode == 'x86_64') {
|
||||||
releaseMarName = 'windows.mar'
|
releaseMarName = 'windows.mar'
|
||||||
}
|
} else if (compatMode == 'aarch64') {
|
||||||
else if (compatMode == 'aarch64') {
|
|
||||||
releaseMarName = 'windows-arm64.mar'
|
releaseMarName = 'windows-arm64.mar'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,8 +62,7 @@ function getReleaseMarName(releaseInfo: ReleaseInfo): string | undefined {
|
||||||
if ((process as any).surferPlatform == 'linux') {
|
if ((process as any).surferPlatform == 'linux') {
|
||||||
if (compatMode == 'x86_64') {
|
if (compatMode == 'x86_64') {
|
||||||
releaseMarName = 'linux.mar'
|
releaseMarName = 'linux.mar'
|
||||||
}
|
} else if (compatMode == 'aarch64') {
|
||||||
else if (compatMode == 'aarch64') {
|
|
||||||
releaseMarName = 'linux-aarch64.mar'
|
releaseMarName = 'linux-aarch64.mar'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,18 +123,24 @@ async function writeUpdateFileToDisk(
|
||||||
|
|
||||||
function getTargets(): string[] {
|
function getTargets(): string[] {
|
||||||
if ((process as any).surferPlatform == 'win32') {
|
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') {
|
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') {
|
if ((process as any).surferPlatform == 'darwin') {
|
||||||
return compatMode == 'aarch64' ? ausPlatformsMap.macosArm : ausPlatformsMap.macosIntel;
|
return compatMode == 'aarch64'
|
||||||
|
? ausPlatformsMap.macosArm
|
||||||
|
: ausPlatformsMap.macosIntel
|
||||||
}
|
}
|
||||||
log.error('Unknown platform')
|
log.error('Unknown platform')
|
||||||
return [];
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function generateBrowserUpdateFiles() {
|
export async function generateBrowserUpdateFiles() {
|
||||||
|
|
|
@ -16,7 +16,12 @@ import commander, { Command } from 'commander'
|
||||||
import { existsSync, readFileSync } from 'node:fs'
|
import { existsSync, readFileSync } from 'node:fs'
|
||||||
import { resolve } from 'node:path'
|
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 { commands } from './cmds'
|
||||||
import { BIN_NAME, ENGINE_DIR } from './constants'
|
import { BIN_NAME, ENGINE_DIR } from './constants'
|
||||||
import { updateCheck } from './middleware/update-check'
|
import { updateCheck } from './middleware/update-check'
|
||||||
|
|
|
@ -17,11 +17,16 @@ const firefoxTargets = JSON.parse(`{
|
||||||
|
|
||||||
export const shouldUseCandidate = (): boolean => {
|
export const shouldUseCandidate = (): boolean => {
|
||||||
const brandingKey = dynamicConfig.get('brand')
|
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 = () => {
|
export const getFFVersionOrCandidate = () => {
|
||||||
return shouldUseCandidate() ? config.version.candidate : config.version.version
|
return shouldUseCandidate()
|
||||||
|
? config.version.candidate
|
||||||
|
: config.version.version
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getLatestFF = async (
|
export const getLatestFF = async (
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue