diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..eeebe0c --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,29 @@ +# Javascript Node CircleCI 2.0 configuration file +# +# Check https://circleci.com/docs/2.0/language-javascript/ for more details +# +version: 2 +jobs: + build: + docker: + # specify the version you desire here + - image: circleci/node:10.14.2 + + working_directory: ~/repo + + steps: + - checkout + + # Download and cache dependencies + - restore_cache: + keys: + - deps-{{ checksum "yarn.lock" }} + + - run: yarn --frozen-lockfile + - run: yarn build + - run: yarn dist + + - save_cache: + paths: + - node_modules + key: deps-{{ checksum "yarn.lock" }} diff --git a/package.json b/package.json index 435d8a0..b3b77c0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rattracker", - "version": "0.1.6-alpha", + "version": "0.1.7-alpha", "author": { "name": "CMDR NoLifeKing", "email": "nolifeking@fuelrats.com" diff --git a/src/Lib/Journal/EDJournalLogParser.js b/src/Lib/Journal/EDJournalLogParser.js index 3bfccf9..02f9b7b 100644 --- a/src/Lib/Journal/EDJournalLogParser.js +++ b/src/Lib/Journal/EDJournalLogParser.js @@ -52,24 +52,21 @@ module.exports = { CanSynthesizeLifesupport: false, Status: null }, - isJson(line) { + safeJsonParse(line) { try { - JSON.parse(line); + return JSON.parse(line); } catch (e) { - return false; + return null; } - - return true; }, parseStatusFile(line) { - if (this.isJson(line)) { - const status = JSON.parse(line); + const status = this.safeJsonParse(line); + if (!!status) this.localData.Status = status; - } }, parseLogLine(line) { - if (this.isJson(line)) { - const logItem = JSON.parse(line); + const logItem = this.safeJsonParse(line); + if (!!logItem) { switch (logItem.event) { case 'Continued': // TODO: Handle continued logs @@ -83,7 +80,6 @@ module.exports = { case 'BuyExplorationData': case 'BuyTradeData': case 'CapShipBond': - case 'CargoDepot': case 'ChangeCrewRole': case 'CollectCargo':