Skip to content

Instantly share code, notes, and snippets.

@ypcode
Created February 8, 2019 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ypcode/98203c9e5929e3b4d40d13918d2194a4 to your computer and use it in GitHub Desktop.
Save ypcode/98203c9e5929e3b4d40d13918d2194a4 to your computer and use it in GitHub Desktop.
param(
[string]$ConfigBaseName = "Workbench Profile ",
[string]$Url = "https://your.sharepoint.com/sites/test/_layouts/workbench.aspx",
[string]$UserDataDir = "C:\Workspace\chrome\dev_user_data"
)
# Get the profiles
$profiles = .\Get-ChromeVSCodeDebugProfiles.ps1 -UserDataDir $UserDataDir
$allConfigs = @()
ForEach ($profile in $profiles) {
$profileName = $profile.Name
$profileKey = $profile.Profile
$newLaunchConfig = New-Object -TypeName psobject
$newLaunchConfig |Add-Member -MemberType NoteProperty -Name "name" -Value $configBaseName$profileName
$newLaunchConfig |Add-Member -MemberType NoteProperty -Name "type" -Value "chrome"
$newLaunchConfig |Add-Member -MemberType NoteProperty -Name "request" -Value "launch"
$newLaunchConfig |Add-Member -MemberType NoteProperty -Name "url" -Value $url
$newLaunchConfig |Add-Member -MemberType NoteProperty -Name "webRoot" -Value "`${workspaceRoot}"
$newLaunchConfig |Add-Member -MemberType NoteProperty -Name "sourceMaps" -Value $True
$newLaunchConfig |Add-Member -MemberType NoteProperty -Name "userDataDir" -Value $userDataDir
$newLaunchConfig |Add-Member -MemberType NoteProperty -Name "sourceMapPathOverrides" -Value @{
"webpack:///../../../src/*"= "`${webRoot}/src/*";
"webpack:///../../../../src/*"= "`${webRoot}/src/*";
"webpack:///../../../../../src/*"= "`${webRoot}/src/*";
}
$newLaunchConfig |Add-Member -MemberType NoteProperty -Name "runtimeArgs" -Value @( "--remote-debugging-port=9222", "--profile-directory=$profileKey")
$allConfigs += $newLaunchConfig
}
$allConfigs | ConvertTo-Json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment