cursor-switch 1.0.2 → 1.0.3

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.
@@ -6,7 +6,7 @@
6
6
  * 3. 智能包管理器探测 (自动适配 npm / pnpm / yarn / bun)
7
7
  * 4. 零第三方依赖,纯 Node.js 原生轻量实现
8
8
  */
9
- export declare const CURRENT_VERSION = "1.0.0";
9
+ export declare const CURRENT_VERSION: string;
10
10
  export declare const PACKAGE_NAME = "cursor-switch";
11
11
  export interface VersionCheckResult {
12
12
  currentVersion: string;
@@ -6,10 +6,26 @@
6
6
  * 3. 智能包管理器探测 (自动适配 npm / pnpm / yarn / bun)
7
7
  * 4. 零第三方依赖,纯 Node.js 原生轻量实现
8
8
  */
9
+ import fs from 'node:fs';
10
+ import path from 'node:path';
11
+ import { fileURLToPath } from 'node:url';
9
12
  import { spawn } from 'node:child_process';
10
13
  import chalk from 'chalk';
11
14
  import { ConfigStore } from './config-store.js';
12
- export const CURRENT_VERSION = '1.0.0';
15
+ function getPackageVersion() {
16
+ try {
17
+ const currentDir = path.dirname(fileURLToPath(import.meta.url));
18
+ const pkgPath = path.resolve(currentDir, '..', '..', 'package.json');
19
+ if (fs.existsSync(pkgPath)) {
20
+ const data = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
21
+ if (data?.version)
22
+ return data.version;
23
+ }
24
+ }
25
+ catch { }
26
+ return '1.0.2';
27
+ }
28
+ export const CURRENT_VERSION = getPackageVersion();
13
29
  export const PACKAGE_NAME = 'cursor-switch';
14
30
  const CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000; // 24 小时检查周期
15
31
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cursor-switch",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "极速、安全、纯本地运行的 Cursor IDE 多账号管理与防封虚拟机器指纹切换纯命令行工具",
5
5
  "author": "aozai",
6
6
  "license": "MIT",