Containers/New-ContainerFromVSCode.ps1
function New-ContainerFromVSCode { Param( [Parameter(Mandatory=$false)] $ContainerName = "", [Parameter(Mandatory=$false)] $SourcePath = (Get-Location), [switch] $SetupTestUsers, [switch] $SkipTestTool, [switch] $enableTaskScheduler ) Write-Host -ForegroundColor Green "Creating new container for current project" if ($ContainerName -eq "") { $ContainerName = Get-ContainerFromLaunchJson } $locale = Get-EnvironmentKeyValue -KeyName 'locale' $startParameters = @{} [version]$platform = Get-AppKeyValue -SourcePath $SourcePath -KeyName 'platform' if ($platform.Major -le 14) { $startParameters.Add('includeCSide', $true) } if ($enableTaskScheduler.IsPresent) { $startParameters.Add('enableTaskScheduler', $true) } if ($SkipTestTool.IsPresent) { $startParameters.Add('SkipTestTool', $true) } New-Container -ContainerName $ContainerName -LicenseFile (Get-EnvironmentKeyValue -KeyName 'LocalLicenseFile') -alwaysPull -SetupTestUsers:$SetupTestUsers -Country $locale @startParameters if (!(Test-Path (Join-Path $SourcePath "tempDependency") -PathType Container)) { New-Item (Join-Path $SourcePath "tempDependency") -ItemType Directory -Force | Out-Null } Copy-Item (Join-Path $SourcePath "app.json") (Join-Path $SourcePath "tempDependency") Copy-Item (Join-Path $SourcePath "settings.json") (Join-Path $SourcePath "tempDependency") Get-ALDependencies -ContainerName $ContainerName -SourcePath (Join-Path $SourcePath "tempDependency") -Install if (Test-Path (Join-Path $SourcePath "BaseObjects") -PathType Container) { Import-ObjectsFromFolder -ContainerName $ContainerName -Folder (Join-Path $SourcePath "BaseObjects") } if ($platform.Major -le 10) { Import-ObjectsFromFolder -ContainerName $ContainerName -Folder (Join-Path $SourcePath "src") } Remove-Item (Join-Path $SourcePath "tempDependency") -Recurse -Force Write-Host -ForegroundColor Green "Successfully created container $ContainerName" } Export-ModuleMember New-ContainerFromVSCode |