From 97d630b78f0ab2c02bd705034a68a356d2782150 Mon Sep 17 00:00:00 2001 From: mauro-balades Date: Mon, 30 Sep 2024 22:41:59 +0200 Subject: [PATCH] Refactor code formatting and fix paths --- .github/workflows/ci.yml | 1 - package.json | 2 +- src/commands/build.ts | 4 +- src/commands/download/firefox.ts | 27 +++-- src/commands/package.ts | 128 ++++++++++++++++------- src/commands/patches/branding-patch.ts | 134 +++++++++++++++---------- src/commands/updates/browser.ts | 24 +++-- src/constants/index.ts | 6 +- src/index.ts | 8 +- src/types.d.ts | 2 +- src/utils/config.ts | 12 +-- src/utils/fs.ts | 7 +- surfer.json | 2 +- 13 files changed, 233 insertions(+), 124 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3dca02a..4c6134d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,4 +24,3 @@ jobs: - name: Test run: npm test - diff --git a/package.json b/package.json index 7d42f51..59a38d0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@zen-browser/surfer", - "version": "1.4.21", + "version": "1.4.22", "description": "Simplifying building firefox forks!", "main": "index.js", "bin": { diff --git a/src/commands/build.ts b/src/commands/build.ts index 5b666d5..7e7d80d 100644 --- a/src/commands/build.ts +++ b/src/commands/build.ts @@ -173,7 +173,7 @@ export const build = async (options: Options): Promise => { log.info('Starting build...') - let exit = await genericBuild(prettyHost, options.ui); - process.exit(exit ? 0 : 1); + let exit = await genericBuild(prettyHost, options.ui) + process.exit(exit ? 0 : 1) } } diff --git a/src/commands/download/firefox.ts b/src/commands/download/firefox.ts index fc9ce87..fdc4de6 100644 --- a/src/commands/download/firefox.ts +++ b/src/commands/download/firefox.ts @@ -20,7 +20,7 @@ import { resolveAddonDownloadUrl, unpackAddon, } from './addon' -import { configPath } from '../../utils'; +import { configPath } from '../../utils' import fs from 'fs-extra' export function shouldSetupFirefoxSource() { @@ -68,16 +68,27 @@ async function unpackFirefoxSource(name: string): Promise { log.info(`Unpacking ${resolve(MELON_TMP_DIR, name)} to ${ENGINE_DIR}`) if (process.platform === 'win32') { log.info('Unpacking Firefox source on Windows (7z)') - await execa('7z', ['x', resolve(MELON_TMP_DIR, name), '-o' + resolve(MELON_TMP_DIR, name.replace('.tar.xz', '.tar'))]); + await execa('7z', [ + 'x', + resolve(MELON_TMP_DIR, name), + '-o' + resolve(MELON_TMP_DIR, name.replace('.tar.xz', '.tar')), + ]) log.info('Unpacking Firefox source again without the .xz extension') - await execa('7z', ['x', resolve(MELON_TMP_DIR, name.replace('.tar.xz', '.tar')), '-o' + MELON_TMP_DIR]); - const archiveDir = resolve(MELON_TMP_DIR, 'firefox-' + config.version.version); + await execa('7z', [ + 'x', + resolve(MELON_TMP_DIR, name.replace('.tar.xz', '.tar')), + '-o' + MELON_TMP_DIR, + ]) + const archiveDir = resolve( + MELON_TMP_DIR, + 'firefox-' + config.version.version + ) if (existsSync(ENGINE_DIR)) { // remove the existing engine directory - fs.removeSync(ENGINE_DIR); + fs.removeSync(ENGINE_DIR) } - log.info('Moving Firefox source to engine directory'); - fs.moveSync(archiveDir, ENGINE_DIR); + log.info('Moving Firefox source to engine directory') + fs.moveSync(archiveDir, ENGINE_DIR) return } @@ -91,7 +102,7 @@ async function unpackFirefoxSource(name: string): Promise { ENGINE_DIR, ].filter(Boolean) as string[], { - shell: BASH_PATH + shell: BASH_PATH, } ) log.info(`Unpacked Firefox source to ${ENGINE_DIR}`) diff --git a/src/commands/package.ts b/src/commands/package.ts index bb36414..c54b25a 100644 --- a/src/commands/package.ts +++ b/src/commands/package.ts @@ -22,9 +22,9 @@ const machPath = resolve(ENGINE_DIR, 'mach') async function getLocales() { // l10n/supported-languages is a list of locales divided by newlines // open the file and split it by newlines - const localesText = await readFile("l10n/supported-languages", "utf-8"); - log.info(`Found locales:\n${localesText}`); - return localesText.split("\n"); + const localesText = await readFile('l10n/supported-languages', 'utf-8') + log.info(`Found locales:\n${localesText}`) + return localesText.split('\n') } export const surferPackage = async () => { @@ -55,14 +55,14 @@ export const surferPackage = async () => { ) const currentCWD = process.cwd() - const zenMacDestDir = join(currentCWD, 'zen-browser'); - + const zenMacDestDir = join(currentCWD, 'zen-browser') + if (!process.env.SURFER_SIGNING_MODE) { await dispatch(machPath, arguments_, ENGINE_DIR, true) // Merge language packs for (const locale of await getLocales()) { - const arguments_ = ["build", `merge-${locale}`] + const arguments_ = ['build', `merge-${locale}`] log.info( `Packaging \`${config.binaryName}\` with args ${JSON.stringify( @@ -73,50 +73,94 @@ export const surferPackage = async () => { await dispatch(machPath, arguments_, ENGINE_DIR, true) } - log.info("Copying language packs") + log.info('Copying language packs') - await dispatch(machPath, ['package-multi-locale', '--locales', ...(await getLocales())], ENGINE_DIR, true) + await dispatch( + machPath, + ['package-multi-locale', '--locales', ...(await getLocales())], + ENGINE_DIR, + true + ) // If we are on macos, run "mach macos-sign" to sign the app and repack it - + if ((process as any).surferPlatform == 'darwin') { log.info('Signing the app') - const dmgFile = (await readdir(join(OBJ_DIR, 'dist'))).find((file) => file.endsWith('.dmg')) + const dmgFile = (await readdir(join(OBJ_DIR, 'dist'))).find((file) => + file.endsWith('.dmg') + ) if (!dmgFile) { log.error('Could not find the dmg file') - return; + return } log.debug('Copying the dmg file to the current working directory') // extract the dmg file - const dmgPath = join(OBJ_DIR, 'dist', dmgFile); - - await dispatch(machPath, ['python', '-m', 'mozbuild.action.unpack_dmg', dmgPath, zenMacDestDir], ENGINE_DIR, true); - + const dmgPath = join(OBJ_DIR, 'dist', dmgFile) + + await dispatch( + machPath, + ['python', '-m', 'mozbuild.action.unpack_dmg', dmgPath, zenMacDestDir], + ENGINE_DIR, + true + ) + log.info('Signing the app') if (process.env.MACOS_APPLE_DEVELOPER_ID) { log.info('Signing the app with the developer id') - await dispatch('chmod', ['+x', '../build/codesign/codesign.bash'], ENGINE_DIR, true); - await dispatch('../build/codesign/codesign.bash', [ - '-a', join(zenMacDestDir, 'Zen Browser.app'), - '-i', process.env.MACOS_APPLE_DEVELOPER_ID, - '-b', '../build/codesign/browser.developer.entitlements.xml', - '-p', '../build/codesign/plugin-container.developer.entitlements.xml' - ], ENGINE_DIR, true); + await dispatch( + 'chmod', + ['+x', '../build/codesign/codesign.bash'], + ENGINE_DIR, + true + ) + await dispatch( + '../build/codesign/codesign.bash', + [ + '-a', + join(zenMacDestDir, 'Zen Browser.app'), + '-i', + process.env.MACOS_APPLE_DEVELOPER_ID, + '-b', + '../build/codesign/browser.developer.entitlements.xml', + '-p', + '../build/codesign/plugin-container.developer.entitlements.xml', + ], + ENGINE_DIR, + true + ) } - log.info('Stapling the app'); - await dispatch("xcrun", ['stapler', 'staple', join(zenMacDestDir, 'Zen Browser.app')], ENGINE_DIR, true); - log.info('Repacking the app'); - const brandingPath = join(ENGINE_DIR, 'browser', 'branding', brandingKey); + log.info('Stapling the app') + await dispatch( + 'xcrun', + ['stapler', 'staple', join(zenMacDestDir, 'Zen Browser.app')], + ENGINE_DIR, + true + ) + log.info('Repacking the app') + const brandingPath = join(ENGINE_DIR, 'browser', 'branding', brandingKey) await remove(dmgPath) - await dispatch(machPath, ['python', '-m', 'mozbuild.action.make_dmg', - '--volume-name', 'Zen Browser', - '--icon', join(brandingPath, 'firefox.icns'), - '--background', join(brandingPath, 'background.png'), - '--dsstore', join(brandingPath, 'dsstore'), - zenMacDestDir, - dmgPath], ENGINE_DIR, true); + await dispatch( + machPath, + [ + 'python', + '-m', + 'mozbuild.action.make_dmg', + '--volume-name', + 'Zen Browser', + '--icon', + join(brandingPath, 'firefox.icns'), + '--background', + join(brandingPath, 'background.png'), + '--dsstore', + join(brandingPath, 'dsstore'), + zenMacDestDir, + dmgPath, + ], + ENGINE_DIR, + true + ) } } @@ -189,7 +233,12 @@ export const surferPackage = async () => { } } - const marPath = await createMarFile(version, channel, brandingDetails.release.github, zenMacDestDir) + const marPath = await createMarFile( + version, + channel, + brandingDetails.release.github, + zenMacDestDir + ) dynamicConfig.set('marPath', marPath) await generateBrowserUpdateFiles() @@ -210,7 +259,12 @@ function getCurrentBrandName(): string { return config.brands[brand].brandFullName } -async function createMarFile(version: string, channel: string, github?: { repo: string }, zenMacDestDir?: string): Promise { +async function createMarFile( + version: string, + channel: string, + github?: { repo: string }, + zenMacDestDir?: string +): Promise { log.info(`Creating mar file...`) let marBinary: string = windowsPathToUnix( join(OBJ_DIR, 'dist/host/bin', 'mar') @@ -228,8 +282,8 @@ async function createMarFile(version: string, channel: string, github?: { repo: ? join(zenMacDestDir, `${getCurrentBrandName()}.app`) : join(OBJ_DIR, 'dist', config.binaryName) - const marPath = resolve(DIST_DIR, 'output.mar'); - log.debug(`Writing MAR to ${DIST_DIR} from ${binary}`); + const marPath = resolve(DIST_DIR, 'output.mar') + log.debug(`Writing MAR to ${DIST_DIR} from ${binary}`) await configDispatch('./tools/update-packaging/make_full_update.sh', { args: [ // The mar output location diff --git a/src/commands/patches/branding-patch.ts b/src/commands/patches/branding-patch.ts index 1fc71d2..91114af 100644 --- a/src/commands/patches/branding-patch.ts +++ b/src/commands/patches/branding-patch.ts @@ -41,8 +41,13 @@ export const BRANDING_DIR = join(CONFIGS_DIR, 'branding') const BRANDING_STORE = join(ENGINE_DIR, 'browser', 'branding') const BRANDING_FF = join(BRANDING_STORE, 'unofficial') -const REQUIRED_FILES = ['logo.png', 'logo-mac.png', 'firefox.ico', 'firefox64.ico'] -const BRANDING_NSIS = 'branding.nsi'; +const REQUIRED_FILES = [ + 'logo.png', + 'logo-mac.png', + 'firefox.ico', + 'firefox64.ico', +] +const BRANDING_NSIS = 'branding.nsi' const CSS_REPLACE_REGEX = new RegExp( '#130829|hsla\\(235, 43%, 10%, .5\\)', @@ -87,11 +92,11 @@ async function setupImages(configPath: string, outputPath: string) { // Firefox doesn't use 512 by 512, but we need it to generate ico files later await every([16, 22, 24, 32, 48, 64, 128, 256, 512], async (size) => { - const logoPath = join(configPath, `logo${size}.png`); - if (!filesExist([logoPath])) throw new Error(`Missing logo${size}.png`); + const logoPath = join(configPath, `logo${size}.png`) + if (!filesExist([logoPath])) throw new Error(`Missing logo${size}.png`) - const outputPathLogo = join(outputPath, `default${size}.png`); - await copyFile(logoPath, outputPathLogo); + const outputPathLogo = join(outputPath, `default${size}.png`) + await copyFile(logoPath, outputPathLogo) return true }) @@ -178,9 +183,11 @@ async function copyMozFiles( (file) => !existsSync(join(outputPath, file.replace(BRANDING_FF, ''))) ) - const css = files.filter((file) => extname(file).includes('css')); + const css = files.filter((file) => extname(file).includes('css')) - const everythingElse = files.filter((file) => !css.includes(file) && !file.includes(BRANDING_NSIS)); + const everythingElse = files.filter( + (file) => !css.includes(file) && !file.includes(BRANDING_NSIS) + ) for (const [contents, path] of css .map((filePath) => [ @@ -196,12 +203,22 @@ async function copyMozFiles( writeFileSync(path, contents) } - const brandingNsis = files.filter((file) => file.includes(BRANDING_NSIS)); - console.assert(brandingNsis.length == 1, 'There should only be one branding.nsi file'); - const outputBrandingNsis = join(outputPath, brandingNsis[0].replace(BRANDING_FF, '')); - const configureProfileBrandingPath = join(outputPath, 'pref', 'firefox-branding.js'); - log.debug('Configuring branding.nsi into ' + outputBrandingNsis); - configureBrandingNsis(outputBrandingNsis, brandingConfig); + const brandingNsis = files.filter((file) => file.includes(BRANDING_NSIS)) + console.assert( + brandingNsis.length == 1, + 'There should only be one branding.nsi file' + ) + const outputBrandingNsis = join( + outputPath, + brandingNsis[0].replace(BRANDING_FF, '') + ) + const configureProfileBrandingPath = join( + outputPath, + 'pref', + 'firefox-branding.js' + ) + log.debug('Configuring branding.nsi into ' + outputBrandingNsis) + configureBrandingNsis(outputBrandingNsis, brandingConfig) // Copy everything else from the default firefox branding directory for (const file of everythingElse) { @@ -209,7 +226,7 @@ async function copyMozFiles( copyFileSync(file, join(outputPath, file.replace(BRANDING_FF, ''))) } - configureProfileBranding(configureProfileBrandingPath, brandingConfig); + configureProfileBranding(configureProfileBrandingPath, brandingConfig) } // ============================================================================= @@ -243,18 +260,23 @@ export async function apply(name: string): Promise { await copyMozFiles(outputPath, brandingConfig) await addOptionalIcons(configPath, outputPath) - setUpdateURLs(); + setUpdateURLs() } -function configureBrandingNsis(brandingNsis: string, brandingConfig: { - backgroundColor: string - brandShorterName: string - brandShortName: string - brandFullName: string - brandingGenericName: string - brandingVendor: string -}) { - writeFileSync(brandingNsis, ` +function configureBrandingNsis( + brandingNsis: string, + brandingConfig: { + backgroundColor: string + brandShorterName: string + brandShortName: string + brandFullName: string + brandingGenericName: string + brandingVendor: string + } +) { + writeFileSync( + brandingNsis, + ` # 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 # file, You can obtain one at http://mozilla.org/MPL/2.0/. @@ -331,35 +353,44 @@ function configureBrandingNsis(brandingNsis: string, brandingConfig: { !define INSTALL_INSTALLING_TEXT_COLOR 0xFFFFFF # This color is written as 0x00BBGGRR because it's actually a COLORREF value. !define PROGRESS_BAR_BACKGROUND_COLOR 0xFFAA00 -`); +` + ) } function addOptionalIcons(brandingPath: string, outputPath: string) { // move all icons in the top directory and inside "content/" into the branding directory - const icons = readdirSync(brandingPath); - const iconsContent = readdirSync(join(brandingPath, 'content')); + const icons = readdirSync(brandingPath) + const iconsContent = readdirSync(join(brandingPath, 'content')) for (const icon of icons) { - if (icon.includes('content')) continue; - log.info(`Copying ${icon} to ${outputPath}`); - copyFileSync(join(brandingPath, icon), join(outputPath, icon)); + if (icon.includes('content')) continue + log.info(`Copying ${icon} to ${outputPath}`) + copyFileSync(join(brandingPath, icon), join(outputPath, icon)) } for (const icon of iconsContent) { - log.info(`Copying ${icon} to ${outputPath}`); - copyFileSync(join(brandingPath, 'content', icon), join(outputPath, 'content', icon)); + log.info(`Copying ${icon} to ${outputPath}`) + copyFileSync( + join(brandingPath, 'content', icon), + join(outputPath, 'content', icon) + ) } } - -function configureProfileBranding(brandingPath: string, brandingConfig: { - backgroundColor: string - brandShorterName: string - brandShortName: string - brandFullName: string - brandingGenericName: string - brandingVendor: string -}) { - writeFileSync(brandingPath, ` + +function configureProfileBranding( + brandingPath: string, + brandingConfig: { + backgroundColor: string + brandShorterName: string + brandShortName: string + brandFullName: string + brandingGenericName: string + brandingVendor: string + } +) { + writeFileSync( + brandingPath, + ` /* 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 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ @@ -384,15 +415,16 @@ pref("app.releaseNotesURL.prompt", "https://zen-browser.app/release-notes/%VERSI // Number of usages of the web console. // If this is less than 5, then pasting code into the web console is disabled pref("devtools.selfxss.count", 5); -`); +` + ) } function setUpdateURLs() { - const sufix = (compatMode && (process as any).surferPlatform !== 'macos') - ? '-generic' : ''; - const baseURL = `URL=https://@MOZ_APPUPDATE_HOST@/updates/browser/%BUILD_TARGET%/%CHANNEL%${sufix}/update.xml`; - const appIni = join(ENGINE_DIR, 'build', 'application.ini.in'); - const appIniContents = readFileSync(appIni).toString(); - const updatedAppIni = appIniContents.replace(/URL=.*update.xml/g, baseURL); - writeFileSync(appIni, updatedAppIni); + const sufix = + compatMode && (process as any).surferPlatform !== 'macos' ? '-generic' : '' + const baseURL = `URL=https://@MOZ_APPUPDATE_HOST@/updates/browser/%BUILD_TARGET%/%CHANNEL%${sufix}/update.xml` + const appIni = join(ENGINE_DIR, 'build', 'application.ini.in') + const appIniContents = readFileSync(appIni).toString() + const updatedAppIni = appIniContents.replace(/URL=.*update.xml/g, baseURL) + writeFileSync(appIni, updatedAppIni) } diff --git a/src/commands/updates/browser.ts b/src/commands/updates/browser.ts index 4572ce2..350a819 100644 --- a/src/commands/updates/browser.ts +++ b/src/commands/updates/browser.ts @@ -32,7 +32,7 @@ const ausPlatformsMap = { 'Darwin_x86_64-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'], } export async function getPlatformConfig() { @@ -52,13 +52,19 @@ function getReleaseMarName(releaseInfo: ReleaseInfo): string | undefined { switch ((process as any).surferPlatform) { case 'win32': { - return compatMode ? releaseInfo.archives["windows-compat"] : releaseInfo.archives["windows"]; + return compatMode + ? releaseInfo.archives['windows-compat'] + : releaseInfo.archives['windows'] } case 'darwin': { - return compatMode ? releaseInfo.archives["macos-x64"] : releaseInfo.archives["macos-aarch64"]; + return compatMode + ? releaseInfo.archives['macos-x64'] + : releaseInfo.archives['macos-aarch64'] } case 'linux': { - return compatMode ? releaseInfo.archives["linux-compat"] : releaseInfo.archives["linux"]; + return compatMode + ? releaseInfo.archives['linux-compat'] + : releaseInfo.archives['linux'] } } } @@ -71,7 +77,12 @@ function getReleaseMarURL(releaseInfo: ReleaseInfo) { // The user is using github to distribute release binaries for this version. if (releaseInfo.github) { - completeMarURL = `https://github.com/${releaseInfo.github.repo}/releases/download/${releaseInfo.displayVersion}/${releaseMarName}` + let releaseVersion = releaseInfo.displayVersion + const channel = dynamicConfig.get('brand') as string + if (channel === 'twilight') { + releaseVersion = 'twilight' + } + completeMarURL = `https://github.com/${releaseInfo.github.repo}/releases/download/${releaseVersion}/${releaseMarName}` log.info(`Using '${completeMarURL}' as the distribution url`) } else { log.warning( @@ -96,7 +107,8 @@ async function writeUpdateFileToDisk( } } ) { - const suffix = (compatMode && (process as any).surferPlatform !== 'macos') ? '-generic' : '' + const suffix = + compatMode && (process as any).surferPlatform !== 'macos' ? '-generic' : '' const xmlPath = join( DIST_DIR, 'update', diff --git a/src/constants/index.ts b/src/constants/index.ts index ac012d6..5373016 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -93,7 +93,9 @@ if (process.platform == 'win32') { BASH_PATH = execa.sync('where.exe bash.exe').stdout.toString() if (!BASH_PATH.includes('bash.exe')) { - BASH_PATH = process.env.SURFER_SIGNING_MODE ? 'C:\\mozilla-build\\msys2\\usr\\bin\\bash.exe' : ''; + BASH_PATH = process.env.SURFER_SIGNING_MODE + ? 'C:\\mozilla-build\\msys2\\usr\\bin\\bash.exe' + : '' if (BASH_PATH === '') { log.error('Could not find bash, aborting') } @@ -101,7 +103,7 @@ if (process.platform == 'win32') { } // Replace .exe with .EXE BASH_PATH = BASH_PATH.replace(/\.exe$/, '.EXE') - + log.debug(`Found bash at ${BASH_PATH}`) } else { log.error( diff --git a/src/index.ts b/src/index.ts index 3d41389..79160f5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,12 +2,12 @@ function getPlatform() { if (process.env.SURFER_PLATFORM) { - return process.env.SURFER_PLATFORM; + return process.env.SURFER_PLATFORM } - return process.platform; + return process.platform } -Object.defineProperty(process, 'surferPlatform', { 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 @@ -48,7 +48,7 @@ export const bin_name = BIN_NAME const programVersions = [] -export const compatMode = process.env.SURFER_COMPAT == 'true'; +export const compatMode = process.env.SURFER_COMPAT == 'true' for (const brand in config.brands) { const brandConfig = config.brands[brand] diff --git a/src/types.d.ts b/src/types.d.ts index 7e10ff6..e90a010 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -29,4 +29,4 @@ export interface CmdOption { export type CmdFlagPlatform = NodeJS.Platform -declare module 'mount-dmg'; +declare module 'mount-dmg' diff --git a/src/utils/config.ts b/src/utils/config.ts index 959101c..c2e5ca8 100644 --- a/src/utils/config.ts +++ b/src/utils/config.ts @@ -62,13 +62,13 @@ export interface ReleaseInfo { } archives?: { - "windows"?: string, - "macos-aarch64"?: string, - "macos-x64"?: string, - "linux"?: string, + windows?: string + 'macos-aarch64'?: string + 'macos-x64'?: string + linux?: string - "windows-compat"?: string, - "linux-compat"?: string, + 'windows-compat'?: string + 'linux-compat'?: string } } diff --git a/src/utils/fs.ts b/src/utils/fs.ts index eb82434..7ba37f2 100644 --- a/src/utils/fs.ts +++ b/src/utils/fs.ts @@ -22,10 +22,9 @@ import { log } from '../log' * @returns A unix path */ export const windowsPathToUnix = (path: string): string => - (process as any).platform == 'win32' - ? - (process.env.SURFER_SIGNING_MODE ? "/c" : "") - + path.replace(/[\\]+/g, '/').replace(/^([a-zA-Z]+:|\.\/)/, '') + (process as any).platform == 'win32' + ? (process.env.SURFER_SIGNING_MODE ? '/c' : '') + + path.replace(/[\\]+/g, '/').replace(/^([a-zA-Z]+:|\.\/)/, '') : path export async function walkDirectory(directory: string): Promise { diff --git a/surfer.json b/surfer.json index 9e26dfe..0967ef4 100644 --- a/surfer.json +++ b/surfer.json @@ -1 +1 @@ -{} \ No newline at end of file +{}