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)
This commit is contained in:
Lincoln Nogueira
2023-05-08 21:16:38 -03:00
committed by GitHub
parent 4605349bdc
commit 3b76c6792c
6 changed files with 300 additions and 5 deletions

42
scripts/start.ps1 Normal file
View File

@@ -0,0 +1,42 @@
# 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
}