Initial public release of MDEditor
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
param(
|
||||
[Parameter(Position = 0)]
|
||||
[ValidateSet('build', 'dev')]
|
||||
[string]$Mode = 'build',
|
||||
|
||||
[switch]$SkipPandocSync
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$repoRoot = Split-Path -Parent $PSScriptRoot
|
||||
$vsDevShell = 'C:\Program Files\Microsoft Visual Studio\18\Community\Common7\Tools\Launch-VsDevShell.ps1'
|
||||
$tauriCli = Join-Path $repoRoot 'node_modules\.bin\tauri.cmd'
|
||||
$pandocSyncScript = Join-Path $PSScriptRoot 'Sync-PandocSidecar.ps1'
|
||||
|
||||
if (-not (Test-Path $vsDevShell)) {
|
||||
throw "Visual Studio Developer Shell was not found at '$vsDevShell'."
|
||||
}
|
||||
|
||||
if (-not (Test-Path $tauriCli)) {
|
||||
throw "Local Tauri CLI was not found at '$tauriCli'. Run 'npm install' first."
|
||||
}
|
||||
|
||||
& $vsDevShell -Arch amd64 -HostArch amd64 > $null
|
||||
Set-Location $repoRoot
|
||||
$env:PATH = "$env:USERPROFILE\.cargo\bin;$env:PATH"
|
||||
|
||||
if (-not (Get-Command cargo -ErrorAction SilentlyContinue)) {
|
||||
throw "Cargo is not available on PATH after loading the developer shell."
|
||||
}
|
||||
|
||||
if (-not $SkipPandocSync) {
|
||||
& $pandocSyncScript
|
||||
}
|
||||
|
||||
Write-Host "Running Tauri $Mode from '$repoRoot'..."
|
||||
& $tauriCli $Mode
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
param()
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$repoRoot = Split-Path -Parent $PSScriptRoot
|
||||
$destination = Join-Path $repoRoot 'src-tauri\binaries\pandoc-x86_64-pc-windows-msvc.exe'
|
||||
$candidatePaths = @(
|
||||
(Join-Path $env:LOCALAPPDATA 'Pandoc\pandoc.exe')
|
||||
)
|
||||
|
||||
$pandocCommand = Get-Command pandoc -ErrorAction SilentlyContinue
|
||||
if ($pandocCommand) {
|
||||
$candidatePaths += $pandocCommand.Source
|
||||
}
|
||||
|
||||
$source = $candidatePaths | Where-Object { $_ -and (Test-Path $_) } | Select-Object -First 1
|
||||
|
||||
if (-not $source) {
|
||||
throw "Pandoc was not found. Install it first or place the sidecar manually at '$destination'."
|
||||
}
|
||||
|
||||
Copy-Item -LiteralPath $source -Destination $destination -Force
|
||||
|
||||
Write-Host "Synced Pandoc sidecar from '$source' to '$destination'."
|
||||
Reference in New Issue
Block a user