Creates a modpack lockfile for files hosted on Modrinth (mods, resource packs, shaders and datapacks)
npm install modpack-lock###### by nickesc - GitHub | Modrinth
Creates a modpack lockfile for files hosted on Modrinth (mods, resource packs, shaders and datapacks).
Many mod and pack authors request that modpack creators link to Modrinth or CurseForge downloads rather than re-hosting files. This makes it difficult to track content files in version control when pushing to a remote server.
This script generates a modpack.lock file containing a plaintext representation of the modpack's contents. This object contains the metadata for the content available on Modrinth, including hashes, versions, names, download URLs and more. An optional modpack.json file can also be created to store your modpack's metadata (name, version, modloader, dependencies, etc.) alongside the lockfile. This setup allows for easy diffing and clear version history.
> While an .mrpack file could be used to track changes to the modpack, it is a large, binary file that cannot be diffed and can contain large amounts of duplicate data from the rest of the repository.
Using the scripts field in modpack.json, you can also define reusable, tracked shell commands for common modpack tasks (like publishing, generating assets or CI/CD workflows).
To install the script globally with npm:
``bash`
npm install -g modpack-lock
Alternatively, you can run it using npx:
`bash`
npx modpack-lock
To generate a lockfile for your modpack, run:
`bash`
modpack-lock
The script will:
- Scan target directory's mods, resourcepacks, datapacks, and shaderpacks directories for .jar and .zip filesmodpack.lock
- Calculate SHA1 hashes for each file
- Query the Modrinth API for matching versions
- Generate a file (and update modpack.json dependencies if present)
Use flags to generate README.md files for each category or update the .gitignore to ignore content hosted on Modrinth.
`text
Usage: modpack-lock [options] [command]
Creates a modpack lockfile for files hosted on Modrinth (mods, resource packs, shaders and datapacks)
Options:
-p, --path
-d, --dry-run Dry-run mode - no files will be written
GENERATION
-g, --gitignore Update the .gitignore file to ignore content hosted on Modrinth
-r, --readme Generate README.md files for each category
LOGGING
-q, --quiet Quiet mode - only show errors and warnings
-s, --silent Silent mode - no output
INFORMATION
-V output the version number
-h, --help display help for modpack-lock
Commands:
init [options] This utility will walk you through creating a modpack.json file. It only covers the most common items, and tries to guess sensible defaults.
run [options]