This repository has been archived by the owner on Jan 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.ps1
60 lines (48 loc) · 2.22 KB
/
setup.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<#
.SYNOPSIS
Algorand dev environment setup.
.DESCRIPTION
The goal of this script is that every dev can go from clean (or dirty :P) machine -> clone -> setup.ps1 -> open in IDE -> F5 debugging in minutes, cross-platform.
If you find problems with your local environment after running this (or during running this!) be sure to contribute fixes :)
This script is idempotent nadn re-entrant; you can safely execute it multiple times.
Pre-requisite: You have Docker, Docker Compose and Node 16+ installed.
#>
[CmdletBinding(SupportsShouldProcess = $true)]
Param()
#Requires -Version 7.0.0
Set-StrictMode -Version "Latest"
$ErrorActionPreference = "Stop"
###############################################################################################################
###############################################################################################################
###############################################################################################################
function Test-ThrowIfNotSuccessful($exitCode = 0) {
if ($LASTEXITCODE -ne 0 -or $exitCode -ne 0) {
Pop-Location
throw "Error executing last command"
}
}
function Write-Header([string] $title) {
Write-Host
Write-Host "#########################"
Write-Host "### $title"
Write-Host "#########################"
Write-Host
}
###############################################################################################################
###############################################################################################################
###############################################################################################################
$LASTEXITCODE = 0
Push-Location $PSScriptRoot
# Start up docker containers
Write-Header "Start docker containers"
& docker-compose up -d
Test-ThrowIfNotSuccessful
# Install various npm dependencies
Write-Header "npm install"
$process = Start-Process "npm" -ArgumentList "install" -WorkingDirectory "minter" -Wait -NoNewWindow -PassThru
Test-ThrowIfNotSuccessful -exitCode $process.ExitCode
# Check status of key dependencies
Write-Header "Checking status of Algorand sandbox and localstack"
& ./status.ps1
Test-ThrowIfNotSuccessful
Pop-Location