Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] - Support Microsoft Edge (Chromium Based) #4203

Open
wants to merge 13 commits into
base: develop
from
@@ -29,5 +29,21 @@ exports['browsers returns the expected list of browsers 1'] = [
"versionRegex": {},
"profile": true,
"binary": "google-chrome-canary"
},
{
"name":"edgeCanary",
"family":"chrome",
"displayName":"Edge Canary",
"versionRegex":{},
"profile":true,
"binary":"edge-canary"
},
{
"name":"edgeDev",
"family":"chrome",
"displayName":"Edge Dev",
"versionRegex":{},
"profile":true,
"binary":"edge-dev"
}
]
@@ -28,6 +28,22 @@ export const browsers: Browser[] = [
profile: true,
binary: 'google-chrome-canary',
},
{
name: 'edgeCanary',
family: 'chrome',
displayName: 'Edge Canary',
versionRegex: /Microsoft Edge Canary (\S+)/,
profile: true,
binary: 'edge-canary',
},
{
name: 'edgeDev',
family: 'chrome',
displayName: 'Edge Dev',
versionRegex: /Microsoft Edge Dev (\S+)/,
profile: true,
binary: 'edge-dev',
},
]

/** starts a found browser and opens URL if given one */
@@ -19,6 +19,16 @@ const detectChromium = partial(findApp, [
'org.chromium.Chromium',
'CFBundleShortVersionString',
])
const detectEdgeCanary = partial(findApp, [
'Contents/MacOS/Microsoft Edge Canary',
'com.microsoft.Edge.Canary',
'CFBundleShortVersionString',
])
const detectEdgeDev = partial(findApp, [
'Contents/MacOS/Microsoft Edge Dev',
'com.microsoft.Edge.Dev',
'CFBundleShortVersionString',
])

type Detectors = {
[index: string]: Function
@@ -28,6 +38,8 @@ const browsers: Detectors = {
chrome: detectChrome,
canary: detectCanary,
chromium: detectChromium,
edgeDev: detectEdgeDev,
edgeCanary: detectEdgeCanary,
}

export function getVersionString (path: string) {
@@ -34,19 +34,43 @@ function formChromeCanaryAppPath () {
return normalize(exe)
}

function formEdgeCanaryAppPath () {
const home = homedir()
const exe = join(
home,
'AppData',
'Local',
'Microsoft',
'Edge SxS',
'Application',
'msedge.exe'
)

return normalize(exe)
}

function formEdgeDevAppPath () {
const exe = 'C:/Program Files (x86)/Microsoft/Edge Dev/Application/msedge.exe'

return normalize(exe)
}
type NameToPath = (name: string) => string

interface WindowsBrowserPaths {
[index: string]: NameToPath
chrome: NameToPath
canary: NameToPath
chromium: NameToPath
edgeDev: NameToPath
edgeCanary: NameToPath
}

const formPaths: WindowsBrowserPaths = {
chrome: formFullAppPath,
canary: formChromeCanaryAppPath,
chromium: formChromiumAppPath,
edgeDev: formEdgeDevAppPath,
edgeCanary: formEdgeCanaryAppPath,
}

function getWindowsBrowser (name: string): Promise<FoundBrowser> {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.