Repository navigation
Expand file tree
/
Copy pathsetup.ps1
More file actions
54 lines (39 loc) · 1.45 KB
/
Copy pathsetup.ps1
File metadata and controls
54 lines (39 loc) · 1.45 KB
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
$ApiOrigin = 'http://localhost:8008'
$RedirectUri = 'http://localhost:3000/'
$ApiEnvPath = 'src/api/.env'
$ClientEnvPath = 'src/client/.env'
Write-Output "`nYou will be prompted for your GitHub client ID and secret`n"
Write-Output "`nThese values will be stored in src/api.env and src/client/.env`n`n"
$ClientId = Read-Host -Prompt '[GitHub Client ID]'
$ClientSecret = Read-Host -Prompt '[GitHub Client Secret]'
if (Test-Path "$ClientEnvPath") {
Write-Output "`nclient env file already exists`n"
} else {
Write-Output "`ncreating client env file at $ClientEnvPath`n"
$ClientEnv = @"
REACT_APP_API_DOMAIN=$ApiOrigin
REACT_APP_GITHUB_AUTH_ENDPOINT=https://github.com/login/oauth/authorize?client_id=${ClientId}&redirect_uri=${RedirectUri}&scope=read:user
"@
Set-Content -Path "$ClientEnvPath" -Value $ClientEnv
}
if (Test-Path "$ApiEnvPath") {
Write-Output "`nAPI env file already exists`n"
} else {
Write-Output "`ncreating API env file at $ApiEnvPath`n"
$ApiEnv = @"
CLIENT_ORIGIN=http://localhost:3000
GITHUB_CLIENT_ID=$ClientId
GITHUB_CLIENT_SECRET=$ClientSecret
GITHUB_REDIRECT_URI=$RedirectUri
GITHUB_ACCESS_TOKEN_ENDPOINT=https://github.com/login/oauth/access_token
"@
Set-Content -Path "$ApiEnvPath" -Value $ApiEnv
}
Write-Output "`n`ninstalling API and Client dependencies`n`n"
# install api deps
cd src/api
npm install
# install client deps
cd ../client
npm install
Write-Output "`n`neverything is ready to go! to begin enter: npm start`n`n"