'node client.js manage shared list' now lists shared mods

This commit is contained in:
Danielv123 committed 2017-11-04 20:07:25 +01:00
1 parent f507b503e9
commit c901275f38
3 files changed
+32 -1

No files matched your search

+26 -1
View File
@@ -1,3 +1,5 @@
const rightpad = require("right-pad");
const factorioAPI = require("node-factorio-api");
const fileOps = require("./../fileOps.js");
@@ -18,7 +20,30 @@ module.exports.listMods = function(instance){
});
});
} else {
console.log(instance)
// list shared mods in /sharedMods/
factorioAPI.init(false, 'sharedMods/', '', '0.15.37');
console.log("Authenticating to factorio.com...")
factorioAPI.authenticate({
username: 'Danielv123',
token: '53faebce0a608b1195f01dcfd95ee1',
require_ownership: false
}).then(() => {
factorioAPI.getInstalledMods().then(mods => {
let modNames = ["Name:"];
let modVersions = ["Version:"];
mods.forEach(mod=>{
modNames.push(mod.name);
modVersions.push(mod.version);
});
let longestName = modNames.reduce(function (a, b) { return a.length > b.length ? a : b; });
let longestVersion = modVersions.reduce(function (a, b) { return a.length > b.length ? a : b; });
console.log("| "+rightpad("Name:", longestName.length, " ")+" | "+rightpad("Version:", longestVersion.length, " ")+" |");
mods.forEach(mod => {
console.log("| "+rightpad(mod.name, longestName.length, " ")+" | "+rightpad(mod.version, longestVersion.length, " ")+" |");
});
});
});
}
// get JSON data about GH releases
+5
View File
@@ -3473,6 +3473,11 @@
"align-text": "0.1.4"
}
},
"right-pad": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/right-pad/-/right-pad-1.0.1.tgz",
"integrity": "sha1-jKCMLLtbVedNr6lr9/0aJ9VoyNA="
},
"rimraf": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.1.tgz",
+1
View File
@@ -43,6 +43,7 @@
"node-factorio-api": "^0.1.28",
"portfinder": "^1.0.9",
"request": "^2.83.0",
"right-pad": "^1.0.1",
"semver": "^5.4.1",
"simple-rcon": "^0.3.1",
"sync-request": "^4.0.1",