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

@mctools/curseforge

v0.1.0

Published

Lib for working with CurseForge using minecraftinstance.json

Downloads

4

Readme

Lib for working with CurseForge using minecraftinstance.json

Usage

API

  1. Install package
npm i @mctools/curseforge
  1. Import functions from package.
import fnc from "@mctools/curseforge"

Functions

fetchMods

fetchMods(modIds, cfApiKey, timeout?, doLogging?): Promise<CFV2.CF2Addon[]>

Get mod information from CurseForge, such as name, summary, download count, etc.

Parameters

| Name | Type | Default value | Description | | :------ | :------ | :------ | :------ | | modIds | number[] | undefined | IDs of mods you want to fetch. [32274, 59751, 59816] | | cfApiKey | string | undefined | CurseForge API key. Get one at https://console.curseforge.com/?#/api-keys | | timeout | number | 96 | If file was already fetched last timeout hours, it would be loaded from cache file | | doLogging | boolean | false | Log into stdout |

Returns

Promise<CFV2.CF2Addon[]>

Object with information about mods

Example

const cfMods = await fetchMods([32274, 59751, 59816], key)
console.log(cfMods.map(m => m.name)) // ["JourneyMap", "Forestry", "Random Things"]

loadMCInstanceFiltered

loadMCInstanceFiltered(mci, ignore?): Minecraftinstance

Load minecraftinstance.json file from disk, filtering unavailable or ignored mods

Parameters

| Name | Type | Description | | :------ | :------ | :------ | | mci | Minecraftinstance | Json object of minecraftinstance.json | | ignore? | string | Ignore | readonly (string | Ignore)[] | .gitignore-like file content with mods to ignore. For example, ignore contains 3 lines: ts const mci = loadMCInstanceFiltered(mciPath, ` scripts/debug config/FBP/* mods/tellme-* `) Since it have line mods/tellme-* in it, mod tellme-1.12.2-0.7.0.jar would be removed from result. |

Returns

Minecraftinstance

Same minecraftinstance object but without unavailable on CF mods like Optifine or Nutrition.


modList

modList(fresh, old?, ignore?): ModsUnion

Compare two minecraftinstance.json files and output differences between them

Parameters

| Name | Type | Description | | :------ | :------ | :------ | | fresh | Minecraftinstance | Json object from minecraftinstance.json of current version | | old? | undefined | Json object from minecraftinstance.json of previous version. | | ignore? | string | Ignore | readonly (string | Ignore)[] | .gitignore-like file content with mods to ignore. Useful for dev-only mods that should not be included in result. |

Returns

ModsUnion

Result of comparsion. if old is omited, returns only union field.

modList(fresh, old?, ignore?): ModsComparsion

Parameters

| Name | Type | | :------ | :------ | | fresh | Minecraftinstance | | old? | Minecraftinstance | | ignore? | string | Ignore | readonly (string | Ignore)[] |

Returns

ModsComparsion

Author

  • https://github.com/Krutoy242

Other tools