diff --git a/Tools/Start-CippDevEmulatorsWithKitty.ps1 b/Tools/Start-CippDevEmulatorsWithKitty.ps1 index d0f156fd6479..39666bdcb05c 100644 --- a/Tools/Start-CippDevEmulatorsWithKitty.ps1 +++ b/Tools/Start-CippDevEmulatorsWithKitty.ps1 @@ -1,8 +1,11 @@ Get-Command kitty -ErrorAction Stop | Out-Null -Write-Host 'Starting CIPP Dev Emulators' Get-Process node -ErrorAction SilentlyContinue | Stop-Process -ErrorAction SilentlyContinue $Path = (Get-Item $PSScriptRoot).Parent.Parent.FullName +pwsh -file (Join-Path $PSScriptRoot 'Start-CippDevInstallation.ps1') + +Write-Host 'Starting CIPP Dev Emulators' + if (Test-Path (Join-Path $Path 'CIPP-API-Processor')) { $Process = Read-Host -Prompt 'Start Process Function (y/N)?' } @@ -11,7 +14,7 @@ if ($Process -eq 'y') { kitty --detach --title 'CIPP' -o allow_remote_control=yes -- pwsh -c " kitty @new-window --new-tab --tab-title `"Azurite`" --cwd $Path -- azurite ; kitty @new-window --new-tab --tab-title `"FunctionApp`" --cwd (Join-Path $Path `"CIPP-API`") -- func start; - kitty @new-window --new-tab --tab-title `"CIPP Frontend`" --cwd (Join-Path $Path `"CIPP`") -- npm run dev ; + kitty @new-window --new-tab --tab-title `"CIPP Frontend`" --cwd (Join-Path $Path `"CIPP`") -- yarn run dev ; kitty @new-window --new-tab --tab-title `"SWA`" --cwd (Join-Path $Path `"CIPP`") -- npm run start-swa; kitty @new-window --new-tab --tab-title `"CIPP-API-Processor`" --cwd (Join-Path $Path `"CIPP-API-Processor`") -- func start --port 7072" @@ -19,6 +22,6 @@ if ($Process -eq 'y') { kitty --detach --title 'CIPP' -o allow_remote_control=yes -- pwsh -c " kitty @new-window --new-tab --tab-title `"Azurite`" --cwd $Path -- azurite ; kitty @new-window --new-tab --tab-title `"FunctionApp`" --cwd (Join-Path $Path `"CIPP-API`") -- func start; - kitty @new-window --new-tab --tab-title `"CIPP Frontend`" --cwd (Join-Path $Path `"CIPP`") -- npm run dev ; + kitty @new-window --new-tab --tab-title `"CIPP Frontend`" --cwd (Join-Path $Path `"CIPP`") -- yarn run dev ; kitty @new-window --new-tab --tab-title `"SWA`" --cwd (Join-Path $Path `"CIPP`") -- npm run start-swa" } diff --git a/Tools/Start-CippDevInstallation.ps1 b/Tools/Start-CippDevInstallation.ps1 new file mode 100644 index 000000000000..fa1de465b2eb --- /dev/null +++ b/Tools/Start-CippDevInstallation.ps1 @@ -0,0 +1,32 @@ +$Path = (Get-Item $PSScriptRoot).Parent.Parent.FullName + +if (-not(Get-Command npm)) { + throw 'npm is required to install the CIPP development environment' +} + +if (-not(Get-Command azurite)) { + Write-Host 'Installing Azurite' + npm install --global 'azurite' +} + +if (-not(Get-Command swa)) { + Write-Host 'Installing @azure/static-web-apps-cli' + npm install --global '@azure/static-web-apps-cli' +} + +if (-not(Get-Command func)) { + Write-Host 'Installing Azure Functions Core Tools' + npm install --global 'azure-functions-core-tools@4' --unsafe-perms true +} + +if (-not(Get-Command yarn)) { + Write-Host 'Installing Yarn' + npm install --global yarn +} + +if (-not(yarn list --global --pattern 'next' | Select-String -Pattern 'next')) { + Write-Host 'Installing Next.js' + yarn install --global next --network-timeout 500000 +} + +yarn install --cwd (Join-Path $Path "CIPP") --network-timeout 500000