diff --git a/docs/functions/generateGitignoreRules.html b/docs/functions/generateGitignoreRules.html index 70144f6..0c1ebda 100644 --- a/docs/functions/generateGitignoreRules.html +++ b/docs/functions/generateGitignoreRules.html @@ -2,4 +2,4 @@

Parameters

Returns Promise<void>

+

Returns Promise<void>

diff --git a/docs/functions/generateJson.html b/docs/functions/generateJson.html index e5f30e1..2e67e62 100644 --- a/docs/functions/generateJson.html +++ b/docs/functions/generateJson.html @@ -4,4 +4,4 @@
  • workingDir: string

    The path to write the JSON object to

  • options: Options | InitOptions = {}

    The options object

  • Returns Promise<Lockfile>

    The JSON file's object

    -
    +
    diff --git a/docs/functions/generateLicense.html b/docs/functions/generateLicense.html index 368cb6e..d8c230b 100644 --- a/docs/functions/generateLicense.html +++ b/docs/functions/generateLicense.html @@ -4,4 +4,4 @@
  • options: InitOptions = {}

    The initialization options object

  • licenseTextOverride: string = null

    The license text to override the default license text with

  • Returns Promise<string>

    The license text or null if the license text could not be generated

    -
    +
    diff --git a/docs/functions/generateLockfile.html b/docs/functions/generateLockfile.html index 0956a56..2ca5994 100644 --- a/docs/functions/generateLockfile.html +++ b/docs/functions/generateLockfile.html @@ -2,4 +2,4 @@

    Parameters

    Returns Lockfile

    The lockfile object

    -
    +
    diff --git a/docs/functions/generateModpackFiles.html b/docs/functions/generateModpackFiles.html index a0b4092..92af068 100644 --- a/docs/functions/generateModpackFiles.html +++ b/docs/functions/generateModpackFiles.html @@ -3,4 +3,4 @@
  • workingDir: string

    The directory to generate the files in

  • options: Options | InitOptions = {}

    The options object

  • Returns Promise<Lockfile>

    The lockfile object

    -
    +
    diff --git a/docs/functions/generateReadmeFiles.html b/docs/functions/generateReadmeFiles.html index 16bb91c..246b99e 100644 --- a/docs/functions/generateReadmeFiles.html +++ b/docs/functions/generateReadmeFiles.html @@ -2,4 +2,4 @@

    Parameters

    Returns Promise<void>

    +

    Returns Promise<void>

    diff --git a/docs/functions/getLockfile.html b/docs/functions/getLockfile.html index b8f8a60..46fb813 100644 --- a/docs/functions/getLockfile.html +++ b/docs/functions/getLockfile.html @@ -1,4 +1,4 @@ getLockfile | modpack-lock
    modpack-lock
      Preparing search index...

      Function getLockfile

      • Get the lockfile file if it exists

        Parameters

        • directoryPath: string

          The path to the directory to scan

        Returns Lockfile

        The JSON object if the file exists, otherwise null

        -
      +
      diff --git a/docs/functions/getModpackInfo.html b/docs/functions/getModpackInfo.html index 35e2966..09bfde8 100644 --- a/docs/functions/getModpackInfo.html +++ b/docs/functions/getModpackInfo.html @@ -1,4 +1,4 @@ getModpackInfo | modpack-lock
      modpack-lock
        Preparing search index...

        Function getModpackInfo

        • Get the modpack info from the JSON file if it exists

          Parameters

          • directoryPath: string

            The path to the directory to scan

          Returns Promise<ModpackInfo>

          The modpack info JSON object if the file exists, otherwise null

          -
        +
        diff --git a/docs/functions/promptUserForInfo.html b/docs/functions/promptUserForInfo.html index 422fda4..e0afcc4 100644 --- a/docs/functions/promptUserForInfo.html +++ b/docs/functions/promptUserForInfo.html @@ -1,4 +1,4 @@ promptUserForInfo | modpack-lock
        modpack-lock
          Preparing search index...

          Function promptUserForInfo

          +
          diff --git a/docs/interfaces/InitOptions.html b/docs/interfaces/InitOptions.html index f3c0364..aff7b4b 100644 --- a/docs/interfaces/InitOptions.html +++ b/docs/interfaces/InitOptions.html @@ -1,5 +1,5 @@ InitOptions | modpack-lock
          modpack-lock
            Preparing search index...

            Interface InitOptions

            Contains options for the initialization of the modpack files.

            -
            interface InitOptions {
                folder: string;
                noninteractive: boolean;
                addLicense: boolean;
                addGitignore: boolean;
                addReadme: boolean;
                name: string;
                version: string;
                id: string;
                description: string;
                author: string;
                projectUrl: string;
                sourceUrl: string;
                license: string;
                modloader: string;
                targetModloaderVersion: string;
                targetMinecraftVersion: string;
                _init: boolean;
            }
            Index

            Properties

            interface InitOptions {
                folder: string;
                noninteractive: boolean;
                addLicense: boolean;
                addGitignore: boolean;
                addReadme: boolean;
                name: string;
                version: string;
                id: string;
                description: string;
                author: string;
                projectUrl: string;
                sourceUrl: string;
                license: string;
                modloader: string;
                targetModloaderVersion: string;
                targetMinecraftVersion: string;
                _init: boolean;
            }
            Index

            Properties

            folder: string

            The folder to generate the modpack files in

            -
            noninteractive: boolean

            Whether to run the interactive mode

            -
            addLicense: boolean

            Whether to add the license file to the modpack

            -
            addGitignore: boolean

            Whether to generate .gitignore rules

            -
            addReadme: boolean

            Whether to generate README.md files

            -
            name: string

            The name of the modpack

            -
            version: string

            The version of the modpack

            -
            id: string

            The slug/ID of the modpack

            -
            description: string

            The description of the modpack

            -
            author: string

            The author of the modpack

            -
            projectUrl: string

            The modpack's project URL

            -
            sourceUrl: string

            The modpack's source code URL

            -
            license: string

            The modpack's license

            -
            modloader: string

            The modpack's modloader

            -
            targetModloaderVersion: string

            The target modloader version

            -
            targetMinecraftVersion: string

            The target Minecraft version

            -
            _init: boolean

            Internal boolean added to indicate options come from the init command.

            -
            +
            noninteractive: boolean

            Whether to run the interactive mode

            +
            addLicense: boolean

            Whether to add the license file to the modpack

            +
            addGitignore: boolean

            Whether to generate .gitignore rules

            +
            addReadme: boolean

            Whether to generate README.md files

            +
            name: string

            The name of the modpack

            +
            version: string

            The version of the modpack

            +
            id: string

            The slug/ID of the modpack

            +
            description: string

            The description of the modpack

            +
            author: string

            The author of the modpack

            +
            projectUrl: string

            The modpack's project URL

            +
            sourceUrl: string

            The modpack's source code URL

            +
            license: string

            The modpack's license

            +
            modloader: string

            The modpack's modloader

            +
            targetModloaderVersion: string

            The target modloader version

            +
            targetMinecraftVersion: string

            The target Minecraft version

            +
            _init: boolean

            Internal boolean added to indicate options come from the init command.

            +
            diff --git a/docs/interfaces/Lockfile.html b/docs/interfaces/Lockfile.html index e6a1e9e..b342913 100644 --- a/docs/interfaces/Lockfile.html +++ b/docs/interfaces/Lockfile.html @@ -1,20 +1,20 @@ Lockfile | modpack-lock
            modpack-lock
              Preparing search index...

              Interface Lockfile

              Contains information about the modpack dependencies and their versions.

              -
              interface Lockfile {
                  version: string;
                  generated: string;
                  total: number;
                  counts: {
                      mods: number;
                      resourcepacks: number;
                      datapacks: number;
                      shaderpacks: number;
                  };
                  dependencies: {
                      mods: any[];
                      resourcepacks: any[];
                      datapacks: any[];
                      shaderpacks: any[];
                  };
              }
              Index

              Properties

              interface Lockfile {
                  version: string;
                  generated: string;
                  total: number;
                  counts: {
                      mods: number;
                      resourcepacks: number;
                      datapacks: number;
                      shaderpacks: number;
                  };
                  dependencies: {
                      mods: any[];
                      resourcepacks: any[];
                      datapacks: any[];
                      shaderpacks: any[];
                  };
              }
              Index

              Properties

              version: string

              The version of the modpack

              -
              generated: string

              The date and time the lockfile was generated

              -
              total: number

              The total number of files in the modpack

              -
              counts: {
                  mods: number;
                  resourcepacks: number;
                  datapacks: number;
                  shaderpacks: number;
              }

              The counts object

              +
              generated: string

              The date and time the lockfile was generated

              +
              total: number

              The total number of files in the modpack

              +
              counts: {
                  mods: number;
                  resourcepacks: number;
                  datapacks: number;
                  shaderpacks: number;
              }

              The counts object

              Type Declaration

              • mods: number

                The mods count

              • resourcepacks: number

                The resourcepacks count

              • datapacks: number

                The datapacks count

              • shaderpacks: number

                The shaderpacks count

                -
              dependencies: {
                  mods: any[];
                  resourcepacks: any[];
                  datapacks: any[];
                  shaderpacks: any[];
              }

              The dependencies object

              +
              dependencies: {
                  mods: any[];
                  resourcepacks: any[];
                  datapacks: any[];
                  shaderpacks: any[];
              }

              The dependencies object

              Type Declaration

              • mods: any[]

                The mods object

              • resourcepacks: any[]

                The resourcepacks object

              • datapacks: any[]

                The datapacks object

              • shaderpacks: any[]

                The shaderpacks object

                -
              +
              diff --git a/docs/interfaces/ModpackInfo.html b/docs/interfaces/ModpackInfo.html index 3ae5d0d..a08369b 100644 --- a/docs/interfaces/ModpackInfo.html +++ b/docs/interfaces/ModpackInfo.html @@ -1,5 +1,5 @@ ModpackInfo | modpack-lock
              modpack-lock
                Preparing search index...

                Interface ModpackInfo

                Contains information about the modpack that is not dependent on the lockfile.

                -
                interface ModpackInfo {
                    name: string;
                    version: string;
                    description: string;
                    id: string;
                    author: string;
                    projectUrl: string;
                    sourceUrl: string;
                    license: string;
                    modloader: string;
                    targetModloaderVersion: string;
                    targetMinecraftVersion: string;
                }
                Index

                Properties

                interface ModpackInfo {
                    name: string;
                    version: string;
                    description: string;
                    id: string;
                    author: string;
                    projectUrl: string;
                    sourceUrl: string;
                    license: string;
                    modloader: string;
                    targetModloaderVersion: string;
                    targetMinecraftVersion: string;
                }
                Index

                Properties

                name: string

                The name of the modpack (Required)

                -
                version: string

                The version of the modpack (Required)

                -
                description: string

                The description of the modpack

                -
                id: string

                The slug/ID of the modpack (Required)

                -
                author: string

                The author of the modpack (Required)

                -
                projectUrl: string

                The project URL of the modpack

                -
                sourceUrl: string

                The source code URL of the modpack

                -
                license: string

                The license of the modpack

                -
                modloader: string

                The modloader of the modpack (Required)

                -
                targetModloaderVersion: string

                The target modloader version of the modpack

                -
                targetMinecraftVersion: string

                The target Minecraft version of the modpack (Required)

                -
                +
                version: string

                The version of the modpack (Required)

                +
                description: string

                The description of the modpack

                +
                id: string

                The slug/ID of the modpack (Required)

                +
                author: string

                The author of the modpack (Required)

                +
                projectUrl: string

                The project URL of the modpack

                +
                sourceUrl: string

                The source code URL of the modpack

                +
                license: string

                The license of the modpack

                +
                modloader: string

                The modloader of the modpack (Required)

                +
                targetModloaderVersion: string

                The target modloader version of the modpack

                +
                targetMinecraftVersion: string

                The target Minecraft version of the modpack (Required)

                +
                diff --git a/docs/interfaces/Options.html b/docs/interfaces/Options.html index 67cb30e..8ab6758 100644 --- a/docs/interfaces/Options.html +++ b/docs/interfaces/Options.html @@ -1,14 +1,14 @@ Options | modpack-lock
                modpack-lock
                  Preparing search index...

                  Interface Options

                  Contains options for the generation of the modpack files.

                  -
                  interface Options {
                      dryRun: boolean;
                      quiet: boolean;
                      silent: boolean;
                      gitignore: boolean;
                      readme: boolean;
                      licenseFile: boolean;
                  }
                  Index

                  Properties

                  interface Options {
                      dryRun: boolean;
                      quiet: boolean;
                      silent: boolean;
                      gitignore: boolean;
                      readme: boolean;
                      licenseFile: boolean;
                  }
                  Index

                  Properties

                  dryRun: boolean

                  Whether to dry run the generation

                  -
                  quiet: boolean

                  Whether to quiet the console output

                  -
                  silent: boolean

                  Whether to silent the console output

                  -
                  gitignore: boolean

                  Whether to generate a .gitignore file

                  -
                  readme: boolean

                  Whether to generate README.md files

                  -
                  licenseFile: boolean

                  Whether to generate a license file

                  -
                  +
                  quiet: boolean

                  Whether to quiet the console output

                  +
                  silent: boolean

                  Whether to silent the console output

                  +
                  gitignore: boolean

                  Whether to generate a .gitignore file

                  +
                  readme: boolean

                  Whether to generate README.md files

                  +
                  licenseFile: boolean

                  Whether to generate a license file

                  +
                  diff --git a/docs/sitemap.xml b/docs/sitemap.xml index 01f9056..4a28550 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -2,66 +2,66 @@ https://nickesc.github.io/modpack-lock/index.html - 2026-02-02T03:38:53.882Z + 2026-02-14T23:07:21.244Z https://nickesc.github.io/modpack-lock/modules.html - 2026-02-02T03:38:53.882Z + 2026-02-14T23:07:21.244Z https://nickesc.github.io/modpack-lock/hierarchy.html - 2026-02-02T03:38:53.882Z + 2026-02-14T23:07:21.244Z https://nickesc.github.io/modpack-lock/interfaces/ModpackInfo.html - 2026-02-02T03:38:53.882Z + 2026-02-14T23:07:21.244Z https://nickesc.github.io/modpack-lock/interfaces/Lockfile.html - 2026-02-02T03:38:53.882Z + 2026-02-14T23:07:21.244Z https://nickesc.github.io/modpack-lock/interfaces/Options.html - 2026-02-02T03:38:53.882Z + 2026-02-14T23:07:21.244Z https://nickesc.github.io/modpack-lock/interfaces/InitOptions.html - 2026-02-02T03:38:53.882Z + 2026-02-14T23:07:21.244Z https://nickesc.github.io/modpack-lock/functions/getModpackInfo.html - 2026-02-02T03:38:53.882Z + 2026-02-14T23:07:21.244Z https://nickesc.github.io/modpack-lock/functions/getLockfile.html - 2026-02-02T03:38:53.882Z + 2026-02-14T23:07:21.244Z https://nickesc.github.io/modpack-lock/functions/generateGitignoreRules.html - 2026-02-02T03:38:53.882Z + 2026-02-14T23:07:21.244Z https://nickesc.github.io/modpack-lock/functions/generateJson.html - 2026-02-02T03:38:53.882Z + 2026-02-14T23:07:21.244Z https://nickesc.github.io/modpack-lock/functions/generateLicense.html - 2026-02-02T03:38:53.882Z + 2026-02-14T23:07:21.244Z https://nickesc.github.io/modpack-lock/functions/generateLockfile.html - 2026-02-02T03:38:53.882Z + 2026-02-14T23:07:21.244Z https://nickesc.github.io/modpack-lock/functions/generateReadmeFiles.html - 2026-02-02T03:38:53.882Z + 2026-02-14T23:07:21.244Z https://nickesc.github.io/modpack-lock/functions/generateModpackFiles.html - 2026-02-02T03:38:53.882Z + 2026-02-14T23:07:21.244Z https://nickesc.github.io/modpack-lock/functions/promptUserForInfo.html - 2026-02-02T03:38:53.882Z + 2026-02-14T23:07:21.244Z diff --git a/package.json b/package.json index 70f6dae..4cf052e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "modpack-lock", - "version": "0.6.0", + "version": "0.6.1", "description": "Creates a modpack lockfile for files hosted on Modrinth (mods, resource packs, shaders and datapacks)", "bugs": { "url": "https://github.com/nickesc/modpack-lock/issues" diff --git a/src/cli.js b/src/cli.js index c95d437..412e379 100644 --- a/src/cli.js +++ b/src/cli.js @@ -68,7 +68,9 @@ modpackLock } else { // Warn if license option is passed but no modpack.json exists if (options.licenseFile) { - logm.warn(`License generation requires a ${config.MODPACK_JSON_NAME} file. Skipping license generation.`); + logm.warn( + `License generation requires a ${config.MODPACK_JSON_NAME} file. Skipping license generation.`, + ); } // Generate lockfile @@ -98,7 +100,9 @@ modpackLock modpackLock .command("init") - .description(`Initialize a modpack with a ${config.MODPACK_JSON_NAME} file and a ${config.MODPACK_LOCKFILE_NAME} lockfile.`) + .description( + `Initialize a modpack with a ${config.MODPACK_JSON_NAME} file and a ${config.MODPACK_LOCKFILE_NAME} lockfile.`, + ) .optionsGroup(config.headings.options) .option("-f, --folder ", "Path to the modpack directory") .option("-n, --noninteractive", "Non-interactive mode - must provide options for required fields") @@ -169,16 +173,28 @@ modpackLock } else { logm.info(logm.label("modpack-lock"), styleText(["bold", "italic", "blueBright"], "init")); logm.newline(); - logm.info(styleText(["dim"], "This utility will walk you through creating a"), - config.MODPACK_JSON_NAME, + logm.info( + styleText(["dim"], "This utility will walk you through creating a"), + config.MODPACK_JSON_NAME, styleText(["dim"], "file and a"), config.MODPACK_LOCKFILE_NAME, - styleText(["dim"], "lockfile. It only covers the most common items, and tries to guess sensible defaults."), + styleText( + ["dim"], + "lockfile. It only covers the most common items, and tries to guess sensible defaults.", + ), ); logm.newline(); - logm.info(styleText(["dim"], "See"), styleText(["white", "bgGray", "italic"], "modpack-lock init --help"), styleText(["dim"], "for definitive documentation on these fields and exactly what they do.")); + logm.info( + styleText(["dim"], "See"), + styleText(["white", "bgGray", "italic"], "modpack-lock init --help"), + styleText(["dim"], "for definitive documentation on these fields and exactly what they do."), + ); logm.newline(); - logm.info(styleText(["dim"], "Press"), styleText(["yellow"], "^C"), styleText(["dim"], "at any time to quit.")); + logm.info( + styleText(["dim"], "Press"), + styleText(["yellow"], "^C"), + styleText(["dim"], "at any time to quit."), + ); logm.newline(); try { const defaults = { @@ -194,9 +210,13 @@ modpackLock targetModloaderVersion: undefined, targetMinecraftVersion: undefined, }; + const mergedDefaults = mergeModpackInfo(existingInfo, options, defaults); // prompt user for modpack information - const modpackInfo = await promptUserForInfo(mergeModpackInfo(existingInfo, options, defaults)); + const userAnswers = await promptUserForInfo(mergedDefaults); + + // Preserve extra fields (e.g. scripts) from existing modpack.json + const modpackInfo = {...mergedDefaults, ...userAnswers}; // prompt user if they want to add the license text const optionalFiles = await promptUserAboutOptionalFiles(modpackInfo, options);