stellar-ui-plus 1.25.10 → 1.25.12

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.
@@ -8,6 +8,7 @@ export interface AppUpdateProps {
8
8
  appVersion: string;
9
9
  zIndex: number;
10
10
  fallbackApiUrl: string;
11
+ strictVersionCheck: boolean;
11
12
  }
12
13
 
13
14
  export default {
@@ -82,4 +83,11 @@ export default {
82
83
  }
83
84
  }
84
85
  },
86
+ strictVersionCheck: {
87
+ type: Boolean,
88
+ default: false,
89
+ validator: (value: boolean) => {
90
+ return typeof value === 'boolean';
91
+ }
92
+ },
85
93
  } satisfies Record<keyof AppUpdateProps, any>;
@@ -54,6 +54,12 @@
54
54
  "type": "string",
55
55
  "default": ""
56
56
  },
57
+ {
58
+ "name": "strictVersionCheck",
59
+ "description": "严格版本检查,设为true时只有新版本大于当前版本才触发更新",
60
+ "type": "boolean",
61
+ "default": "false"
62
+ },
57
63
  {
58
64
  "name": "[event]cancel",
59
65
  "description": "取消更新时触发"
@@ -91,6 +91,20 @@ const isVersionSkipped = (versionCode: string) => {
91
91
  return skippedVersions.value.includes(versionCode);
92
92
  };
93
93
 
94
+ const compareVersions = (newVersion: string, currentVersion: string): number => {
95
+ const newParts = newVersion.split('.').map(v => parseInt(v) || 0);
96
+ const currentParts = currentVersion.split('.').map(v => parseInt(v) || 0);
97
+ const maxLength = Math.max(newParts.length, currentParts.length);
98
+
99
+ for (let i = 0; i < maxLength; i++) {
100
+ const newPart = newParts[i] || 0;
101
+ const currentPart = currentParts[i] || 0;
102
+ if (newPart > currentPart) return 1;
103
+ if (newPart < currentPart) return -1;
104
+ }
105
+ return 0;
106
+ };
107
+
94
108
  // 跳过当前版本
95
109
  const skipVersion = () => {
96
110
  if (!data.code) return;
@@ -206,7 +220,11 @@ const getData = async (callback?: (resVersion: { name: string; code: string; upd
206
220
  data.name = nvs.join('.');
207
221
  }
208
222
 
209
- if (data.updateFile && data.code !== version.value) {
223
+ const shouldUpdate = props.strictVersionCheck
224
+ ? compareVersions(data.name, version.value) > 0
225
+ : data.code !== version.value;
226
+
227
+ if (data.updateFile && shouldUpdate) {
210
228
  const downloadState = getDownloadState();
211
229
  const hasValidDownloadState = downloadState
212
230
  && downloadState.versionCode === data.code
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stellar-ui-plus",
3
- "version": "1.25.10",
3
+ "version": "1.25.12",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "MIT",
@@ -11,6 +11,7 @@
11
11
  },
12
12
  "scripts": {
13
13
  "test": "echo \"Error: no test specified\" && exit 1",
14
- "publish-vscode-plugin": "cd ../../../plugins/ste-helper & pnpm run publish"
14
+ "publish-vscode-plugin": "cd ../../../plugins/ste-helper & pnpm run publish",
15
+ "prepublishOnly": "pnpm run publish-vscode-plugin"
15
16
  }
16
17
  }