ConceptPortal-public/scripts/dev/LocalDevSetup.ps1

55 lines
1.3 KiB
PowerShell
Raw Normal View History

# Create venv and install dependencies + imports
$backend = Resolve-Path -Path "$PSScriptRoot\..\..\rsconcept\backend"
2023-09-07 16:53:18 +03:00
$frontend = Resolve-Path -Path "$PSScriptRoot\..\..\rsconcept\frontend"
$envPath = "$backend\venv"
$python = "$envPath\Scripts\python.exe"
function LocalDevelopmentSetup() {
FrontendSetup
BackendSetup
}
function FrontendSetup() {
Set-Location $frontend
2023-09-07 16:53:18 +03:00
& npm install --only=dev
}
function BackendSetup() {
Set-Location $backend
ClearPrevious
CreateEnv
InstallPips
InstallImports
}
function ClearPrevious() {
if (Test-Path -Path $envPath) {
Write-Host "Removing previous env: $envPath`n" -ForegroundColor DarkGreen
Remove-Item $envPath -Recurse -Force
}
}
function CreateEnv() {
Write-Host "Creating python env: $envPath`n" -ForegroundColor DarkGreen
& 'python' -m venv $envPath
}
function InstallPips() {
& $python -m pip install --upgrade pip
& $python -m pip install -r requirements_dev.txt
}
function InstallImports() {
$wheel = Get-Childitem -Path import\*win*.whl -Name
if (-not $wheel) {
Write-Error 'Missing import wheel'
Exit 1
}
Write-Host "Installing wheel: $wheel`n" -ForegroundColor DarkGreen
& $python -m pip install -I import\$wheel
}
LocalDevelopmentSetup