npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

minecraft-mod-updater

v1.3.17

Published

A Minecraft mod update tool based on Node.js

Downloads

34

Readme

Minecraft Mod Updater

A Minecraft mod update tool based on Node.js

Use it directly

Installation

Using npm

npm install -g minecraft-mod-updater

Command

CLI (Command aliases)

minecraft-mod-updater-cli
mcmu-cli
mcmuc

GUI (Command aliases)

minecraft-mod-updater-gui
mcmu-gui
mcmug

Example

CLI (Parameters are optional)

mcmuc -h
mcmuc -t Manifest -i "./MyModPack/manifest.json" -o "./MyModPack" -k "xxxxxxxxxxxxxxxxxxxxxx" -f
mcmuc -t JarFile -i "./MyModPack/mods" -o "./MyModPack" -v 1.20.1 -l forge -k "xxxxxxxxxxxxxxxxxxxxxx" -f

GUI (Parameters are optional)

mcmug -h
mcmuc -t Manifest -i "./MyModPack/manifest.json" -o "./MyModPack" -k "xxxxxxxxxxxxxxxxxxxxxx" -f
mcmuc -t JarFile -i "./MyModPack/mods" -o "./MyModPack" -v 1.20.1 -l forge -k "xxxxxxxxxxxxxxxxxxxxxx" -f

Parameter (General parameters)

  -t, --type <JarFile | Manifest>            read type is jarFile or manifest
  -i, --input <path>                         path to the input
  -o, --output <path>                        path to the output
  -v, --version <string>                     game version
  -l, --loader <forge | fabric | neoforge>   mod loader platform
  -k, --apiKey <text>                        api key
  -f, --forceDownload                        force download
  -h, --help                                 display help for command

Secondary development

If you need to do secondary development, use the following command:

Installation

Using npm

npm install --save minecraft-mod-updater

Example

import {
    ModJarFileUpdater,
    ModManifestUpdater,
    type ModInfo,
    type ModUpdateStatus,
    ErrorEnum,
    type ErrorType,
    type Parameter
} from 'minecraft-mod-updater';
import {blueBright, greenBright, magentaBright, redBright, yellowBright} from 'chalk';

// Manifest Mode
function manifest(input: string, forceDownload: boolean): void {
    if (existsSync(input)) {
        const modUpdater: ModManifestUpdater = new ModManifestUpdater(input, {
            output,
            apiKey,
            forceDownload
        });
        modUpdater.addEventListener<ModInfo>(EventEnum.DOWNLOADING, (mod: ModInfo): void => info(`${magentaBright('Downloading:')} ${blueBright(mod.fileName)} {(${yellowBright(mod.modId)}) [${redBright(mod.fileID)} => ${greenBright(mod.id)}]} -> ${blueBright(mod.downloadUrl)}`));
        modUpdater.addEventListener<ModInfo>(EventEnum.DOWNLOADED, (mod: ModInfo): void => info(`${greenBright('The download is complete')}: ${blueBright(mod.fileName)}\n`));
        modUpdater.addEventListener<ModInfo>(EventEnum.SKIPPED, (mod: ModInfo): void => warn(`${greenBright('Already the latest version, the update has been skipped')}: ${blueBright(mod.fileName)} (${yellowBright(mod.modId)} [${greenBright(mod.fileID)} == ${greenBright(mod.id)}]) \n`));
        modUpdater.addEventListener<ModUpdateStatus>(EventEnum.FINISHED, (mod: ModUpdateStatus): void => info(mod, '\n', greenBright('The update is complete')));
        modUpdater.addEventListener<ErrorType<ModInfo>>(EventEnum.ERRORED, ({ type, mod }: ErrorType<ModInfo>): void => {
            switch (type) {
                case ErrorEnum.ADDRESS:
                    error(`${redBright('=====Error: Unable to get file address, please download it manually=====')}\nMod ID: ${yellowBright(mod.modId)}\nThe name of the mod file: ${magentaBright(mod.fileName)}\n`);
                    break;
                case ErrorEnum.DOWNLOAD:
                    error(`${redBright('=====Error: Unable to download the file, please download it manually=====')}\nMod ID: ${yellowBright(mod.modId)}\nThe name of the mod file: ${magentaBright(mod.fileName)}\n`);
                    break;
            }
        });
    } else {
        error(redBright('The manifest.json file does not exist, please create it and try again alive to view the help with mcmu -h'));
    }
}

// JarFile Mode
function jarFile(input: string): void {
    const dirPath: string = input.includes('json') ? resolve('./mods'): input;
    if (existsSync(dirPath)) {
        if (!version) {
            error(redBright('The version is not specified, please specify it and try again alive to view the help with mcmu -h'));
            return;
        }
        if (!loader) {
            error(redBright('The modLoader is not specified, please specify it and try again alive to view the help with mcmu -h'));
            return;
        }
        ModJarFileUpdater.fakeModManifestFile.minecraft.version = version;
        ModJarFileUpdater.fakeModManifestFile.minecraft.modLoaders.push({
            'id':  loader,
            'primary': true
        });
        const modJarFileUpdater: ModJarFileUpdater = new ModJarFileUpdater(dirPath);
        modJarFileUpdater.addEventListener(EventNameEnum.INIT, (mod: ModInfo): void => info(`${magentaBright('Init:')} ${blueBright(mod.fileName)} (${yellowBright(mod.modId)})`));
        modJarFileUpdater.addEventListener(EventNameEnum.FINISHED, (): void => {
            manifest(join(resolve('.'), './temp.json'), true);
        });
    } else {
        error(redBright('The mods dir does not exist, please create it and try again alive to view the help with mcmu -h'));
    }
}

switch (type) {
    case 'Manifest':
        manifest(input, forceDownload);
        break;
    case 'JarFile':
        jarFile(input);
        break;
    default:
        error(redBright('The read type is incorrect, please try again alive to view the help with mcmu -h'));
}