fix: emit file:// plugin URLs for dsh ESM loader on Windows
This commit is contained in:
@@ -19,14 +19,15 @@ param(
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$RepoRoot = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path
|
||||
$WorkbenchDir = Join-Path $RepoRoot 'workbench'
|
||||
$PluginDir = Join-Path $WorkbenchDir 'plugin'
|
||||
$LocalYml = Join-Path $WorkbenchDir 'cordis.local.yml'
|
||||
|
||||
# 1) 渲染 cordis.local.yml
|
||||
$template = Get-Content (Join-Path $WorkbenchDir 'cordis.template.yml') -Raw -Encoding UTF8
|
||||
$pluginDirPosix = ($PluginDir -replace '\\', '/')
|
||||
$workbenchDirPosix = ($WorkbenchDir -replace '\\', '/')
|
||||
$projectRootPosix = ($RepoRoot -replace '\\', '/')
|
||||
$rendered = $template.Replace('__PLUGIN_DIR__', $pluginDirPosix).Replace('__PROJECT_ROOT__', $projectRootPosix)
|
||||
# Windows 上 dsh 的 ESM 加载器要求 file:// URL
|
||||
$workbenchModuleUrl = 'file:///' + $workbenchDirPosix
|
||||
$rendered = $template.Replace('__WORKBENCH_DIR__', $workbenchModuleUrl).Replace('__PROJECT_ROOT__', $projectRootPosix)
|
||||
$rendered = $rendered -replace 'bridgePort: 8790', "bridgePort: $BridgePort"
|
||||
$rendered = $rendered -replace "consoleBaseUrl: 'http://127.0.0.1:8765'", "consoleBaseUrl: 'http://127.0.0.1:$ConsolePort'"
|
||||
[System.IO.File]::WriteAllText($LocalYml, $rendered, (New-Object System.Text.UTF8Encoding($false)))
|
||||
|
||||
Reference in New Issue
Block a user