const https = require('https');
const fs = require('fs');
const path = require('path');

const latestGameMasterPath = 'https://raw.githubusercontent.com/BrunnerLivio/pokemongo-game-master/master/versions/latest/GAME_MASTER.json';
const latestVersionPath = 'https://raw.githubusercontent.com/BrunnerLivio/pokemongo-game-master/master/versions/latest-version.txt';

const dir = path.join(__dirname, '../src/data');
const file = path.join(dir, 'GAME_MASTER.json');
const latestVersionFile = path.join(dir, '.json');


function writeVersionToGameMaster(data) {
    fs.writeFileSync(file, JSON.stringify(gameMaster));
}


if (!fs.existsSync(dir)) {
    fs.mkdirSync(dir);
}


var fileStream = fs.createWriteStream(file);
https.get(latestGameMasterPath, (response) => {
    let gameMasterData = '';
    response.on('data', (d) => {
        gameMasterData += d.toString('utf8');
    });
    response.on('end', () => {
        let gameMaster = JSON.parse(gameMasterData);
        https.get(latestVersionPath, (response) => {
            response.on('data', (d) => {
                gameMaster.version = d.toString('utf8');
                fs.writeFileSync(file, JSON.stringify(gameMaster));
            });
        });
    });
});

@@ -511,111 +511,8 @@
 );%0A%0A
-%0Afunction writeVersionToGameMaster(data) %7B%0A    fs.writeFileSync(file, JSON.stringify(gameMaster));%0A%7D%0A%0A%0A
 if (

Clean latest game-master script