The lockfile object
-The working directory
-The options object
-Generate a modpack.json file
-The modpack information
-The lockfile
-The path to write the JSON object to
-The options object
-The JSON file's object
-Write a license to a file
-The modpack information
-The path to write the license to
-The initialization options object
-The license text to override the default license text with
-The license text or null if the license text could not be generated
-Generate the modpack files (lockfile, JSON, and optionally license, gitignore, and readme)
-The modpack information
-The directory to generate the files in
-The options object
-The lockfile object
-Generate the README.md files for each category
-The lockfile object
-The working directory
-The options object
-Get the modpack info from the JSON file if it exists
-The path to the directory to scan
-The modpack info JSON object if the file exists, otherwise null
-Get user input for modpack information
-The initial/default modpack information
-The modpack information from the user
-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
-.mrpackfile 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:
npm install -g modpack-lock
-
-
-Alternatively, you can run it using npx:
npx modpack-lock
-
-
-To generate a lockfile for your modpack, run:
-modpack-lock
-
-
-The script will:
-mods, resourcepacks, datapacks, and shaderpacks directories for .jar and .zip filesmodpack.lock 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.
Usage: modpack-lock [options] [command]
-
-Creates a modpack lockfile for files hosted on Modrinth (mods, resource packs, shaders and datapacks)
-
-Options:
- -p, --path <path> Path to the modpack directory
- -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] <script> Run a script defined in the modpack.json file's 'scripts' field
-
-
-You can generate summary files for each category by running modpack-lock -r. This will generate a README.md file in each of the content folders, detailing the scanned files and important attribution information for them.
To initialize a new modpack, run:
-modpack-lock init
-
-
-This command will:
-modpack.json file that stores your modpack's metadata (name, version, author, etc.), including a list of dependenciesThe interactive mode will prompt you for each field. Set their initial values using the available option flags. Use --noninteractive with the required options to skip the interactive-prompt and use the provided values.
Usage: modpack-lock 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.
-
-Options:
- -f, --folder <path> Path to the modpack directory
- -n, --noninteractive Non-interactive mode - must provide options for required fields
- --add-license Add the LICENSE file to the modpack
- --add-gitignore Update the .gitignore file to ignore content hosted on Modrinth
- --add-readme Generate README.md files for each category
-
-MODPACK INFORMATION
- --name <name> Modpack name; defaults to the directory name
- --version <version> Modpack version; defaults to 1.0.0
- --id <id> Modpack slug/ID; defaults to the directory name slugified
- --description <description> Modpack description
- --author <author> Modpack author; required
- --projectUrl <projectUrl> Modpack URL; defaults to a guessed Modrinth project URL
- --sourceUrl <sourceUrl> Modpack source code URL; defaults to a guessed GitHub repository URL
- --license <license> Modpack license, popular licenses fetched from GitHub; defaults to MIT in interactive mode
- --modloader <modloader> Modpack modloader, list of loaders fetched from Modrinth; required
- --targetModloaderVersion <targetModloaderVersion> Target modloader version
- --targetMinecraftVersion <targetMinecraftVersion> Target Minecraft version, list of versions fetched from Modrinth; required
-
-INFORMATION
- -h, --help display help for modpack-lock init
-
-
-To run a script defined in modpack.json, run:
modpack-lock run <script>
-
-
-This command takes the name of the script as its first argument:
-modpack.json in the current directory by default.-f option to specify a different path to the modpack directory.-D option.--To pass additional arguments and options to the script, write them after a
---separator:- -modpack-lock run <script> -- [options] <args> -
The scripts field in modpack.json is a key-value pair of script names and their corresponding shell commands. The scripts field is optional and is omitted by default.
Usage: modpack-lock run [options] <script>
-
-Run a script defined in the modpack.json file's 'scripts' field
-
-Arguments:
- script The name of the script to run
-
-Options:
- -f, --folder <path> Path to the modpack directory
- -D, --debug Debug mode -- show more information about how the command is being parsed
-
-INFORMATION
- -h, --help display help for modpack-lock run
-
-
-For programmatic usage, modpack-lock exports these functions:
getModpackInfo()getLockfile()generateJson()generateGitignoreRules()generateReadmeFiles()generateLicense()generateLockfile()generateModpackFiles()promptUserForInfo()See the API documentation for full details.
-modpack.lockThe lockfile contains metadata about Modrinth-hosted files found in modpack directories:
-{
"version": "1.0.1",
"generated": "2026-01-06T03:00:00.000Z",
"total": 7,
"counts": {
"mods": 1,
"resourcepacks": 3,
"datapacks": 1,
"shaderpacks": 2
},
"dependencies": {
"mods": [
{
"path": "mods/example-mod.jar",
"version": { ... }
}
],
"resourcepacks": [ ... ],
"datapacks": [ ... ],
"shaderpacks": [ ... ]
}
}
-
-
-modpack.jsonThe JSON file contains your modpack metadata and a dependency list:
-{
"name": "My Modpack",
"version": "1.0.0",
"id": "my-modpack",
"description": "",
"author": "name",
"projectUrl": "",
"sourceUrl": "",
"license": "",
"modloader": "modloader",
"targetModloaderVersion": "",
"targetMinecraftVersion": "x.y.z",
"scripts": {
"example": "echo 'example script'"
},
"dependencies": {
"mods": [ ... ],
"resourcepacks": [ ... ],
"datapacks": [ ... ],
"shaderpacks": [ ... ]
}
}
-
-
-Use modpack-lock -g to automatically update your .gitignore file with rules to ignore modpack contents, with exceptions for any files that are not hosted by Modrinth:
# .gitignore
-
-# modpack-lock:start
-mods/*.jar
-resourcepacks/*.zip
-datapacks/*.zip
-shaderpacks/*.zip
-*/**/*.disabled
-
-## Exceptions
-!mods/example.jar
-# modpack-lock:end
-
-
-This section is managed by modpack-lock and will be updated automatically when you run modpack-lock -g. Changes made inside this section will be overwritten, but any changes you make outside of this section will be preserved.
This project is licensed under the MIT License - see the LICENSE file for more details.
- -Contains options for the initialization of the modpack files.
-The folder to generate the modpack files in
-Whether to run the interactive mode
-Whether to add the license file to the modpack
-Whether to generate .gitignore rules
-Whether to generate README.md files
-The name of the modpack
-The version of the modpack
-The slug/ID of the modpack
-The description of the modpack
-The author of the modpack
-The modpack's project URL
-The modpack's source code URL
-The modpack's license
-The modpack's modloader
-The target modloader version
-The target Minecraft version
-Internal boolean added to indicate options come from the init command.
Contains information about the modpack dependencies and their versions.
-The version of the modpack
-The date and time the lockfile was generated
-The total number of files in the modpack
-The counts object
-The mods count
-The resourcepacks count
-The datapacks count
-The shaderpacks count
-The dependencies object
-The mods object
-The resourcepacks object
-The datapacks object
-The shaderpacks object
-Contains information about the modpack that is not dependent on the lockfile.
-The name of the modpack (Required)
-The version of the modpack (Required)
-The description of the modpack
-The slug/ID of the modpack (Required)
-The author of the modpack (Required)
-The project URL of the modpack
-The source code URL of the modpack
-The license of the modpack
-The modloader of the modpack (Required)
-The target modloader version of the modpack
-The target Minecraft version of the modpack (Required)
-Contains options for the generation of the modpack files.
-Whether to dry run the generation
-Whether to quiet the console output
-Whether to silent the console output
-Whether to generate a .gitignore file
-Whether to generate README.md files
-Whether to generate a license file
-
Generate .gitignore rules for files not hosted on Modrinth and write them to .gitignore file
-