depository-deploy 1.0.8 → 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.
@@ -225,21 +225,24 @@ $svcDefs = @(
225
225
  )
226
226
 
227
227
  foreach ($def in $svcDefs) {
228
- # Set environment variable for port (sc.exe doesn't support env natively; use registry trick)
229
- $binPath = $def.Exe
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
- # Use cmd wrapper to set env before launching
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
- & sc.exe create $def.Name binPath= "`"$($def.Exe)`"" start= auto DisplayName= $def.Desc | Out-Null
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
- # Set environment via registry
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','http://localhost:0' `
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "depository-deploy",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "Depository document management system – deployment wizard and installers",
5
5
  "license": "UNLICENSED",
6
6
  "publishConfig": {
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 newer = latest !== PKG_VERSION &&
322
- latest.split('.').map(Number).some((n, i) => n > (PKG_VERSION.split('.').map(Number)[i] || 0));
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) {