arms-app 1.0.46 → 1.0.47

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.
@@ -1,3 +1,9 @@
1
+ # ==============================
2
+ # 强制使用 UTF-8,避免中文乱码/报错
3
+ # ==============================
4
+ chcp 65001 > $null
5
+ [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
6
+
1
7
  # 切到脚本所在目录(确保在项目根目录执行)
2
8
  Set-Location $PSScriptRoot
3
9
 
@@ -6,8 +12,8 @@ Write-Host "当前目录: $PWD"
6
12
  # 1. 检查 npm 是否可用
7
13
  $npm = Get-Command npm.cmd -ErrorAction SilentlyContinue
8
14
  if (-not $npm) {
9
- Write-Host "npm 未找到,请确认已安装 Node.js 并配置到 PATH。" -ForegroundColor Red
10
- exit 1
15
+ Write-Host "npm 未找到,请确认已安装 Node.js 并配置到 PATH。" -ForegroundColor Red
16
+ exit 1
11
17
  }
12
18
 
13
19
  # 2. 获取本地 arms-app 版本(从当前项目依赖中)
@@ -17,25 +23,27 @@ Write-Host "正在获取本地 arms-app 版本..."
17
23
  $localJsonRaw = npm list arms-app --json --depth=0 2>$null
18
24
 
19
25
  if (-not $localJsonRaw) {
20
- Write-Host "无法获取本地依赖信息(npm list 返回空)。" -ForegroundColor Yellow
26
+ Write-Host "无法获取本地依赖信息(npm list 返回空)。" -ForegroundColor Yellow
21
27
  }
22
28
 
23
29
  $localVersion = $null
24
30
 
25
31
  try {
26
- $localJson = $localJsonRaw | ConvertFrom-Json
32
+ $localJson = $localJsonRaw | ConvertFrom-Json
27
33
 
28
34
  if ($localJson.dependencies.'arms-app') {
29
35
  $localVersion = $localJson.dependencies.'arms-app'.version
30
36
  }
31
- } catch {
32
- Write-Host "解析本地 npm 依赖信息失败。" -ForegroundColor Yellow
37
+ }
38
+ catch {
39
+ Write-Host "解析本地 npm 依赖信息失败。" -ForegroundColor Yellow
33
40
  }
34
41
 
35
42
  if (-not $localVersion) {
36
- Write-Host "当前项目中未找到已安装的 arms-app(可能尚未安装)。" -ForegroundColor Yellow
37
- } else {
38
- Write-Host "本地 arms-app 版本: $localVersion"
43
+ Write-Host "当前项目中未找到已安装的 arms-app(可能尚未安装)。" -ForegroundColor Yellow
44
+ }
45
+ else {
46
+ Write-Host "本地 arms-app 版本: $localVersion"
39
47
  }
40
48
 
41
49
  # 3. 获取远端 arms-app 最新版本
@@ -45,24 +53,25 @@ $remoteVersion = npm view arms-app version 2>$null
45
53
  $remoteVersion = $remoteVersion.Trim()
46
54
 
47
55
  if (-not $remoteVersion) {
48
- Write-Host "获取远端版本失败,请检查网络或包名是否正确。" -ForegroundColor Red
49
- exit 1
56
+ Write-Host "获取远端版本失败,请检查网络或包名是否正确。" -ForegroundColor Red
57
+ exit 1
50
58
  }
51
59
 
52
60
  Write-Host "远端 arms-app 最新版本: $remoteVersion"
53
61
 
54
62
  # 4. 比较版本号 & 决定是否更新
55
63
  if ($localVersion -ne $remoteVersion) {
56
- Write-Host "本地版本与远端版本不一致,执行 npm update arms-app..." -ForegroundColor Yellow
64
+ Write-Host "本地版本与远端版本不一致,执行 npm update arms-app..." -ForegroundColor Yellow
57
65
 
58
66
  npm update arms-app
59
67
 
60
68
  if ($LASTEXITCODE -eq 0) {
61
69
  Write-Host "arms-app 更新成功,已同步到最新版本 $remoteVersion。" -ForegroundColor Green
62
- } else {
70
+ }
71
+ else {
63
72
  Write-Host "npm update arms-app 执行失败,退出码: $LASTEXITCODE" -ForegroundColor Red
64
73
  }
65
- } else {
66
- Write-Host "本地 arms-app 已是最新版本,无需更新。" -ForegroundColor Green
67
74
  }
75
+ else {
76
+ Write-Host "本地 arms-app 已是最新版本,无需更新。" -ForegroundColor Green
68
77
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arms-app",
3
- "version": "1.0.46",
3
+ "version": "1.0.47",
4
4
  "description": "一个基于 Express 的 Web 应用1",
5
5
  "main": "index.js",
6
6
  "scripts": {