This commit is contained in:
2025-11-28 03:15:10 +08:00
parent b2fcc84321
commit 5f33926540
4 changed files with 24 additions and 68 deletions

View File

@@ -10,7 +10,7 @@
],
"author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)",
"license": "MIT",
"packageManager": "pnpm@10.23.0",
"packageManager": "pnpm@10.24.0",
"type": "module",
"files": [
"dist",
@@ -43,7 +43,7 @@
"devDependencies": {
"@kevisual/ai": "^0.0.12",
"@kevisual/load": "^0.0.6",
"@kevisual/local-app-manager": "^0.1.27",
"@kevisual/local-app-manager": "^0.1.28",
"@kevisual/logger": "^0.0.4",
"@kevisual/query": "0.0.29",
"@kevisual/query-login": "0.0.7",
@@ -78,7 +78,7 @@
"eventemitter3": "^5.0.1",
"lowdb": "^7.0.1",
"lru-cache": "^11.2.2",
"pm2": "^6.0.13",
"pm2": "^6.0.14",
"unstorage": "^1.17.3"
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@kevisual/cli",
"version": "0.0.65",
"version": "0.0.66",
"description": "envision 命令行工具",
"type": "module",
"basename": "/root/cli",

65
pnpm-lock.yaml generated
View File

@@ -100,8 +100,8 @@ importers:
specifier: ^11.2.2
version: 11.2.2
pm2:
specifier: ^6.0.13
version: 6.0.13(supports-color@10.2.2)
specifier: ^6.0.14
version: 6.0.14(supports-color@10.2.2)
unstorage:
specifier: ^1.17.3
version: 1.17.3(idb-keyval@6.2.1)
@@ -113,8 +113,8 @@ importers:
specifier: ^0.0.6
version: 0.0.6
'@kevisual/local-app-manager':
specifier: ^0.1.27
version: 0.1.27(supports-color@10.2.2)
specifier: ^0.1.28
version: 0.1.28(supports-color@10.2.2)
'@kevisual/logger':
specifier: ^0.0.4
version: 0.0.4
@@ -355,8 +355,8 @@ packages:
'@kevisual/load@0.0.6':
resolution: {integrity: sha512-+3YTFehRcZ1haGel5DKYMUwmi5i6f2psyaPZlfkKU/cOXgkpwoG9/BEqPCnPjicKqqnksEpixVRkyHJ+5bjLVA==}
'@kevisual/local-app-manager@0.1.27':
resolution: {integrity: sha512-pOSqdo08ajwJuwQWOI2AHMSk/5MovEYRZro0cs0weJlc0ApB0qQYTtZnSlg0s+X3DbpTMMdXBwfB0+60wF5MzA==}
'@kevisual/local-app-manager@0.1.28':
resolution: {integrity: sha512-sskvTy6Le0FUh+UklVdj4mmHKyGqHEqq/sBREnPR5h/f8ws1TFYLxiDeYIkKyE5nn6MIkg2WOZ4NANlU1R9pPQ==}
'@kevisual/logger@0.0.4':
resolution: {integrity: sha512-+fpr92eokSxoGOW1SIRl/27lPuO+zyY+feR5o2Q4YCNlAdt2x64NwC/w8r/3NEC5QenLgd4K0azyKTI2mHbARw==}
@@ -1114,10 +1114,6 @@ packages:
js-tokens@4.0.0:
resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
js-yaml@4.1.0:
resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==}
hasBin: true
js-yaml@4.1.1:
resolution: {integrity: sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==}
hasBin: true
@@ -1346,11 +1342,6 @@ packages:
pm2-sysmonit@1.2.8:
resolution: {integrity: sha512-ACOhlONEXdCTVwKieBIQLSi2tQZ8eKinhcr9JpZSUAL8Qy0ajIgRtsLxG/lwPOW3JEKqPyw/UaHmTWhUzpP4kA==}
pm2@6.0.13:
resolution: {integrity: sha512-1hS/adMgKoDpX4S1ichJW8SiGpex+oBSZK31dP1FSYOOGtaeuemXzhXPOCefmddgIY4K6v7uu+7xNPnmEnK3ag==}
engines: {node: '>=16.0.0'}
hasBin: true
pm2@6.0.14:
resolution: {integrity: sha512-wX1FiFkzuT2H/UUEA8QNXDAA9MMHDsK/3UHj6Dkd5U7kxyigKDA5gyDw78ycTQZAuGCLWyUX5FiXEuVQWafukA==}
engines: {node: '>=16.0.0'}
@@ -1864,7 +1855,7 @@ snapshots:
dependencies:
eventemitter3: 5.0.1
'@kevisual/local-app-manager@0.1.27(supports-color@10.2.2)':
'@kevisual/local-app-manager@0.1.28(supports-color@10.2.2)':
dependencies:
pm2: 6.0.14(supports-color@10.2.2)
transitivePeerDependencies:
@@ -2590,10 +2581,6 @@ snapshots:
js-tokens@4.0.0:
optional: true
js-yaml@4.1.0:
dependencies:
argparse: 2.0.1
js-yaml@4.1.1:
dependencies:
argparse: 2.0.1
@@ -2815,44 +2802,6 @@ snapshots:
- supports-color
optional: true
pm2@6.0.13(supports-color@10.2.2):
dependencies:
'@pm2/agent': 2.1.1(supports-color@10.2.2)
'@pm2/blessed': 0.1.81
'@pm2/io': 6.1.0(supports-color@10.2.2)
'@pm2/js-api': 0.8.0(supports-color@10.2.2)
'@pm2/pm2-version-check': 1.0.4(supports-color@10.2.2)
ansis: 4.0.0-node10
async: 3.2.6
chokidar: 3.6.0
cli-tableau: 2.0.1
commander: 2.15.1
croner: 4.1.97
dayjs: 1.11.15
debug: 4.4.3(supports-color@10.2.2)
enquirer: 2.3.6
eventemitter2: 5.0.1
fclone: 1.0.11
js-yaml: 4.1.0
mkdirp: 1.0.4
needle: 2.4.0(supports-color@10.2.2)
pidusage: 3.0.2
pm2-axon: 4.0.1(supports-color@10.2.2)
pm2-axon-rpc: 0.7.1(supports-color@10.2.2)
pm2-deploy: 1.0.2
pm2-multimeter: 0.1.2
promptly: 2.2.0
semver: 7.7.2
source-map-support: 0.5.21
sprintf-js: 1.1.2
vizion: 2.2.1
optionalDependencies:
pm2-sysmonit: 1.2.8(supports-color@10.2.2)
transitivePeerDependencies:
- bufferutil
- supports-color
- utf-8-validate
pm2@6.0.14(supports-color@10.2.2):
dependencies:
'@pm2/agent': 2.1.1(supports-color@10.2.2)

View File

@@ -16,8 +16,9 @@ const getRunFilePath = () => {
if (isJs) {
const dir = path.dirname(runFilePath); // /home/ubuntu/kevisual/cli/bin
distDir = path.relative(dir, '../dist'); // /home/ubuntu/kevisual/cli
} else {
distDir = path.resolve(process.cwd(), 'dist');
}
distDir = path.resolve(process.cwd(), 'dist');
return distDir;
}
@@ -66,7 +67,12 @@ const downloadNewDistFiles = async (distDir: string) => {
console.error('Error downloading files:', error);
});
}
const getVersion = async () => {
const getVersion = async (force?: boolean) => {
const runFilePath = getRunFilePath();
if (force) {
await downloadNewDistFiles(runFilePath);
return;
}
const baseURL = getConfig().baseURL || 'https://kevisual.cn';
const file = 'package.json';
const url = `${baseURL}/root/cli/${file}`;
@@ -76,9 +82,8 @@ const getVersion = async () => {
const latestVersion = json.version;
const version = useContextKey('version');
if (semver.lt(version, latestVersion)) {
console.log('当前版本:', version);
console.log('最新版本:', latestVersion);
downloadNewDistFiles(getRunFilePath());
console.log('当前版本:', version, '最新版本:', latestVersion, '正在更新...');
downloadNewDistFiles(runFilePath);
} else {
console.log('已经是最新版本', version);
}
@@ -86,6 +91,7 @@ const getVersion = async () => {
const update = new Command('update')
.option('-g --global', 'update global')
.option('-n --npm', 'use npm to update', false)
.option('-f --force', 'force update', false)
.description('update cli')
.action((opts) => {
try {
@@ -93,7 +99,8 @@ const update = new Command('update')
const cmd = opts.global ? 'npm install -g @kevisual/envision-cli' : 'npm install -D @kevisual/envision-cli';
execSync(cmd, { stdio: 'inherit', encoding: 'utf-8' });
} else {
getVersion()
const force = opts.force ? true : false;
getVersion(force)
}
} catch (error) {
console.error('Error updating CLI:', error);