memos/scripts/start.ps1
Lincoln Nogueira 3b76c6792c
feat: add preliminar Windows support (#1636)
Add preliminar Windows support for both
development and production environments.

Default profile.Data will be set to "C:\ProgramData\memos" on Windows.
Folder will be created if it does not exist, as this behavior is
expected for Windows applications.

System service installation can be achieved with third-party tools,
explained in docs/windows-service.md.

Not sure if it's worth using https://github.com/kardianos/service
to make service support built-in.

This could be a nice addition alongside #1583 (add Windows artifacts)
2023-05-09 08:16:38 +08:00

43 lines
1.4 KiB
PowerShell

# This script starts the backend and frontend in development mode, with live reload.
# It also installs frontend dependencies.
# For more details on setting-up a development environment, check the docs:
# https://github.com/usememos/memos/blob/main/docs/development.md
# Usage: ./scripts/start.ps1
$LastExitCode = 0
$projectRoot = (Resolve-Path "$MyInvocation.MyCommand.Path/..").Path
Write-Host "Project root: $projectRoot"
Write-Host "Starting backend..." -f Magenta
Start-Process -WorkingDirectory "$projectRoot" -FilePath "air" "-c ./scripts/.air-windows.toml"
if ($LastExitCode -ne 0) {
Write-Host "Failed to start backend!" -f Red
exit $LastExitCode
}
else {
Write-Host "Backend started!" -f Green
}
Write-Host "Installing frontend dependencies..." -f Magenta
Start-Process -Wait -WorkingDirectory "$projectRoot/web" -FilePath "powershell" -ArgumentList "pnpm i"
if ($LastExitCode -ne 0) {
Write-Host "Failed to install frontend dependencies!" -f Red
exit $LastExitCode
}
else {
Write-Host "Frontend dependencies installed!" -f Green
}
Write-Host "Starting frontend..." -f Magenta
Start-Process -WorkingDirectory "$projectRoot/web" -FilePath "powershell" -ArgumentList "pnpm dev"
if ($LastExitCode -ne 0) {
Write-Host "Failed to start frontend!" -f Red
exit $LastExitCode
}
else {
Write-Host "Frontend started!" -f Green
}