mirror of
https://github.com/zen-browser/surfer.git
synced 2025-07-08 01:10:03 +02:00
chore: Update process.platform to use surferPlatform
This commit is contained in:
parent
af40c2e3e3
commit
795991d1dc
12 changed files with 20 additions and 27 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@zen-browser/surfer",
|
||||
"version": "1.0.5",
|
||||
"version": "1.0.6",
|
||||
"description": "Simplifying building firefox forks!",
|
||||
"main": "index.js",
|
||||
"bin": {
|
||||
|
|
|
@ -163,7 +163,7 @@ export const build = async (options: Options): Promise<void> => {
|
|||
|
||||
// Host build
|
||||
|
||||
const prettyHost = platform[process.platform]
|
||||
const prettyHost = platform[process.surferPlatform]
|
||||
|
||||
if (BUILD_TARGETS.includes(prettyHost)) {
|
||||
if (!options.skipPatchCheck) await patchCheck()
|
||||
|
|
|
@ -53,7 +53,7 @@ async function unpackFirefoxSource(name: string): Promise<void> {
|
|||
//
|
||||
// If BSD tar adds --transform support in the future, we can use that
|
||||
// instead
|
||||
if (process.platform == 'darwin') {
|
||||
if (process.surferPlatform == 'darwin') {
|
||||
// GNU Tar doesn't come preinstalled on any MacOS machines, so we need to
|
||||
// check for it and ask for the user to install it if necessary
|
||||
if (!commandExistsSync('gtar')) {
|
||||
|
@ -69,7 +69,7 @@ async function unpackFirefoxSource(name: string): Promise<void> {
|
|||
tarExec,
|
||||
[
|
||||
'--strip-components=1',
|
||||
process.platform == 'win32' ? '--force-local' : undefined,
|
||||
process.surferPlatform == 'win32' ? '--force-local' : undefined,
|
||||
'-xf',
|
||||
windowsPathToUnix(resolve(MELON_TMP_DIR, name)),
|
||||
'-C',
|
||||
|
|
|
@ -69,7 +69,7 @@ export const surferPackage = async () => {
|
|||
|
||||
// Windows has some special dist files that are available within the dist
|
||||
// directory.
|
||||
if (process.platform == 'win32') {
|
||||
if (process.surferPlatform == 'win32') {
|
||||
const installerDistributionDirectory = join(
|
||||
OBJ_DIR,
|
||||
'dist',
|
||||
|
@ -143,7 +143,7 @@ async function createMarFile(version: string, channel: string) {
|
|||
join(OBJ_DIR, 'dist/host/bin', 'mar')
|
||||
)
|
||||
|
||||
if (process.platform == 'win32') {
|
||||
if (process.surferPlatform == 'win32') {
|
||||
marBinary += '.exe'
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ async function createMarFile(version: string, channel: string) {
|
|||
// <obj dir>/dist/${binaryName}/${brandFullName}.app and on everything else,
|
||||
// the contents of the folder <obj dir>/dist/${binaryName}
|
||||
const binary =
|
||||
process.platform == 'darwin'
|
||||
process.surferPlatform == 'darwin'
|
||||
? join(OBJ_DIR, 'dist', config.binaryName, `${getCurrentBrandName()}.app`)
|
||||
: join(OBJ_DIR, 'dist', config.binaryName)
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ async function setupImages(configPath: string, outputPath: string) {
|
|||
)
|
||||
|
||||
// TODO: Custom MacOS icon support
|
||||
if (process.platform == 'darwin') {
|
||||
if (process.surferPlatform == 'darwin') {
|
||||
log.debug('Generating Mac Icons')
|
||||
const temporary = join(MELON_TMP_DIR, 'macos_icon_info.iconset')
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ export const copyManual = async (name: string): Promise<void> => {
|
|||
}
|
||||
|
||||
if (
|
||||
process.platform == 'win32' &&
|
||||
process.surferPlatform == 'win32' &&
|
||||
!config.buildOptions.windowsUseSymbolicLinks
|
||||
) {
|
||||
// Make the directory if it doesn't already exist.
|
||||
|
|
|
@ -52,7 +52,7 @@ function getReleaseMarName(releaseInfo: ReleaseInfo): string | undefined {
|
|||
return
|
||||
}
|
||||
|
||||
switch (process.platform) {
|
||||
switch (process.surferPlatform) {
|
||||
case 'win32': {
|
||||
return releaseInfo.x86?.windowsMar
|
||||
}
|
||||
|
@ -113,11 +113,11 @@ async function writeUpdateFileToDisk(
|
|||
}
|
||||
|
||||
function getTargets(): string[] {
|
||||
if (process.platform == 'win32') {
|
||||
if (process.surferPlatform == 'win32') {
|
||||
return ausPlatformsMap.win64
|
||||
}
|
||||
|
||||
if (process.platform == 'linux') {
|
||||
if (process.surferPlatform == 'linux') {
|
||||
return ausPlatformsMap.linux64
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ export const FTL_STRING_LINE_REGEX =
|
|||
export let BASH_PATH: string | undefined
|
||||
|
||||
// All windows specific code should be located inside of this if statement
|
||||
if ((process as any).surferOriginalPlatform == 'win32') {
|
||||
if ((process as any).platform == 'win32') {
|
||||
const gitPath = execa.sync('where.exe git.exe').stdout.toString()
|
||||
|
||||
if (gitPath.includes('git.exe')) {
|
||||
|
|
|
@ -59,9 +59,9 @@ export MOZ_APPUPDATE_HOST=${
|
|||
}
|
||||
|
||||
function getPlatformOptimiseFlags(): string {
|
||||
let optimiseFlags = `# Unknown platform ${process.platform}`
|
||||
let optimiseFlags = `# Unknown platform ${process.surferPlatform}`
|
||||
|
||||
switch (process.platform) {
|
||||
switch (process.surferPlatform) {
|
||||
case 'linux': {
|
||||
optimiseFlags = `ac_add_options --enable-optimize="-O3 -march=haswell -mtune=haswell -w"`
|
||||
break
|
||||
|
|
13
src/index.ts
13
src/index.ts
|
@ -1,20 +1,13 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
Object.defineProperty(process, 'surferOriginalPlatform', {
|
||||
value: process.platform,
|
||||
writable: false,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
});
|
||||
|
||||
function getPlatform() {
|
||||
if (process.env.SURFER_PLATFORM) {
|
||||
return process.env.SURFER_PLATFORM;
|
||||
}
|
||||
return (process as any).surferOriginalPlatform;
|
||||
return process.platform;
|
||||
}
|
||||
|
||||
Object.defineProperty(process, 'platform', { value: getPlatform() });
|
||||
Object.defineProperty(process, 'surferPlatform', { value: getPlatform() });
|
||||
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
|
@ -96,7 +89,7 @@ for (const command of commands) {
|
|||
if (
|
||||
command.flags &&
|
||||
command.flags.platforms &&
|
||||
!command.flags.platforms.includes(process.platform)
|
||||
!command.flags.platforms.includes(process.surferPlatform)
|
||||
) {
|
||||
continue
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ import { execSync } from 'node:child_process'
|
|||
import { accessSync, constants } from 'node:fs'
|
||||
import path from 'node:path'
|
||||
|
||||
const onWindows = (process as any).surferOriginalPlatform == 'win32'
|
||||
const onWindows = (process as any).platform == 'win32'
|
||||
|
||||
const fileNotExistsSync = (commandName: string): boolean => {
|
||||
try {
|
||||
|
|
|
@ -22,7 +22,7 @@ import { log } from '../log'
|
|||
* @returns A unix path
|
||||
*/
|
||||
export const windowsPathToUnix = (path: string): string =>
|
||||
(process as any).surferOriginalPlatform == 'win32' ? path.replace(/\\/g, '/') : path
|
||||
(process as any).platform == 'win32' ? path.replace(/\\/g, '/') : path
|
||||
|
||||
export async function walkDirectory(directory: string): Promise<string[]> {
|
||||
const output = []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue