Skip to content

Commit

Permalink
fix: Resolved issue in version checking functionality (#207)
Browse files Browse the repository at this point in the history
  • Loading branch information
takuyaW authored Jun 24, 2024
1 parent d8224cc commit cf66354
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@

CHANGELOG
====
v5.0.3
----

#### Bug Fix
* Resolved issue in version checking functionality
* Fixed incorrect JSON parsing that could lead to errors

v5.0.2
----

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "monaca",
"version": "5.0.2",
"version": "5.0.3",
"description": "Monaca Command Line Tool",
"bin": {
"monaca": "bin/monaca"
Expand Down
22 changes: 15 additions & 7 deletions src/monaca.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,21 @@ var taskList = {};
var latestVersion;

https.get('https://ide.monaca.mobi/api/public/versions', function(res) {
res.on('data', function (data) {
data = JSON.parse(data);
latestVersion = data.result.monacaCli.replace(/"/g,'').split('/').pop();
});
}).on('error', function (){

})
let rawData = '';
res.on('data', function (chunk) {
rawData += chunk;
});
res.on('end', function() {
try {
const parsedData = JSON.parse(rawData);
latestVersion = parsedData.result.monacaCli.replace(/"/g,'').split('/').pop();
} catch (e) {
console.error('Error parsing JSON:', e.message);
}
});
}).on('error', function(e) {
console.log('Error: ' + e);
});

var docsPath = '../doc/tasks/';
fs.readdirSync(path.join(__dirname, docsPath)).forEach(function(filename) {
Expand Down

0 comments on commit cf66354

Please sign in to comment.