diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..0d8e632 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,37 @@ +{ + "arrowParens": "always", + "bracketSpacing": false, + "endOfLine": "lf", + "printWidth": 120, + "proseWrap": "preserve", + "quoteProps": "as-needed", + "semi": true, + "singleQuote": false, + "tabWidth": 4, + "trailingComma": "all", + "useTabs": false, + "embeddedLanguageFormatting": "auto", + "objectWrap": "preserve", + "bracketSameLine": false, + "singleAttributePerLine": false, + "parser": "babel", + "overrides": [ + { + "files": [ + "*.txt", + "*.md", + "*.json", + "*.yml", + "*.yaml", + "*.toml", + "*.xml", + "*.html", + "*.csv", + "*.tsv" + ], + "options": { + "tabWidth": 2 + } + } + ] +} diff --git a/docs/assets/navigation.js b/docs/assets/navigation.js index 8b9083f..205eb25 100644 --- a/docs/assets/navigation.js +++ b/docs/assets/navigation.js @@ -1 +1 @@ -window.navigationData = "eJyN0k0KwjAQBeC7ZC0WRLvoARRFEQRX4iKkUx3aTkIygiDeXRF/Ghtjtn1vPtJJdhfBcGZRiJUujVT1nCotBsJIPt4/IjHYSipwWScfHrlt7qUaqRTFaJJfB29mqVVdYQNB4xXGgLVh1OSC888sNj4n5BjRyWPMATi4kOpE6jGc+Q3fysc+1V+K54TX8oUQWMmwcJrCyidPYJaogNyP83iVBGyGjAfSFjanBlzM9JsJ9AZk2cIU/7idWsrPR2/D7yRwz1fw95DdXoQ1VreGtw7sVNtfj69X6oH7G3YwV+8=" \ No newline at end of file +window.navigationData = "eJyN0k0KwjAQBeC7ZC0WRLvoARRFEQRX4iKkUx3aTkIygiDe3R9UGhtjtn1vPugju4tgOLMoxEqXRqp6TpUWA2EkH+8fkRhsJRW4rJMPj9w291KNVIpiNMmvgw+z1KqusIGg8Q5jwNowanLB+1cWO58Tcozo5DHmABwcpDqReh5nfsO38rFP9UfxnPAsXwiBlQwzZDyQtrA5NeDCXqiZQC+cphj4yBOYJSog9+NXvUoKFh3O7yRwG5BlC1P8M12nloC+XsFftduLsMbq1vDWgZ1q++vx9Uo9cH8DEhlX7w==" \ No newline at end of file diff --git a/docs/assets/search.js b/docs/assets/search.js index f9f9c04..c9733cc 100644 --- a/docs/assets/search.js +++ b/docs/assets/search.js @@ -1 +1 @@ -window.searchData = "eJytmtuO2zgMht/FvQ2m0cGZZB6gRRctFijQ3gwGi8BWpm4TO2s73V0M5t1XPsVkSDmM26vWMclflj5RojQvUVn8U0UPjy/RjyxPowcdrxZRvj246CH6VKTHbfLjQ74rokV0Kvf+tyyvXbnbJq56C17ffasPe2+T7LdV5Xy8KHpdDCHVUttzzPYfQbA3vSGIuIiO29Ll9UXLAkI/XVllRS7SGm1ny6WuSsrsWEslsf1s2SwVqbVms0W2p/pbUYqEzqazxY5l8d0l9ZdyLxLszU/l/ldEq+JUJk6q2Vn/ouQ+S1xeyebCaDtb7lCk+2KbOtkwQuvZkvW2fHb1pyHU1xsmZOd6bsVvmJ99Y7LcJeV2V89ozOA6rzEwr34skh+7bM+O/fBOnlEnEh0KdjXLnZsVEHp2uSu3tWNTDpaCpvPE6qLesrMRCw1m80SS4pTX1XWVs908mdQdXZ66PMmcQOzCWiwJCfuzXVhYsf6VnK+0/O/zicULhnrjzcpTGK6hRQGRv0+Zq69qDFazJCrfXfl1jbPZLJHnrM6e86Jk5zbSgZazpEq3Tfm9FNI5m0lFIEcf8qyeYAm8lvO0K/aBZegy3JuzKd922LrQdrPIW4FtUmc/2c4iosRltvg2TT+GV3ki7M2vLfQC0UkCieZ1CgWSYRKJ3hUaJSMaKCDoOE4VEAKhiXWVaF1bWgVy/E6eKE3s5AUiV6oUoiapUiQTIVhA0EkwXUAIxKYLCCIoKCAEopMFBNG8XkAIJCcKCCL4G/LKZAFBBK8XEAJJeQFB9G8sIOSNERQQocZICwhBY/7KvI1Ie7C8RWoF9/w1dwq0O+VJ6/UWG0zuAnBYUgShmKIyaEVrkz8qMCYw4vj61pCXSziN2lvcGvj9sPZ+Pu1BYUDjY8NbZT63S+67bFoDWN3cQ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No8+zDqfFw/ULf57/4/3S/OfT6VuclcnQ9vLy+npsPdwT6D3/OG+G3wmcpV8tHKVeuhVLjOycgtAJCa6nQ8M4Y6GzOOm4JEOn07xXPIvFZIz4lmVgkNXyIPEspoOU2ehIR/IERSC2B1EooBV7SAgDAPeqvz8r0+o+IYFAAACUDYPiMAx4auEladpPAF2wwGHBhSnZFg85Id316OwRuFhC1MgwG0e/NxX23QOq262SmjAF3zcp4GNXGFz9ADuBlZTNwkNufXrJsi8tbB+CIZZNxkDzNbKoIyoSV4fact+zlaqAkZaXtr7ToXgoBMQXEjEyMLadAR8sqc4FmAASsn9my4fg1oho+7YIBAUEtg58hFWCw7kclAwx9sgajAlNSy54dh4ACCCjZ3QYfL846YMnZ9JcnQzNAE1ieZZPm9P4QXBi4rn5ASiZ08bEb3HJQHbSs2DA4KTB9lQwB+BHuLARGs+yvUFZPT+9tj01eb6uaTGPwJGPZHev/5AVcItDQssfH7GIAmVo2gYe/iwEigCMtuxrw9fGsA57Zqr/XMgBCH7fAzYKk9qha2VBDn/GAOLh+dd+Ly55I/2drQAvUQSWrg8yI4FM9Zalh/yUoP25zfygObidQOoXHp9fX/wGI+PsX"; \ No newline at end of file diff --git a/docs/functions/generateGitignoreRules.html b/docs/functions/generateGitignoreRules.html index c53094d..70144f6 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 973fb53..e5f30e1 100644 --- a/docs/functions/generateJson.html +++ b/docs/functions/generateJson.html @@ -1,7 +1,7 @@ -generateJson | modpack-lock
modpack-lock
    Preparing search index...

    Function generateJson

    diff --git a/docs/functions/generateLicense.html b/docs/functions/generateLicense.html index 1d50cdd..368cb6e 100644 --- a/docs/functions/generateLicense.html +++ b/docs/functions/generateLicense.html @@ -1,7 +1,7 @@ -generateLicense | modpack-lock
    modpack-lock
      Preparing search index...

      Function generateLicense

      • Write a license to a file

        +generateLicense | modpack-lock
        modpack-lock
          Preparing search index...

          Function generateLicense

          • Write a license to a file

            Parameters

            • modpackInfo: ModpackInfo

              The modpack information

              -
            • outputPath: string

              The path to write the license to

              +
            • workingDir: string

              The path to write the license to

            • 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 39870e6..0956a56 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 64a1419..a0b4092 100644 --- a/docs/functions/generateModpackFiles.html +++ b/docs/functions/generateModpackFiles.html @@ -1,6 +1,6 @@ -generateModpackFiles | modpack-lock
        modpack-lock
          Preparing search index...

          Function generateModpackFiles

          diff --git a/docs/functions/generateReadmeFiles.html b/docs/functions/generateReadmeFiles.html index 4b2faa0..16bb91c 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 bdfc373..b8f8a60 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 ec21e5d..35e2966 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 7b2b8ef..422fda4 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 2e3575d..f3c0364 100644 --- a/docs/interfaces/InitOptions.html +++ b/docs/interfaces/InitOptions.html @@ -1,9 +1,9 @@ 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;
                      gitignore: boolean;
                      readme: 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

                  -
                  gitignore: boolean

                  Whether to generate .gitignore rules

                  -
                  readme: 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 d979045..e6a1e9e 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 f4cb447..3ae5d0d 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 4db71c6..67cb30e 100644 --- a/docs/interfaces/Options.html +++ b/docs/interfaces/Options.html @@ -1,12 +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;
                        }
                        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

                        -
                        +
                        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/modules.html b/docs/modules.html index 6ac7747..b4fb24c 100644 --- a/docs/modules.html +++ b/docs/modules.html @@ -1 +1 @@ -modpack-lock
                        modpack-lock
                          Preparing search index...

                            modpack-lock

                            Interfaces

                            ModpackInfo
                            Lockfile
                            Options
                            InitOptions

                            Functions

                            getModpackInfo
                            getLockfile
                            generateJson
                            generateLicense
                            generateGitignoreRules
                            generateReadmeFiles
                            generateLockfile
                            generateModpackFiles
                            promptUserForInfo
                            +modpack-lock
                            modpack-lock
                              Preparing search index...

                                modpack-lock

                                Interfaces

                                ModpackInfo
                                Lockfile
                                Options
                                InitOptions

                                Functions

                                getModpackInfo
                                getLockfile
                                generateGitignoreRules
                                generateJson
                                generateLicense
                                generateLockfile
                                generateReadmeFiles
                                generateModpackFiles
                                promptUserForInfo
                                diff --git a/docs/sitemap.xml b/docs/sitemap.xml index afa1f22..01f9056 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -2,66 +2,66 @@ https://nickesc.github.io/modpack-lock/index.html - 2026-01-25T05:04:46.752Z + 2026-02-02T03:38:53.882Z https://nickesc.github.io/modpack-lock/modules.html - 2026-01-25T05:04:46.752Z + 2026-02-02T03:38:53.882Z https://nickesc.github.io/modpack-lock/hierarchy.html - 2026-01-25T05:04:46.752Z + 2026-02-02T03:38:53.882Z https://nickesc.github.io/modpack-lock/interfaces/ModpackInfo.html - 2026-01-25T05:04:46.752Z + 2026-02-02T03:38:53.882Z https://nickesc.github.io/modpack-lock/interfaces/Lockfile.html - 2026-01-25T05:04:46.752Z + 2026-02-02T03:38:53.882Z https://nickesc.github.io/modpack-lock/interfaces/Options.html - 2026-01-25T05:04:46.752Z + 2026-02-02T03:38:53.882Z https://nickesc.github.io/modpack-lock/interfaces/InitOptions.html - 2026-01-25T05:04:46.752Z + 2026-02-02T03:38:53.882Z https://nickesc.github.io/modpack-lock/functions/getModpackInfo.html - 2026-01-25T05:04:46.752Z + 2026-02-02T03:38:53.882Z https://nickesc.github.io/modpack-lock/functions/getLockfile.html - 2026-01-25T05:04:46.752Z + 2026-02-02T03:38:53.882Z + + + https://nickesc.github.io/modpack-lock/functions/generateGitignoreRules.html + 2026-02-02T03:38:53.882Z https://nickesc.github.io/modpack-lock/functions/generateJson.html - 2026-01-25T05:04:46.752Z + 2026-02-02T03:38:53.882Z https://nickesc.github.io/modpack-lock/functions/generateLicense.html - 2026-01-25T05:04:46.752Z + 2026-02-02T03:38:53.882Z - https://nickesc.github.io/modpack-lock/functions/generateGitignoreRules.html - 2026-01-25T05:04:46.752Z + https://nickesc.github.io/modpack-lock/functions/generateLockfile.html + 2026-02-02T03:38:53.882Z https://nickesc.github.io/modpack-lock/functions/generateReadmeFiles.html - 2026-01-25T05:04:46.752Z - - - https://nickesc.github.io/modpack-lock/functions/generateLockfile.html - 2026-01-25T05:04:46.752Z + 2026-02-02T03:38:53.882Z https://nickesc.github.io/modpack-lock/functions/generateModpackFiles.html - 2026-01-25T05:04:46.752Z + 2026-02-02T03:38:53.882Z https://nickesc.github.io/modpack-lock/functions/promptUserForInfo.html - 2026-01-25T05:04:46.752Z + 2026-02-02T03:38:53.882Z diff --git a/package-lock.json b/package-lock.json index 62f663d..ac791bd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "modpack-lock", - "version": "0.4.1", + "version": "0.6.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "modpack-lock", - "version": "0.4.1", + "version": "0.6.0", "license": "MIT", "dependencies": { "commander": "^14.0.2", diff --git a/package.json b/package.json index 5c74a3f..70f6dae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "modpack-lock", - "version": "0.5.1", + "version": "0.6.0", "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 a49fd96..c95d437 100644 --- a/src/cli.js +++ b/src/cli.js @@ -1,48 +1,20 @@ #!/usr/bin/env NODE_OPTIONS=--no-warnings node -import { Command } from 'commander'; -import slugify from 'slugify'; -import path from 'path'; -import { spawn } from 'child_process'; -import {generateLockfile} from './generate_lockfile.js'; -import { generateModpackFiles } from './modpack-lock.js'; -import { promptUserForInfo, promptUserAboutOptionalFiles } from './modpack_info.js'; -import { getModpackInfo } from './directory_scanning.js'; -import generateLicense from './generate_license.js'; -import * as config from './config/index.js'; -import pkg from '../package.json' with { type: 'json' }; - - -const modpackLock = new Command('modpack-lock'); - -const originalLogs = { - log: console.log, - info: console.info, - warn: console.warn, - error: console.error, -}; +import {Command} from "commander"; +import slugify from "slugify"; +import path from "path"; +import {spawn} from "child_process"; +import {generateLockfile, printLockfileSummary} from "./generate_lockfile.js"; +import {generateReadmeFiles} from "./generate_readme.js"; +import {generateGitignoreRules} from "./generate_gitignore.js"; +import {generateModpackFiles} from "./modpack-lock.js"; +import {promptUserForInfo, promptUserAboutOptionalFiles} from "./modpack_info.js"; +import {getModpackInfo} from "./directory_scanning.js"; +import * as config from "./config/index.js"; +import pkg from "../package.json" with {type: "json"}; +import {logm, styleText} from "./logger.js"; -/** - * Silence all console.log output - */ -function quietConsole(silent = false) { - console.log = () => { }; - console.info = () => { }; - if (silent) { - console.warn = () => { }; - console.error = () => { }; - } -} - -/** - * Restore the console's original functions - */ -function restoreConsole() { - console.log = originalLogs.log; - console.info = originalLogs.info; - console.warn = originalLogs.warn; - console.error = originalLogs.error; -} +const modpackLock = new Command("modpack-lock"); /** * Merge modpack info with priority: options > existingInfo > defaults @@ -71,61 +43,80 @@ modpackLock .description(pkg.description) .summary("Create a modpack lockfile") .optionsGroup(config.headings.options) - .option('-p, --path ', 'Path to the modpack directory') - .option('-d, --dry-run', 'Dry-run mode - no files will be written') + .option("-p, --path ", "Path to the modpack directory") + .option("-d, --dry-run", "Dry-run mode - no files will be written") .optionsGroup(config.headings.generation) - .option('-g, --gitignore', config.fileFields.addGitignore.option) - .option('-r, --readme', config.fileFields.addReadme.option) + .option("-l, --licenseFile", config.fileFields.addLicense.option) + .option("-g, --gitignore", config.fileFields.addGitignore.option) + .option("-r, --readme", config.fileFields.addReadme.option) .optionsGroup(config.headings.logging) - .option('-q, --quiet', 'Quiet mode - only show errors and warnings') - .option('-s, --silent', 'Silent mode - no output') + .option("-q, --quiet", "Quiet mode - only show errors and warnings") + .option("-s, --silent", "Silent mode - no output") .optionsGroup(config.headings.information) .helpOption("-h, --help", `display help for ${pkg.name}`) - .version(pkg.version, '-V') + .version(pkg.version, "-V") .action(async (options) => { try { const currDir = options.path || process.cwd(); - if (options.quiet) { - quietConsole(); - } else if (options.silent) { - quietConsole(true); - } + logm.quietFromOptions(options); const modpackInfo = await getModpackInfo(currDir); if (modpackInfo) { - await generateModpackFiles(modpackInfo, currDir, options); + const lockfile = await generateModpackFiles(modpackInfo, currDir, options); + printLockfileSummary(lockfile); } else { - await generateLockfile(currDir, options); + // 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.`); + } + + // Generate lockfile + const lockfile = await generateLockfile(currDir, options); + + if (options.gitignore || options.readme) { + logm.header("Generating Optional Files"); + } + + // Generate gitignore if requested + if (options.gitignore) { + await generateGitignoreRules(lockfile, currDir, options); + } + + // Generate README files if requested + if (options.readme) { + await generateReadmeFiles(lockfile, currDir, options); + } + + printLockfileSummary(lockfile); } } catch (error) { - console.error('Error:', error); + logm.error(error); process.exitCode = 1; } }); -const jsonDescription = `This utility will walk you through creating a ${config.MODPACK_JSON_NAME} file. It only covers the most common items, and tries to guess sensible defaults.`; - -modpackLock.command('init') - .description(jsonDescription) +modpackLock + .command("init") + .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') - .option('--add-license', config.fileFields.addLicense.option) - .option('--add-gitignore', config.fileFields.addGitignore.option) - .option('--add-readme', config.fileFields.addReadme.option) + .option("-f, --folder ", "Path to the modpack directory") + .option("-n, --noninteractive", "Non-interactive mode - must provide options for required fields") + .option("--add-license", config.fileFields.addLicense.option) + .option("--add-gitignore", config.fileFields.addGitignore.option) + .option("--add-readme", config.fileFields.addReadme.option) .optionsGroup(config.headings.packInfo) - .option('--name ', config.infoFields.name.option) - .option('--version ', config.infoFields.version.option) - .option('--id ', config.infoFields.id.option) - .option('--description ', config.infoFields.description.option) - .option('--author ', config.infoFields.author.option) - .option('--projectUrl ', config.infoFields.projectUrl.option) - .option('--sourceUrl ', config.infoFields.sourceUrl.option) - .option('--license ', config.infoFields.license.option) - .option('--modloader ', config.infoFields.modloader.option) - .option('--targetModloaderVersion ', config.infoFields.targetModloaderVersion.option) - .option('--targetMinecraftVersion ', config.infoFields.targetMinecraftVersion.option) + .option("--name ", config.infoFields.name.option) + .option("--version ", config.infoFields.version.option) + .option("--id ", config.infoFields.id.option) + .option("--description ", config.infoFields.description.option) + .option("--author ", config.infoFields.author.option) + .option("--projectUrl ", config.infoFields.projectUrl.option) + .option("--sourceUrl ", config.infoFields.sourceUrl.option) + .option("--license ", config.infoFields.license.option) + .option("--modloader ", config.infoFields.modloader.option) + .option("--targetModloaderVersion ", config.infoFields.targetModloaderVersion.option) + .option("--targetMinecraftVersion ", config.infoFields.targetMinecraftVersion.option) .optionsGroup(config.headings.information) .helpOption("-h, --help", `display help for ${pkg.name} init`) .action(async (options) => { @@ -135,9 +126,13 @@ modpackLock.command('init') let existingInfo = await getModpackInfo(currDir); if (options.noninteractive) { - quietConsole(); - if ( (!options.author && !existingInfo?.author) || (!options.modloader && !existingInfo?.modloader) || (!options.targetMinecraftVersion && !existingInfo?.targetMinecraftVersion)) { - console.error('Error: Must provide options for required fields'); + logm.quiet(); + if ( + (!options.author && !existingInfo?.author) || + (!options.modloader && !existingInfo?.modloader) || + (!options.targetMinecraftVersion && !existingInfo?.targetMinecraftVersion) + ) { + logm.error("Must provide options for required fields"); process.exitCode = 1; return; } else { @@ -146,38 +141,45 @@ modpackLock.command('init') name: defaultName, version: config.DEFAULT_MODPACK_VERSION, id: defaultName, - description: '', + description: "", author: options.author, // Required, no default - projectUrl: '', - sourceUrl: '', - license: '', + projectUrl: "", + sourceUrl: "", + license: "", modloader: options.modloader, // Required, no default - targetModloaderVersion: '', + targetModloaderVersion: "", targetMinecraftVersion: options.targetMinecraftVersion, // Required, no default }; const modpackInfo = mergeModpackInfo(existingInfo, options, defaults); modpackInfo.id = slugify(modpackInfo.id, config.SLUGIFY_OPTIONS); - if (options.addLicense) { - await generateLicense(modpackInfo, currDir, options); - } - options.readme = options.addReadme; options.gitignore = options.addGitignore; + options.licenseFile = options.addLicense; // generate the modpack files try { await generateModpackFiles(modpackInfo, currDir, options); } catch (error) { - console.error('Error:', error); + logm.error(error); process.exitCode = 1; } } } else { - console.log(jsonDescription); - console.log("\nSee `modpack-lock init --help` for definitive documentation on these fields and exactly what they do.\n"); - console.log("Press ^C at any time to quit.\n"); + 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, + 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."), + ); + 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.newline(); + logm.info(styleText(["dim"], "Press"), styleText(["yellow"], "^C"), styleText(["dim"], "at any time to quit.")); + logm.newline(); try { const defaults = { name: path.basename(currDir), @@ -194,35 +196,34 @@ modpackLock.command('init') }; // prompt user for modpack information - const modpackInfo = await promptUserForInfo( - mergeModpackInfo(existingInfo, options, defaults) - ); + const modpackInfo = await promptUserForInfo(mergeModpackInfo(existingInfo, options, defaults)); // prompt user if they want to add the license text const optionalFiles = await promptUserAboutOptionalFiles(modpackInfo, options); - console.log(); - if (options.addLicense || optionalFiles.addLicense) { - await generateLicense(modpackInfo, currDir, options); - } - console.log(); + + logm.newline(); // generate the modpack files options.readme = optionalFiles.addReadme; options.gitignore = optionalFiles.addGitignore; - await generateModpackFiles(modpackInfo, currDir, options); + options.licenseFile = optionalFiles.addLicense; + const lockfile = await generateModpackFiles(modpackInfo, currDir, options); + + printLockfileSummary(lockfile); } catch (error) { - console.error('Error:', error); + logm.error(error); process.exitCode = 1; } } }); -modpackLock.command('run') +modpackLock + .command("run") .description(`Run a script defined in the ${config.MODPACK_JSON_NAME} file's 'scripts' field`) - .argument('