mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-21 04:04:25 +00:00
feat(mongodb): improve document quick filters
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
param(
|
||||
[string]$RustLog = "info",
|
||||
[string]$DbxPassword = "test",
|
||||
[switch]$NoWatch,
|
||||
[switch]$DryRun
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$repoRoot = Resolve-Path -LiteralPath (Join-Path $PSScriptRoot "..")
|
||||
Set-Location -LiteralPath $repoRoot
|
||||
|
||||
$env:RUST_LOG = $RustLog
|
||||
$env:DBX_PASSWORD = $DbxPassword
|
||||
|
||||
Write-Host "[dbx-backend] repo: $repoRoot" -ForegroundColor Cyan
|
||||
Write-Host "[dbx-backend] RUST_LOG=$env:RUST_LOG DBX_PASSWORD=$env:DBX_PASSWORD" -ForegroundColor DarkCyan
|
||||
|
||||
if ($DryRun) {
|
||||
if ($NoWatch) {
|
||||
Write-Host "[dbx-backend] dry run: cargo run -p dbx-web" -ForegroundColor Yellow
|
||||
} else {
|
||||
Write-Host "[dbx-backend] dry run: cargo watch -x 'run -p dbx-web' (fallback: cargo run -p dbx-web)" -ForegroundColor Yellow
|
||||
}
|
||||
exit 0
|
||||
}
|
||||
|
||||
$watchAvailable = $false
|
||||
if (-not $NoWatch) {
|
||||
try {
|
||||
& cargo watch --version *> $null
|
||||
$watchAvailable = ($LASTEXITCODE -eq 0)
|
||||
} catch {
|
||||
$watchAvailable = $false
|
||||
}
|
||||
}
|
||||
|
||||
if ($watchAvailable) {
|
||||
Write-Host "[dbx-backend] starting: cargo watch -x 'run -p dbx-web'" -ForegroundColor Green
|
||||
& cargo watch -x "run -p dbx-web"
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
|
||||
if (-not $NoWatch) {
|
||||
Write-Warning "cargo-watch is unavailable; falling back to cargo run -p dbx-web. Install with: cargo install cargo-watch"
|
||||
}
|
||||
|
||||
Write-Host "[dbx-backend] starting: cargo run -p dbx-web" -ForegroundColor Green
|
||||
& cargo run -p dbx-web
|
||||
exit $LASTEXITCODE
|
||||
@@ -0,0 +1,19 @@
|
||||
param(
|
||||
[switch]$DryRun
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$repoRoot = Resolve-Path -LiteralPath (Join-Path $PSScriptRoot "..")
|
||||
Set-Location -LiteralPath $repoRoot
|
||||
|
||||
Write-Host "[dbx-frontend] repo: $repoRoot" -ForegroundColor Cyan
|
||||
|
||||
if ($DryRun) {
|
||||
Write-Host "[dbx-frontend] dry run: pnpm.cmd run dev:web" -ForegroundColor Yellow
|
||||
exit 0
|
||||
}
|
||||
|
||||
Write-Host "[dbx-frontend] starting: pnpm.cmd run dev:web" -ForegroundColor Green
|
||||
& pnpm.cmd run dev:web
|
||||
exit $LASTEXITCODE
|
||||
@@ -0,0 +1,16 @@
|
||||
@echo off
|
||||
setlocal EnableDelayedExpansion
|
||||
set "SCRIPT_DIR=%~dp0"
|
||||
if not exist "%SCRIPT_DIR%dev-full.ps1" (
|
||||
if exist "%CD%\scripts\dev-full.ps1" set "SCRIPT_DIR=%CD%\scripts\"
|
||||
)
|
||||
cd /d "%SCRIPT_DIR%.."
|
||||
if "%~1"=="--" shift
|
||||
set "ARGS="
|
||||
:collect_args
|
||||
if "%~1"=="" goto run_script
|
||||
set "ARGS=!ARGS! "%~1""
|
||||
shift
|
||||
goto collect_args
|
||||
:run_script
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT_DIR%dev-full.ps1" !ARGS!
|
||||
@@ -0,0 +1,16 @@
|
||||
@echo off
|
||||
setlocal EnableDelayedExpansion
|
||||
set "SCRIPT_DIR=%~dp0"
|
||||
if not exist "%SCRIPT_DIR%dev-full.ps1" (
|
||||
if exist "%CD%\scripts\dev-full.ps1" set "SCRIPT_DIR=%CD%\scripts\"
|
||||
)
|
||||
cd /d "%SCRIPT_DIR%.."
|
||||
if "%~1"=="--" shift
|
||||
set "ARGS="
|
||||
:collect_args
|
||||
if "%~1"=="" goto run_script
|
||||
set "ARGS=!ARGS! "%~1""
|
||||
shift
|
||||
goto collect_args
|
||||
:run_script
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT_DIR%dev-full.ps1" !ARGS!
|
||||
@@ -0,0 +1,75 @@
|
||||
param(
|
||||
[string]$RustLog = "info",
|
||||
[string]$DbxPassword = "test",
|
||||
[switch]$NoWatch,
|
||||
[switch]$DryRun,
|
||||
[Parameter(ValueFromRemainingArguments = $true)]
|
||||
[string[]]$RemainingArgs
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
for ($i = 0; $i -lt $RemainingArgs.Count; $i++) {
|
||||
switch ($RemainingArgs[$i]) {
|
||||
"--" { }
|
||||
"-DryRun" { $DryRun = $true }
|
||||
"-NoWatch" { $NoWatch = $true }
|
||||
"-RustLog" {
|
||||
$i++
|
||||
if ($i -ge $RemainingArgs.Count) { throw "Missing value for -RustLog" }
|
||||
$RustLog = $RemainingArgs[$i]
|
||||
}
|
||||
"-DbxPassword" {
|
||||
$i++
|
||||
if ($i -ge $RemainingArgs.Count) { throw "Missing value for -DbxPassword" }
|
||||
$DbxPassword = $RemainingArgs[$i]
|
||||
}
|
||||
default { throw "Unknown argument: $($RemainingArgs[$i])" }
|
||||
}
|
||||
}
|
||||
|
||||
$repoRoot = Resolve-Path -LiteralPath (Join-Path $PSScriptRoot "..")
|
||||
$backendScript = Join-Path $PSScriptRoot "dev-backend.ps1"
|
||||
$frontendScript = Join-Path $PSScriptRoot "dev-frontend.ps1"
|
||||
|
||||
$shellCommand = Get-Command pwsh.exe -ErrorAction SilentlyContinue
|
||||
if (-not $shellCommand) {
|
||||
$shellCommand = Get-Command powershell.exe -ErrorAction Stop
|
||||
}
|
||||
$shell = $shellCommand.Source
|
||||
|
||||
$backendArgs = @(
|
||||
"-NoExit",
|
||||
"-NoProfile",
|
||||
"-ExecutionPolicy", "Bypass",
|
||||
"-File", $backendScript,
|
||||
"-RustLog", $RustLog,
|
||||
"-DbxPassword", $DbxPassword
|
||||
)
|
||||
if ($NoWatch) {
|
||||
$backendArgs += "-NoWatch"
|
||||
}
|
||||
|
||||
$frontendArgs = @(
|
||||
"-NoExit",
|
||||
"-NoProfile",
|
||||
"-ExecutionPolicy", "Bypass",
|
||||
"-File", $frontendScript
|
||||
)
|
||||
|
||||
if ($DryRun) {
|
||||
Write-Host "[dbx-dev] repo: $repoRoot" -ForegroundColor Cyan
|
||||
Write-Host "[dbx-dev] shell: $shell" -ForegroundColor Cyan
|
||||
Write-Host "[dbx-dev] backend window: $shell $($backendArgs -join ' ')" -ForegroundColor Yellow
|
||||
Write-Host "[dbx-dev] frontend window: $shell $($frontendArgs -join ' ')" -ForegroundColor Yellow
|
||||
& $shell -NoProfile -ExecutionPolicy Bypass -File $backendScript -RustLog $RustLog -DbxPassword $DbxPassword -NoWatch:$NoWatch -DryRun
|
||||
& $shell -NoProfile -ExecutionPolicy Bypass -File $frontendScript -DryRun
|
||||
exit 0
|
||||
}
|
||||
|
||||
Write-Host "[dbx-dev] starting backend and frontend in separate windows..." -ForegroundColor Green
|
||||
Write-Host "[dbx-dev] backend: RUST_LOG=$RustLog DBX_PASSWORD=$DbxPassword" -ForegroundColor DarkCyan
|
||||
Write-Host "[dbx-dev] frontend: http://127.0.0.1:5173" -ForegroundColor DarkCyan
|
||||
|
||||
Start-Process -FilePath $shell -ArgumentList $backendArgs -WorkingDirectory $repoRoot
|
||||
Start-Process -FilePath $shell -ArgumentList $frontendArgs -WorkingDirectory $repoRoot
|
||||
Reference in New Issue
Block a user