Skip to content

Commit fad382b

Browse files
committed
refactor: get lotus version js
1 parent 1a8c4f1 commit fad382b

File tree

1 file changed

+6
-27
lines changed

1 file changed

+6
-27
lines changed

scripts/get-latest-lotus-version.js

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
const https = require('https');
22

3-
/**
4-
* Fetches the latest Lotus version from GitHub releases
5-
* @returns {Promise<string>} The latest version number without the 'v' prefix
6-
* @throws {Error} If the version cannot be fetched or parsed
7-
*/
83
async function getLatestLotusVersion() {
94
return new Promise((resolve, reject) => {
105
const options = {
@@ -44,29 +39,13 @@ async function getLatestLotusVersion() {
4439
});
4540
}
4641

47-
// If this file is run directly (not imported)
4842
if (require.main === module) {
49-
// Test mode
50-
if (process.argv[2] === '--test') {
51-
console.log('Testing getLatestLotusVersion function...');
52-
getLatestLotusVersion()
53-
.then(version => {
54-
console.log('Success! Latest version:', version);
55-
})
56-
.catch(error => {
57-
console.error('Test failed:', error.message);
58-
process.exit(1);
59-
});
60-
} else {
61-
// Normal mode - just output the version
62-
getLatestLotusVersion()
63-
.then(version => console.log(version))
64-
.catch(error => {
65-
console.error(error.message);
66-
process.exit(1);
67-
});
68-
}
43+
getLatestLotusVersion()
44+
.then(version => console.log(version))
45+
.catch(error => {
46+
console.error(error.message);
47+
process.exit(1);
48+
});
6949
}
7050

71-
// Export the function for use in other files
7251
module.exports = getLatestLotusVersion;

0 commit comments

Comments
 (0)