depository-deploy 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/install/install-windows.ps1 +17 -11
- package/package.json +1 -1
- package/wizard-server.mjs +9 -3
|
@@ -225,21 +225,24 @@ $svcDefs = @(
|
|
|
225
225
|
)
|
|
226
226
|
|
|
227
227
|
foreach ($def in $svcDefs) {
|
|
228
|
-
#
|
|
229
|
-
|
|
228
|
+
# Create a wrapper batch that sets the working directory (so appsettings.json is found)
|
|
229
|
+
# and optionally sets environment variables (e.g. ASPNETCORE_URLS for port binding).
|
|
230
|
+
$exeDir = Split-Path -Parent $def.Exe
|
|
231
|
+
$wrapperPath = Join-Path $exeDir "start-service.bat"
|
|
232
|
+
$batLines = "@echo off"
|
|
233
|
+
$batLines += "`r`ncd /d `"$exeDir`""
|
|
230
234
|
if ($def.Env -ne "") {
|
|
231
|
-
|
|
232
|
-
$wrapperPath = "$INSTALL_DIR\$($def.Name -replace 'depository-','')\start-service.bat"
|
|
233
|
-
"@echo off`r`nset $($def.Env)`r`n`"$($def.Exe)`"" | Set-Content $wrapperPath -Encoding ASCII
|
|
234
|
-
$binPath = $wrapperPath
|
|
235
|
+
$batLines += "`r`nset $($def.Env)"
|
|
235
236
|
}
|
|
236
|
-
|
|
237
|
+
$batLines += "`r`n`"$($def.Exe)`""
|
|
238
|
+
Set-Content -Path $wrapperPath -Value $batLines -Encoding ASCII
|
|
239
|
+
|
|
240
|
+
& sc.exe create $def.Name binPath= "`"$wrapperPath`"" start= auto DisplayName= $def.Desc | Out-Null
|
|
237
241
|
& sc.exe description $def.Name $def.Desc | Out-Null
|
|
238
|
-
|
|
242
|
+
|
|
243
|
+
# Also set environment via registry as a fallback
|
|
239
244
|
if ($def.Env -ne "") {
|
|
240
245
|
$regPath = "HKLM:\SYSTEM\CurrentControlSet\Services\$($def.Name)"
|
|
241
|
-
$envParts = $def.Env -split '='
|
|
242
|
-
$existingEnv = (Get-ItemProperty -Path $regPath -Name "Environment" -ErrorAction SilentlyContinue).Environment
|
|
243
246
|
Set-ItemProperty -Path $regPath -Name "Environment" -Value @($def.Env) -Type MultiString -ErrorAction SilentlyContinue
|
|
244
247
|
}
|
|
245
248
|
Write-OK " Registered: $($def.Name)"
|
|
@@ -281,8 +284,11 @@ foreach ($def in $svcDefs) {
|
|
|
281
284
|
if (Test-Path $def.Exe) {
|
|
282
285
|
Write-Warn " Running exe directly to capture error..."
|
|
283
286
|
try {
|
|
287
|
+
$exeDir = Split-Path -Parent $def.Exe
|
|
288
|
+
$testUrl = if ($def.Env -match 'ASPNETCORE_URLS=(.+)') { $Matches[1] } else { "http://127.0.0.1:0" }
|
|
284
289
|
$proc = Start-Process -FilePath $def.Exe `
|
|
285
|
-
-ArgumentList '--urls'
|
|
290
|
+
-ArgumentList '--urls',$testUrl `
|
|
291
|
+
-WorkingDirectory $exeDir `
|
|
286
292
|
-RedirectStandardOutput "$env:TEMP\$($def.Name)-stdout.txt" `
|
|
287
293
|
-RedirectStandardError "$env:TEMP\$($def.Name)-stderr.txt" `
|
|
288
294
|
-NoNewWindow -PassThru -ErrorAction SilentlyContinue
|
package/package.json
CHANGED
package/wizard-server.mjs
CHANGED
|
@@ -318,8 +318,13 @@ const server = createServer((req, res) => {
|
|
|
318
318
|
try {
|
|
319
319
|
const raw = execSync(`npm view ${PKG_NAME} version`, { encoding: 'utf8', timeout: 15000 }).trim();
|
|
320
320
|
const latest = raw.match(/[\d.]+/)?.[0] || raw;
|
|
321
|
-
const
|
|
322
|
-
|
|
321
|
+
const lParts = latest.split('.').map(Number);
|
|
322
|
+
const cParts = PKG_VERSION.split('.').map(Number);
|
|
323
|
+
let newer = false;
|
|
324
|
+
for (let i = 0; i < Math.max(lParts.length, cParts.length); i++) {
|
|
325
|
+
if ((lParts[i] || 0) > (cParts[i] || 0)) { newer = true; break; }
|
|
326
|
+
if ((lParts[i] || 0) < (cParts[i] || 0)) { break; }
|
|
327
|
+
}
|
|
323
328
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
324
329
|
res.end(JSON.stringify({ current: PKG_VERSION, latest, updateAvailable: newer }));
|
|
325
330
|
} catch (e) {
|
|
@@ -343,7 +348,8 @@ const server = createServer((req, res) => {
|
|
|
343
348
|
}
|
|
344
349
|
|
|
345
350
|
// Detect if running via npx/global install and pick the right update command
|
|
346
|
-
const
|
|
351
|
+
const scriptPath = process.argv[1] || '';
|
|
352
|
+
const isGlobal = scriptPath.includes('node_modules') ||
|
|
347
353
|
process.env.npm_config_global === 'true';
|
|
348
354
|
const cmd = isGlobal
|
|
349
355
|
? ['npm', ['install', '-g', `${PKG_NAME}@latest`]]
|