tronclass-auto 1.7.4 → 1.7.5
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.
- package/bin/tronclass.js +23 -0
- package/package.json +1 -1
package/bin/tronclass.js
CHANGED
|
@@ -64,6 +64,29 @@ program
|
|
|
64
64
|
manageCourses(opts);
|
|
65
65
|
});
|
|
66
66
|
|
|
67
|
+
program
|
|
68
|
+
.command('update')
|
|
69
|
+
.description('更新到最新版本')
|
|
70
|
+
.action(async () => {
|
|
71
|
+
const { execSync } = require('child_process');
|
|
72
|
+
console.log(`目前版本: v${pkg.version}`);
|
|
73
|
+
console.log('檢查最新版本...');
|
|
74
|
+
try {
|
|
75
|
+
const latest = execSync('npm view tronclass-auto version', { encoding: 'utf8' }).trim();
|
|
76
|
+
console.log(`最新版本: v${latest}`);
|
|
77
|
+
if (latest === pkg.version) {
|
|
78
|
+
console.log('已經是最新版本!');
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
console.log('正在更新...');
|
|
82
|
+
execSync('npm install -g tronclass-auto@latest', { stdio: 'inherit' });
|
|
83
|
+
console.log('更新完成!');
|
|
84
|
+
} catch (e) {
|
|
85
|
+
console.error('更新失敗:', e.message);
|
|
86
|
+
console.error('請手動執行: npm install -g tronclass-auto@latest');
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
|
|
67
90
|
program
|
|
68
91
|
.command('config')
|
|
69
92
|
.description('顯示目前設定')
|