Skip to content

Commit

Permalink
1.0.2
Browse files Browse the repository at this point in the history
- Add config ver
- Allow host in `remove()`
- Fix setup command
  • Loading branch information
Nixinova committed Apr 3, 2021
1 parent d8886b9 commit 97feb43
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 1.0.2
*2021-04-04*
- Added configuration file version.
- Changed `remove` command to allow for specifying the host.
- Fixed setup command not configuring the Minecraft version correctly.

## 1.0.1
*2021-04-04*
- Changed mod host to not be case sensitive.
Expand Down
9 changes: 5 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const fs = require('fs');
const download = require('download');
const curseforge = require('mc-curseforge-api');

const VERSION = '1.0.1';
const VERSION = '1.0.2';
const MODS_FILE = 'mods.json';

function getConfig() { return JSON.parse(fs.readFileSync(MODS_FILE, { encoding: 'utf8' }, data => data)); }
Expand All @@ -31,7 +31,7 @@ function getValidVersions(versions, mcver) {
}

async function setup(mcver) {
const data = { versions: { minecraft: mcver }, mods: {} };
const data = { version: { config: 1, minecraft: mcver }, mods: {} };
fs.writeFile(MODS_FILE, JSON.stringify(data, {}, 4), { encoding: 'utf8' }, data => data);
}

Expand All @@ -53,7 +53,8 @@ async function install(srcArg, modID) {
fs.writeFile(MODS_FILE, JSON.stringify(modsJson, {}, 4), { encoding: 'utf8' }, data => data);
}

async function remove(modID) {
async function remove(a,b) {
const modID = b || a;
const modsJson = getConfig();
if (!modsJson.mods[modID]) return;
fs.unlink('./' + modsJson.mods[modID].version, err => err && console.log(err))
Expand Down Expand Up @@ -86,7 +87,7 @@ if (args[0]) {
Initialise a 'mods.json' listing file with a given Minecraft version.
modmanager install curse <modID>
Install a mod from CurgeForge, saving its metadata to 'mods.json'.
modmanager remove <modID>
modmanager remove [curse] <modID>
Uninstall a mod and remove its metadata from 'mods.json'.
modmanager update
Update all mods specified in the 'mods.json' file.
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": "mcmodmanager",
"version": "1.0.1",
"version": "1.0.2",
"description": "Keep your Minecraft Forge mods up to date using a simple CLI.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 97feb43

Please sign in to comment.