fork-version 4.1.4 → 4.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/config/cli-arguments.js","../src/cli.ts"],"names":[],"mappings":";;;;;;;AAMO,IAAM,UAAA,GAAa,CAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA,yCAAA,CAAA;AA6EnB,SAAS,eAAA,GAAkB;AACjC,EAAA,OAAO,KAAK,UAAA,EAAY;AAAA,IACvB,UAAA,EAAY,MAAA,CAAA,IAAA;AAAA,IACZ,cAAA,EAAgB,MAAA;AAAA,IAChB,UAAA,EAAY,CAAA;AAAA,IACZ,KAAA,EAAO;AAAA;AAAA;AAAA,MAGN,cAAA,EAAgB,EAAE,IAAA,EAAM,SAAA,EAAU;AAAA;AAAA,MAGlC,KAAA,EAAO,EAAE,IAAA,EAAM,QAAA,EAAU,UAAA,EAAY,IAAA,EAAM,OAAA,EAAS,CAAC,MAAM,CAAA,EAAG,SAAA,EAAW,GAAA,EAAI;AAAA,MAC7E,IAAA,EAAM,EAAE,IAAA,EAAM,QAAA,EAAU,WAAW,GAAA,EAAI;AAAA,MACvC,IAAA,EAAM,EAAE,IAAA,EAAM,QAAA,EAAU,WAAW,GAAA,EAAI;AAAA,MACvC,SAAA,EAAW,EAAE,IAAA,EAAM,QAAA,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,IAAI,KAAA,CAAM,iBAAiB,QAAA,EAAU;AACpC,MAAA,OAAA,CAAQ,KAAA,CAAM,MAAM,OAAO,CAAA;AAC3B,MAAA,KAAA,MAAW,GAAA,IAAO,KAAA,CAAM,KAAA,CAAM,MAAA,EAAQ;AACrC,QAAA,OAAA,CAAQ,GAAA,CAAI,CAAA,EAAG,GAAA,CAAI,IAAA,CAAK,IAAA,CAAK,IAAI,CAAC,CAAA,IAAA,EAAO,GAAA,CAAI,OAAO,CAAA,CAAE,CAAA;AAAA,MACvD;AACA,MAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,IACf;AAEA,IAAA,OAAA,CAAQ,KAAA,CAAM,MAAM,OAAO,CAAA;AAC3B,IAAA,IAAI,KAAA,CAAM,KAAA,EAAO,OAAA,CAAQ,KAAA,CAAM,MAAM,KAAK,CAAA;AAAA,EAC3C,CAAA,MAAO;AACN,IAAA,OAAA,CAAQ,MAAM,KAAK,CAAA;AAAA,EACpB;AACA,EAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AACf,CAAC,CAAA","file":"cli.js","sourcesContent":["import meow from \"meow\";\n//@ts-check\n\n// This file is javascript so the following helper text can be extracted to the readme\n// without the need for a build step, otherwise it would also be typescript...\n\nexport const helperText = `Usage:\n $ fork-version [command?] [options?]\n\nCommands:\n main Bumps the version, update files, generate changelog, commit, and tag. [Default when no command is provided]\n inspect-version Prints the current version and exits.\n inspect-tag Prints the current git tag and exits.\n validate-config Validates the configuration and exits.\n\nGeneral Options:\n --version Show the current version of Fork-Version and exit.\n --help Show this help message and exit.\n\nLocation Options:\n --file, -F List of the files to be updated. [Default: [\"bower.json\", \"deno.json\", \"deno.jsonc\", \"jsr.json\", \"jsr.jsonc\", \"manifest.json\", \"npm-shrinkwrap.json\", \"package-lock.json\", \"package.json\"]]\n --glob, -G Glob pattern to match files to be updated.\n --path, -P The path Fork-Version will run from. [Default: process.cwd()]\n\nOptions:\n --changelog Name of the changelog file. [Default: \"CHANGELOG.md\"]\n --header The header text for the changelog.\n --tag-prefix Specify a prefix for the created tag. [Default: \"v\"]\n --pre-release Mark this release as a pre-release.\n --pre-release-tag Mark this release with a tagged pre-release. [Example: \"alpha\", \"beta\", \"rc\"]\n --current-version If set, Fork-Version will use this version instead of trying to determine one.\n --next-version If set, Fork-Version will attempt to update to this version, instead of incrementing using \"conventional-commit\".\n --release-as Release as increments the version by the specified level. [Choices: \"major\", \"minor\", \"patch\"]\n\nFlags:\n --allow-multiple-versions Don't throw an error if multiple versions are found in the given files. [Default: true]\n --commit-all Commit all changes, not just files updated by Fork-Version.\n --changelog-all If this flag is set, all default commit types will be added to the changelog.\n --debug Output debug information.\n --dry-run No output will be written to disk or committed.\n --silent Run without logging to the terminal.\n --git-tag-fallback If unable to find a version in the given files, fallback and attempt to use the latest git tag. [Default: true]\n --sign If true, git will sign the commit with the systems GPG key.\n --verify If true, git will run user defined git hooks before committing.\n\n To negate a flag you can prefix it with \"no-\", for example \"--no-git-tag-fallback\" will not fallback to the latest git tag.\n\nSkip Steps:\n --skip-bump Skip the version bump step.\n --skip-changelog Skip updating the changelog.\n --skip-commit Skip committing the changes.\n --skip-tag Skip tagging the commit.\n\nConventional Changelog Overrides:\n --commit-url-format Override the default commit URL format.\n --compare-url-format Override the default compare URL format.\n --issue-url-format Override the default issue URL format.\n --user-url-format Override the default user URL format.\n --release-commit-message-format Override the default release commit message format.\n --release-message-suffix Add a suffix to the end of the release message.\n\nExit Codes:\n 0: Success\n 1: General Error\n 2: Unknown Command\n 3: Config File Validation Error\n\nExamples:\n $ fork-version\n Run fork-version in the current directory with default options.\n\n $ fork-version --path ./packages/my-package\n Run fork-version in the \"./packages/my-package\" directory.\n\n $ fork-version --file package.json --file MyApi.csproj\n Run fork-version and update the \"package.json\" and \"MyApi.csproj\" files.\n\n $ fork-version --glob \"*/package.json\"\n Run fork-version and update all \"package.json\" files in subdirectories.\n\n $ fork-version inspect-version\n Prints the current version and exits.`;\n\nexport function getCliArguments() {\n\treturn meow(helperText, {\n\t\timportMeta: import.meta,\n\t\tbooleanDefault: undefined,\n\t\thelpIndent: 0,\n\t\tflags: {\n\t\t\t// Commands\n\t\t\t/** @deprecated Set the `inspect-version` command instead. */\n\t\t\tinspectVersion: { type: \"boolean\" },\n\n\t\t\t// Options\n\t\t\tfiles: { type: \"string\", isMultiple: true, aliases: [\"file\"], shortFlag: \"F\" },\n\t\t\tglob: { type: \"string\", shortFlag: \"G\" },\n\t\t\tpath: { type: \"string\", shortFlag: \"P\" },\n\t\t\tchangelog: { type: \"string\" },\n\t\t\theader: { type: \"string\" },\n\t\t\ttagPrefix: { type: \"string\" },\n\t\t\tpreRelease: { type: \"boolean\" },\n\t\t\tpreReleaseTag: { type: \"string\" },\n\t\t\tcurrentVersion: { type: \"string\" },\n\t\t\tnextVersion: { type: \"string\" },\n\t\t\treleaseAs: { type: \"string\", choices: [\"major\", \"minor\", \"patch\"] },\n\n\t\t\t// Flags\n\t\t\tallowMultipleVersions: { type: \"boolean\" },\n\t\t\tcommitAll: { type: \"boolean\" },\n\t\t\tchangelogAll: { type: \"boolean\" },\n\t\t\tdebug: { type: \"boolean\" },\n\t\t\tdryRun: { type: \"boolean\" },\n\t\t\tsilent: { type: \"boolean\" },\n\t\t\tgitTagFallback: { type: \"boolean\" },\n\t\t\tsign: { type: \"boolean\" },\n\t\t\tverify: { type: \"boolean\" },\n\n\t\t\t// Skip Steps\n\t\t\tskipBump: { type: \"boolean\" },\n\t\t\tskipChangelog: { type: \"boolean\" },\n\t\t\tskipCommit: { type: \"boolean\" },\n\t\t\tskipTag: { type: \"boolean\" },\n\n\t\t\t// Changelog Overrides\n\t\t\tcommitUrlFormat: { type: \"string\" },\n\t\t\tcompareUrlFormat: { type: \"string\" },\n\t\t\tissueUrlFormat: { type: \"string\" },\n\t\t\tuserUrlFormat: { type: \"string\" },\n\t\t\treleaseCommitMessageFormat: { type: \"string\" },\n\t\t\treleaseMessageSuffix: { type: \"string\" },\n\t\t},\n\t});\n}\n","#!/usr/bin/env node\n\nimport { writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { ZodError } from \"zod\";\n\nimport { getCliArguments } from \"./config/cli-arguments\";\nimport { getUserConfig } from \"./config/user-config\";\nimport { Logger } from \"./services/logger\";\nimport { FileManager } from \"./files/file-manager\";\nimport { Git } from \"./services/git\";\n\nimport { validateConfig } from \"./commands/validate-config\";\nimport { inspectVersion } from \"./commands/inspect-version\";\nimport { inspectTag } from \"./commands/inspect-tag\";\nimport { main } from \"./commands/main\";\n\nasync function runFork() {\n\tconst startTime = Date.now();\n\n\tconst cliArguments = getCliArguments();\n\tconst config = await getUserConfig(cliArguments);\n\tconst logger = new Logger(config);\n\tconst fileManager = new FileManager(config, logger);\n\tconst git = new Git(config);\n\n\tswitch (config.command) {\n\t\tcase \"validate-config\": {\n\t\t\tvalidateConfig(config);\n\t\t\tbreak;\n\t\t}\n\n\t\tcase \"inspect-version\": {\n\t\t\tawait inspectVersion(config, logger, fileManager, git);\n\t\t\tbreak;\n\t\t}\n\n\t\tcase \"inspect-tag\": {\n\t\t\tawait inspectTag(config, git);\n\t\t\tbreak;\n\t\t}\n\n\t\tcase \"main\": {\n\t\t\tconst result = await main(config, logger, fileManager, git);\n\n\t\t\t//#region Post-run instructions\n\t\t\tconst branchName = await git.getBranchName();\n\t\t\tlogger.log(\n\t\t\t\t`\\nRun \\`git push --follow-tags origin ${branchName}\\` to push the changes and the tag.`,\n\t\t\t);\n\n\t\t\tif (result.current.files.some((file) => file.name === \"package.json\" && !file.isPrivate)) {\n\t\t\t\tconst npmTag = typeof config.preRelease === \"string\" ? config.preRelease : \"prerelease\";\n\t\t\t\tlogger.log(\n\t\t\t\t\t`${result.next.releaseType}`.startsWith(\"pre\")\n\t\t\t\t\t\t? `Run \\`npm publish --tag ${npmTag}\\` to publish the package.`\n\t\t\t\t\t\t: \"Run `npm publish` to publish the package.\",\n\t\t\t\t);\n\t\t\t}\n\t\t\t//#endregion Post-run instructions\n\n\t\t\tif (!config.dryRun && config.debug) {\n\t\t\t\twriteFileSync(\n\t\t\t\t\tjoin(config.path, `fork-version-${Date.now()}.debug-log.json`),\n\t\t\t\t\tJSON.stringify(result, null, 2),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tbreak;\n\t\t}\n\n\t\tdefault: {\n\t\t\tlogger.error(`Unknown command: ${config.command}`);\n\t\t\tprocess.exit(2);\n\t\t}\n\t}\n\n\tlogger.debug(`Completed in ${Date.now() - startTime} ms`);\n}\n\nrunFork().catch((error) => {\n\tif (error instanceof Error) {\n\t\t// If the error is a ZodError, print the keys that failed validation\n\t\tif (error.cause instanceof ZodError) {\n\t\t\tconsole.error(error.message);\n\t\t\tfor (const err of error.cause.issues) {\n\t\t\t\tconsole.log(`${err.path.join(\", \")} => ${err.message}`);\n\t\t\t}\n\t\t\tprocess.exit(3);\n\t\t}\n\n\t\tconsole.error(error.message);\n\t\tif (error.stack) console.error(error.stack);\n\t} else {\n\t\tconsole.error(error);\n\t}\n\tprocess.exit(1);\n});\n"]}
1
+ {"version":3,"sources":["../src/config/cli-arguments.js","../src/cli.ts"],"names":[],"mappings":";;;;;;;AAMO,IAAM,UAAA,GAAa,CAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA,yCAAA,CAAA;AA+EnB,SAAS,eAAA,GAAkB;AACjC,EAAA,OAAO,KAAK,UAAA,EAAY;AAAA,IACvB,UAAA,EAAY,MAAA,C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extracted to the readme\n// without the need for a build step, otherwise it would also be typescript...\n\nexport const helperText = `Usage:\n $ fork-version [command?] [options?]\n\nCommands:\n main Bumps the version, update files, generate changelog, commit, and tag. [Default when no command is provided]\n inspect Print the current version and git tag, then exits.\n inspect-version Print the current version then exits.\n inspect-tag Print the current git tag then exits.\n validate-config Validates the configuration and exits.\n\nGeneral Options:\n --version Show the current version of Fork-Version and exit.\n --help Show this help message and exit.\n\nLocation Options:\n --file, -F List of the files to be updated. [Default: [\"bower.json\", \"deno.json\", \"deno.jsonc\", \"jsr.json\", \"jsr.jsonc\", \"manifest.json\", \"npm-shrinkwrap.json\", \"package-lock.json\", \"package.json\"]]\n --glob, -G Glob pattern to match files to be updated.\n --path, -P The path Fork-Version will run from. [Default: process.cwd()]\n\nOptions:\n --changelog Name of the changelog file. [Default: \"CHANGELOG.md\"]\n --header The header text for the changelog.\n --tag-prefix Specify a prefix for the created tag. [Default: \"v\"]\n --pre-release Mark this release as a pre-release.\n --pre-release-tag Mark this release with a tagged pre-release. [Example: \"alpha\", \"beta\", \"rc\"]\n --current-version If set, Fork-Version will use this version instead of trying to determine one.\n --next-version If set, Fork-Version will attempt to update to this version, instead of incrementing using \"conventional-commit\".\n --release-as Release as increments the version by the specified level. [Choices: \"major\", \"minor\", \"patch\"]\n\nFlags:\n --allow-multiple-versions Don't throw an error if multiple versions are found in the given files. [Default: true]\n --commit-all Commit all changes, not just files updated by Fork-Version.\n --changelog-all If this flag is set, all default commit types will be added to the changelog.\n --debug Output debug information.\n --dry-run No output will be written to disk or committed.\n --silent Run without logging to the terminal.\n --git-tag-fallback If unable to find a version in the given files, fallback and attempt to use the latest git tag. [Default: true]\n --sign If true, git will sign the commit with the systems GPG key.\n --verify If true, git will run user defined git hooks before committing.\n --as-json Output the result as JSON.\n\n To negate a flag you can prefix it with \"no-\", for example \"--no-git-tag-fallback\" will not fallback to the latest git tag.\n\nSkip Steps:\n --skip-bump Skip the version bump step.\n --skip-changelog Skip updating the changelog.\n --skip-commit Skip committing the changes.\n --skip-tag Skip tagging the commit.\n\nConventional Changelog Overrides:\n --commit-url-format Override the default commit URL format.\n --compare-url-format Override the default compare URL format.\n --issue-url-format Override the default issue URL format.\n --user-url-format Override the default user URL format.\n --release-commit-message-format Override the default release commit message format.\n --release-message-suffix Add a suffix to the end of the release message.\n\nExit Codes:\n 0: Success\n 1: General Error\n 2: Unknown Command\n 3: Config File Validation Error\n\nExamples:\n $ fork-version\n Run fork-version in the current directory with default options.\n\n $ fork-version --path ./packages/my-package\n Run fork-version in the \"./packages/my-package\" directory.\n\n $ fork-version --file package.json --file MyApi.csproj\n Run fork-version and update the \"package.json\" and \"MyApi.csproj\" files.\n\n $ fork-version --glob \"*/package.json\"\n Run fork-version and update all \"package.json\" files in subdirectories.\n\n $ fork-version inspect-version\n Prints the current version and exits.`;\n\nexport function getCliArguments() {\n\treturn meow(helperText, {\n\t\timportMeta: import.meta,\n\t\tbooleanDefault: undefined,\n\t\thelpIndent: 0,\n\t\tflags: {\n\t\t\t// Commands\n\t\t\t/** @deprecated Set the `inspect-version` command instead. */\n\t\t\tinspectVersion: { type: \"boolean\" },\n\n\t\t\t// Options\n\t\t\tfiles: { type: \"string\", isMultiple: true, aliases: [\"file\"], shortFlag: \"F\" },\n\t\t\tglob: { type: \"string\", shortFlag: \"G\" },\n\t\t\tpath: { type: \"string\", shortFlag: \"P\" },\n\t\t\tchangelog: { type: \"string\" },\n\t\t\theader: { type: \"string\" },\n\t\t\ttagPrefix: { type: \"string\" },\n\t\t\tpreRelease: { type: \"boolean\" },\n\t\t\tpreReleaseTag: { type: \"string\" },\n\t\t\tcurrentVersion: { type: \"string\" },\n\t\t\tnextVersion: { type: \"string\" },\n\t\t\treleaseAs: { type: \"string\", choices: [\"major\", \"minor\", \"patch\"] },\n\n\t\t\t// Flags\n\t\t\tallowMultipleVersions: { type: \"boolean\" },\n\t\t\tcommitAll: { type: \"boolean\" },\n\t\t\tchangelogAll: { type: \"boolean\" },\n\t\t\tdebug: { type: \"boolean\" },\n\t\t\tdryRun: { type: \"boolean\" },\n\t\t\tsilent: { type: \"boolean\" },\n\t\t\tgitTagFallback: { type: \"boolean\" },\n\t\t\tsign: { type: \"boolean\" },\n\t\t\tverify: { type: \"boolean\" },\n\t\t\tasJson: { type: \"boolean\" },\n\n\t\t\t// Skip Steps\n\t\t\tskipBump: { type: \"boolean\" },\n\t\t\tskipChangelog: { type: \"boolean\" },\n\t\t\tskipCommit: { type: \"boolean\" },\n\t\t\tskipTag: { type: \"boolean\" },\n\n\t\t\t// Changelog Overrides\n\t\t\tcommitUrlFormat: { type: \"string\" },\n\t\t\tcompareUrlFormat: { type: \"string\" },\n\t\t\tissueUrlFormat: { type: \"string\" },\n\t\t\tuserUrlFormat: { type: \"string\" },\n\t\t\treleaseCommitMessageFormat: { type: \"string\" },\n\t\t\treleaseMessageSuffix: { type: \"string\" },\n\t\t},\n\t});\n}\n","#!/usr/bin/env node\n\nimport { writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { ZodError } from \"zod\";\n\nimport { getCliArguments } from \"./config/cli-arguments\";\nimport { getUserConfig } from \"./config/user-config\";\nimport { Logger } from \"./services/logger\";\nimport { FileManager } from \"./files/file-manager\";\nimport { Git } from \"./services/git\";\n\nimport { validateConfig } from \"./commands/validate-config\";\nimport { inspect } from \"./commands/inspect\";\nimport { main } from \"./commands/main\";\n\nasync function runFork() {\n\tconst startTime = Date.now();\n\n\tconst cliArguments = getCliArguments();\n\tconst config = await getUserConfig(cliArguments);\n\tconst logger = new Logger(config);\n\tconst fileManager = new FileManager(config, logger);\n\tconst git = new Git(config);\n\n\tswitch (config.command) {\n\t\tcase \"validate-config\": {\n\t\t\tvalidateConfig(config);\n\t\t\tbreak;\n\t\t}\n\n\t\tcase \"inspect-version\":\n\t\tcase \"inspect-tag\":\n\t\tcase \"inspect\": {\n\t\t\tawait inspect(config, logger, fileManager, git);\n\t\t\tbreak;\n\t\t}\n\n\t\tcase \"main\": {\n\t\t\tconst result = await main(config, logger, fileManager, git);\n\n\t\t\t//#region Post-run instructions\n\t\t\tconst branchName = await git.getBranchName();\n\t\t\tlogger.log(\n\t\t\t\t`\\nRun \\`git push --follow-tags origin ${branchName}\\` to push the changes and the tag.`,\n\t\t\t);\n\n\t\t\tif (result.current.files.some((file) => file.name === \"package.json\" && !file.isPrivate)) {\n\t\t\t\tconst npmTag = typeof config.preRelease === \"string\" ? config.preRelease : \"prerelease\";\n\t\t\t\tlogger.log(\n\t\t\t\t\t`${result.next.releaseType}`.startsWith(\"pre\")\n\t\t\t\t\t\t? `Run \\`npm publish --tag ${npmTag}\\` to publish the package.`\n\t\t\t\t\t\t: \"Run `npm publish` to publish the package.\",\n\t\t\t\t);\n\t\t\t}\n\t\t\t//#endregion Post-run instructions\n\n\t\t\tif (!config.dryRun && config.debug) {\n\t\t\t\twriteFileSync(\n\t\t\t\t\tjoin(config.path, `fork-version-${Date.now()}.debug-log.json`),\n\t\t\t\t\tJSON.stringify(result, null, 2),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tbreak;\n\t\t}\n\n\t\tdefault: {\n\t\t\tlogger.error(`Unknown command: ${config.command}`);\n\t\t\tprocess.exit(2);\n\t\t}\n\t}\n\n\tlogger.debug(`Completed in ${Date.now() - startTime} ms`);\n}\n\nrunFork().catch((error) => {\n\tif (error instanceof Error) {\n\t\t// If the error is a ZodError, print the keys that failed validation\n\t\tif (error.cause instanceof ZodError) {\n\t\t\tconsole.error(error.message);\n\t\t\tfor (const err of error.cause.issues) {\n\t\t\t\tconsole.log(`${err.path.join(\", \")} => ${err.message}`);\n\t\t\t}\n\t\t\tprocess.exit(3);\n\t\t}\n\n\t\tconsole.error(error.message);\n\t\tif (error.stack) console.error(error.stack);\n\t} else {\n\t\tconsole.error(error);\n\t}\n\tprocess.exit(1);\n});\n"]}
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkCISRFIID_cjs = require('./chunk-CISRFIID.cjs');
3
+ var chunkKRGBUNRK_cjs = require('./chunk-KRGBUNRK.cjs');
4
4
 
5
5
  // src/config/define-config.ts
6
6
  function defineConfig(config) {
@@ -9,75 +9,71 @@ function defineConfig(config) {
9
9
 
10
10
  Object.defineProperty(exports, "CommitParser", {
11
11
  enumerable: true,
12
- get: function () { return chunkCISRFIID_cjs.CommitParser; }
12
+ get: function () { return chunkKRGBUNRK_cjs.CommitParser; }
13
13
  });
14
14
  Object.defineProperty(exports, "FileManager", {
15
15
  enumerable: true,
16
- get: function () { return chunkCISRFIID_cjs.FileManager; }
16
+ get: function () { return chunkKRGBUNRK_cjs.FileManager; }
17
17
  });
18
18
  Object.defineProperty(exports, "ForkConfigSchema", {
19
19
  enumerable: true,
20
- get: function () { return chunkCISRFIID_cjs.ForkConfigSchema; }
20
+ get: function () { return chunkKRGBUNRK_cjs.ForkConfigSchema; }
21
21
  });
22
22
  Object.defineProperty(exports, "Git", {
23
23
  enumerable: true,
24
- get: function () { return chunkCISRFIID_cjs.Git; }
24
+ get: function () { return chunkKRGBUNRK_cjs.Git; }
25
25
  });
26
26
  Object.defineProperty(exports, "Logger", {
27
27
  enumerable: true,
28
- get: function () { return chunkCISRFIID_cjs.Logger; }
28
+ get: function () { return chunkKRGBUNRK_cjs.Logger; }
29
29
  });
30
30
  Object.defineProperty(exports, "commitChanges", {
31
31
  enumerable: true,
32
- get: function () { return chunkCISRFIID_cjs.commitChanges; }
32
+ get: function () { return chunkKRGBUNRK_cjs.commitChanges; }
33
33
  });
34
34
  Object.defineProperty(exports, "createParserOptions", {
35
35
  enumerable: true,
36
- get: function () { return chunkCISRFIID_cjs.createParserOptions; }
36
+ get: function () { return chunkKRGBUNRK_cjs.createParserOptions; }
37
37
  });
38
38
  Object.defineProperty(exports, "filterRevertedCommits", {
39
39
  enumerable: true,
40
- get: function () { return chunkCISRFIID_cjs.filterRevertedCommits; }
40
+ get: function () { return chunkKRGBUNRK_cjs.filterRevertedCommits; }
41
41
  });
42
42
  Object.defineProperty(exports, "getCommitsSinceTag", {
43
43
  enumerable: true,
44
- get: function () { return chunkCISRFIID_cjs.getCommitsSinceTag; }
44
+ get: function () { return chunkKRGBUNRK_cjs.getCommitsSinceTag; }
45
45
  });
46
46
  Object.defineProperty(exports, "getCurrentVersion", {
47
47
  enumerable: true,
48
- get: function () { return chunkCISRFIID_cjs.getCurrentVersion; }
48
+ get: function () { return chunkKRGBUNRK_cjs.getCurrentVersion; }
49
49
  });
50
50
  Object.defineProperty(exports, "getNextVersion", {
51
51
  enumerable: true,
52
- get: function () { return chunkCISRFIID_cjs.getNextVersion; }
52
+ get: function () { return chunkKRGBUNRK_cjs.getNextVersion; }
53
53
  });
54
54
  Object.defineProperty(exports, "getUserConfig", {
55
55
  enumerable: true,
56
- get: function () { return chunkCISRFIID_cjs.getUserConfig; }
56
+ get: function () { return chunkKRGBUNRK_cjs.getUserConfig; }
57
57
  });
58
- Object.defineProperty(exports, "inspectTag", {
58
+ Object.defineProperty(exports, "inspect", {
59
59
  enumerable: true,
60
- get: function () { return chunkCISRFIID_cjs.inspectTag; }
61
- });
62
- Object.defineProperty(exports, "inspectVersion", {
63
- enumerable: true,
64
- get: function () { return chunkCISRFIID_cjs.inspectVersion; }
60
+ get: function () { return chunkKRGBUNRK_cjs.inspect; }
65
61
  });
66
62
  Object.defineProperty(exports, "main", {
67
63
  enumerable: true,
68
- get: function () { return chunkCISRFIID_cjs.main; }
64
+ get: function () { return chunkKRGBUNRK_cjs.main; }
69
65
  });
70
66
  Object.defineProperty(exports, "tagChanges", {
71
67
  enumerable: true,
72
- get: function () { return chunkCISRFIID_cjs.tagChanges; }
68
+ get: function () { return chunkKRGBUNRK_cjs.tagChanges; }
73
69
  });
74
70
  Object.defineProperty(exports, "updateChangelog", {
75
71
  enumerable: true,
76
- get: function () { return chunkCISRFIID_cjs.updateChangelog; }
72
+ get: function () { return chunkKRGBUNRK_cjs.updateChangelog; }
77
73
  });
78
74
  Object.defineProperty(exports, "validateConfig", {
79
75
  enumerable: true,
80
- get: function () { return chunkCISRFIID_cjs.validateConfig; }
76
+ get: function () { return chunkKRGBUNRK_cjs.validateConfig; }
81
77
  });
82
78
  exports.defineConfig = defineConfig;
83
79
  //# sourceMappingURL=index.cjs.map
package/dist/index.d.cts CHANGED
@@ -3,7 +3,7 @@ import * as meow from 'meow';
3
3
  import { ReleaseType } from 'semver';
4
4
 
5
5
  declare const ForkConfigSchema: z.ZodObject<{
6
- command: z.ZodLiteral<"main" | "inspect-version" | "inspect-tag" | "validate-config">;
6
+ command: z.ZodLiteral<"main" | "inspect" | "inspect-version" | "inspect-tag" | "validate-config">;
7
7
  inspectVersion: z.ZodOptional<z.ZodBoolean>;
8
8
  files: z.ZodArray<z.ZodString>;
9
9
  glob: z.ZodOptional<z.ZodString>;
@@ -24,11 +24,13 @@ declare const ForkConfigSchema: z.ZodObject<{
24
24
  gitTagFallback: z.ZodBoolean;
25
25
  sign: z.ZodBoolean;
26
26
  verify: z.ZodBoolean;
27
+ asJson: z.ZodBoolean;
27
28
  skipBump: z.ZodBoolean;
28
29
  skipChangelog: z.ZodBoolean;
29
30
  skipCommit: z.ZodBoolean;
30
31
  skipTag: z.ZodBoolean;
31
- changelogPresetConfig: z.ZodObject<{
32
+ detectedGitHost: z.ZodOptional<z.ZodString>;
33
+ changelogPresetConfig: z.ZodOptional<z.ZodObject<{
32
34
  types: z.ZodOptional<z.ZodArray<z.ZodObject<{
33
35
  type: z.ZodString;
34
36
  scope: z.ZodOptional<z.ZodString>;
@@ -41,8 +43,9 @@ declare const ForkConfigSchema: z.ZodObject<{
41
43
  userUrlFormat: z.ZodOptional<z.ZodString>;
42
44
  releaseCommitMessageFormat: z.ZodOptional<z.ZodString>;
43
45
  issuePrefixes: z.ZodOptional<z.ZodArray<z.ZodString>>;
44
- }, z.core.$strip>;
46
+ }, z.core.$strip>>;
45
47
  releaseMessageSuffix: z.ZodOptional<z.ZodString>;
48
+ commitParserOptions: z.ZodOptional<z.ZodObject<z.core.$ZodLooseShape, z.core.$loose>>;
46
49
  }, z.core.$strip>;
47
50
 
48
51
  declare function getCliArguments(): meow.Result<{
@@ -116,6 +119,9 @@ declare function getCliArguments(): meow.Result<{
116
119
  verify: {
117
120
  type: "boolean";
118
121
  };
122
+ asJson: {
123
+ type: "boolean";
124
+ };
119
125
  skipBump: {
120
126
  type: "boolean";
121
127
  };
@@ -148,7 +154,72 @@ declare function getCliArguments(): meow.Result<{
148
154
  };
149
155
  }>;
150
156
 
151
- type ForkConfig = z.infer<typeof ForkConfigSchema>;
157
+ interface ParserOptions {
158
+ /**
159
+ * Pattern to match commit subjects
160
+ * - Expected capture groups: `type` `title`
161
+ * - Optional capture groups: `scope`, `breakingChange`
162
+ */
163
+ subjectPattern: RegExp | undefined;
164
+ /**
165
+ * Pattern to match merge commits
166
+ * - Expected capture groups: `id`, `source`
167
+ */
168
+ mergePattern: RegExp | undefined;
169
+ /**
170
+ * Pattern to match revert commits
171
+ * - Expected capture groups: `subject`, `hash`
172
+ */
173
+ revertPattern: RegExp | undefined;
174
+ /**
175
+ * Pattern to match commented out lines which will be trimmed
176
+ */
177
+ commentPattern: RegExp | undefined;
178
+ /**
179
+ * Pattern to match mentions
180
+ * - Expected capture groups: `username`
181
+ */
182
+ mentionPattern: RegExp | undefined;
183
+ /**
184
+ * List of action labels to match reference sections
185
+ * @default
186
+ * ["close", "closes", "closed", "fix", "fixes", "fixed", "resolve", "resolves", "resolved"]
187
+ */
188
+ referenceActions?: string[];
189
+ /**
190
+ * Pattern to match reference sections
191
+ * - Expected capture groups: `action`, `reference`
192
+ */
193
+ referenceActionPattern: RegExp | undefined;
194
+ /**
195
+ * List of issue prefixes to match issue ids
196
+ * @default
197
+ * ["#"]
198
+ */
199
+ issuePrefixes?: string[];
200
+ /**
201
+ * Pattern to match issue references
202
+ * - Expected capture groups: `repository`, `prefix`, `issue`
203
+ */
204
+ issuePattern: RegExp | undefined;
205
+ /**
206
+ * List of keywords to match note titles
207
+ * @default
208
+ * ["BREAKING CHANGE", "BREAKING-CHANGE"]
209
+ */
210
+ noteKeywords?: string[];
211
+ /**
212
+ * Pattern to match note sections
213
+ * - Expected capture groups: `title`
214
+ * - Optional capture groups: `text`
215
+ */
216
+ notePattern: RegExp | undefined;
217
+ }
218
+ declare function createParserOptions(userOptions?: Partial<ParserOptions>): ParserOptions;
219
+
220
+ type ForkConfig = z.infer<typeof ForkConfigSchema> & {
221
+ commitParserOptions?: Partial<ParserOptions>;
222
+ };
152
223
  type Config = Partial<ForkConfig>;
153
224
  type CLIArguments = ReturnType<typeof getCliArguments>;
154
225
  interface ForkVersionCLIArgs {
@@ -156,10 +227,69 @@ interface ForkVersionCLIArgs {
156
227
  flags: Partial<CLIArguments["flags"]>;
157
228
  }
158
229
 
230
+ interface LoggerConfig {
231
+ silent?: ForkConfig["silent"];
232
+ debug?: ForkConfig["debug"];
233
+ }
234
+ declare class Logger {
235
+ #private;
236
+ constructor(config: LoggerConfig);
237
+ log(message: string): void;
238
+ warn(message: string): void;
239
+ error(message: string): void;
240
+ debug(message: string, ...optionalParams: any[]): void;
241
+ skipping(message: string): void;
242
+ }
243
+
244
+ interface FileState {
245
+ name: string;
246
+ path: string;
247
+ version: string;
248
+ [other: string]: unknown;
249
+ }
250
+ interface IFileManager {
251
+ read(fileName: string): FileState | undefined;
252
+ write(fileState: FileState, newVersion: string): void;
253
+ isSupportedFile(fileName: string): boolean;
254
+ }
255
+ declare class FileManager {
256
+ #private;
257
+ constructor(config: ForkConfig, logger: Logger);
258
+ /**
259
+ * Get the state from the given file name.
260
+ *
261
+ * @example
262
+ * ```ts
263
+ * fileManager.read("package.json");
264
+ * ```
265
+ *
266
+ * @returns
267
+ * ```json
268
+ * { "name": "package.json", "path": "/path/to/package.json", "version": "1.2.3", "isPrivate": true }
269
+ * ```
270
+ */
271
+ read(pathOrName: string): FileState | undefined;
272
+ /**
273
+ * Write the new version to the given file.
274
+ *
275
+ * @example
276
+ * ```ts
277
+ * fileManager.write(
278
+ * { name: "package.json", path: "/path/to/package.json", version: "1.2.2" },
279
+ * "1.2.3"
280
+ * );
281
+ * ```
282
+ */
283
+ write(fileState: FileState, newVersion: string): void;
284
+ }
285
+
286
+ interface GitConfig {
287
+ path: ForkConfig["path"];
288
+ dryRun?: ForkConfig["dryRun"];
289
+ }
159
290
  declare class Git {
160
291
  #private;
161
- private config;
162
- constructor(config: Pick<ForkConfig, "path" | "dryRun">);
292
+ constructor(config: GitConfig);
163
293
  /**
164
294
  * Add file contents to the index
165
295
  *
@@ -261,7 +391,7 @@ declare class Git {
261
391
  */
262
392
  getTags(tagPrefix: string | undefined): Promise<string[]>;
263
393
  /**
264
- * Returns the latest git tag based on commit date
394
+ * Returns the most recent tag from the commit history, or `undefined` if no valid semver tags are found
265
395
  *
266
396
  * @example
267
397
  * ```ts
@@ -269,25 +399,6 @@ declare class Git {
269
399
  * ```
270
400
  */
271
401
  getMostRecentTag(tagPrefix: string | undefined): Promise<string | undefined>;
272
- /**
273
- * Get cleaned semver tags, with any tag prefix's removed
274
- *
275
- * @example
276
- * ```ts
277
- * await git.getCleanedTags("v"); // ["1.2.3", "1.2.2", "1.2.1"]
278
- * ```
279
- */
280
- getCleanedTags(tagPrefix: string | undefined): Promise<string[]>;
281
- /**
282
- * Get the highest semver version from git tags. This will return the highest
283
- * semver version found for the given tag prefix, regardless of the commit date.
284
- *
285
- * @example
286
- * ```ts
287
- * await git.getHighestSemverVersionFromTags("v"); // "1.2.3"
288
- * ```
289
- */
290
- getHighestSemverVersionFromTags(tagPrefix: string | undefined): Promise<string | undefined>;
291
402
  /**
292
403
  * Get commit history in a parsable format
293
404
  *
@@ -309,62 +420,7 @@ declare class Git {
309
420
  getCommits(from?: string, to?: string, ...paths: string[]): Promise<string[]>;
310
421
  }
311
422
 
312
- declare function inspectTag(config: ForkConfig, git: Git): Promise<void>;
313
-
314
- declare class Logger {
315
- private config;
316
- disableLogs: boolean;
317
- constructor(config: Pick<ForkConfig, "silent" | "debug">);
318
- log(message: string): void;
319
- warn(message: string): void;
320
- error(message: string): void;
321
- debug(message: string, ...optionalParams: any[]): void;
322
- skipping(message: string): void;
323
- }
324
-
325
- interface FileState {
326
- name: string;
327
- path: string;
328
- version: string;
329
- [other: string]: unknown;
330
- }
331
- interface IFileManager {
332
- read(fileName: string): FileState | undefined;
333
- write(fileState: FileState, newVersion: string): void;
334
- isSupportedFile(fileName: string): boolean;
335
- }
336
- declare class FileManager {
337
- #private;
338
- constructor(config: ForkConfig, logger: Logger);
339
- /**
340
- * Get the state from the given file name.
341
- *
342
- * @example
343
- * ```ts
344
- * fileManager.read("package.json");
345
- * ```
346
- *
347
- * @returns
348
- * ```json
349
- * { "name": "package.json", "path": "/path/to/package.json", "version": "1.2.3", "isPrivate": true }
350
- * ```
351
- */
352
- read(pathOrName: string): FileState | undefined;
353
- /**
354
- * Write the new version to the given file.
355
- *
356
- * @example
357
- * ```ts
358
- * fileManager.write(
359
- * { name: "package.json", path: "/path/to/package.json", version: "1.2.2" },
360
- * "1.2.3"
361
- * );
362
- * ```
363
- */
364
- write(fileState: FileState, newVersion: string): void;
365
- }
366
-
367
- declare function inspectVersion(config: ForkConfig, logger: Logger, fileManager: FileManager, git: Git): Promise<void>;
423
+ declare function inspect(config: ForkConfig, logger: Logger, fileManager: FileManager, git: Git): Promise<void>;
368
424
 
369
425
  interface CommitMerge {
370
426
  id: string;
@@ -435,57 +491,17 @@ interface CurrentVersion {
435
491
  version: string;
436
492
  files: FileState[];
437
493
  }
438
- declare function getCurrentVersion(config: ForkConfig, logger: Logger, git: Git, fileManager: FileManager, filesToUpdate: string[]): Promise<CurrentVersion>;
494
+ declare function getCurrentVersion(config: ForkConfig, logger: Logger, git: Git, fileManager: FileManager, filesToUpdate: string[], latestTagVersion: string | undefined): Promise<CurrentVersion>;
439
495
 
440
496
  interface CommitsSinceTag {
441
497
  latestTag: string | undefined;
498
+ latestTagVersion: string | undefined;
442
499
  commits: Commit[];
443
500
  }
444
501
  declare function getCommitsSinceTag(config: ForkConfig, logger: Logger, git: Git): Promise<CommitsSinceTag>;
445
502
 
446
503
  declare function main(config: ForkConfig, logger: Logger, fileManager: FileManager, git: Git): Promise<{
447
- config: {
448
- command: "main" | "inspect-version" | "inspect-tag" | "validate-config";
449
- files: string[];
450
- path: string;
451
- changelog: string;
452
- header: string;
453
- tagPrefix: string;
454
- allowMultipleVersions: boolean;
455
- commitAll: boolean;
456
- changelogAll: boolean;
457
- debug: boolean;
458
- dryRun: boolean;
459
- silent: boolean;
460
- gitTagFallback: boolean;
461
- sign: boolean;
462
- verify: boolean;
463
- skipBump: boolean;
464
- skipChangelog: boolean;
465
- skipCommit: boolean;
466
- skipTag: boolean;
467
- changelogPresetConfig: {
468
- types?: {
469
- type: string;
470
- scope?: string | undefined;
471
- section?: string | undefined;
472
- hidden?: boolean | undefined;
473
- }[] | undefined;
474
- commitUrlFormat?: string | undefined;
475
- compareUrlFormat?: string | undefined;
476
- issueUrlFormat?: string | undefined;
477
- userUrlFormat?: string | undefined;
478
- releaseCommitMessageFormat?: string | undefined;
479
- issuePrefixes?: string[] | undefined;
480
- };
481
- inspectVersion?: boolean | undefined;
482
- glob?: string | undefined;
483
- preRelease?: string | boolean | undefined;
484
- currentVersion?: string | undefined;
485
- nextVersion?: string | undefined;
486
- releaseAs?: "major" | "minor" | "patch" | undefined;
487
- releaseMessageSuffix?: string | undefined;
488
- };
504
+ config: ForkConfig;
489
505
  commits: CommitsSinceTag;
490
506
  current: CurrentVersion;
491
507
  next: NextVersion;
@@ -493,69 +509,6 @@ declare function main(config: ForkConfig, logger: Logger, fileManager: FileManag
493
509
 
494
510
  declare function validateConfig(config: ForkConfig): void;
495
511
 
496
- interface ParserOptions {
497
- /**
498
- * Pattern to match commit subjects
499
- * - Expected capture groups: `type` `title`
500
- * - Optional capture groups: `scope`, `breakingChange`
501
- */
502
- subjectPattern: RegExp | undefined;
503
- /**
504
- * Pattern to match merge commits
505
- * - Expected capture groups: `id`, `source`
506
- */
507
- mergePattern: RegExp | undefined;
508
- /**
509
- * Pattern to match revert commits
510
- * - Expected capture groups: `subject`, `hash`
511
- */
512
- revertPattern: RegExp | undefined;
513
- /**
514
- * Pattern to match commented out lines which will be trimmed
515
- */
516
- commentPattern: RegExp | undefined;
517
- /**
518
- * Pattern to match mentions
519
- * - Expected capture groups: `username`
520
- */
521
- mentionPattern: RegExp | undefined;
522
- /**
523
- * List of action labels to match reference sections
524
- * @default
525
- * ["close", "closes", "closed", "fix", "fixes", "fixed", "resolve", "resolves", "resolved"]
526
- */
527
- referenceActions?: string[];
528
- /**
529
- * Pattern to match reference sections
530
- * - Expected capture groups: `action`, `reference`
531
- */
532
- referenceActionPattern: RegExp | undefined;
533
- /**
534
- * List of issue prefixes to match issue ids
535
- * @default
536
- * ["#"]
537
- */
538
- issuePrefixes?: string[];
539
- /**
540
- * Pattern to match issue references
541
- * - Expected capture groups: `repository`, `prefix`, `issue`
542
- */
543
- issuePattern: RegExp | undefined;
544
- /**
545
- * List of keywords to match note titles
546
- * @default
547
- * ["BREAKING CHANGE", "BREAKING-CHANGE"]
548
- */
549
- noteKeywords?: string[];
550
- /**
551
- * Pattern to match note sections
552
- * - Expected capture groups: `title`
553
- * - Optional capture groups: `text`
554
- */
555
- notePattern: RegExp | undefined;
556
- }
557
- declare function createParserOptions(userOptions?: Partial<ParserOptions>): ParserOptions;
558
-
559
512
  declare class CommitParser {
560
513
  #private;
561
514
  constructor(userOptions?: Partial<ParserOptions>);
@@ -690,4 +643,4 @@ declare function commitChanges(config: ForkConfig, logger: Logger, git: Git, fil
690
643
 
691
644
  declare function tagChanges(config: ForkConfig, logger: Logger, git: Git, nextVersion: string): Promise<void>;
692
645
 
693
- export { type Commit, type CommitMerge, type CommitNote, CommitParser, type CommitReference, type CommitRevert, type CommitsSinceTag, type Config, type CurrentVersion, FileManager, type FileState, type ForkConfig, ForkConfigSchema, Git, type IFileManager, Logger, type NextVersion, type ParserOptions, commitChanges, createParserOptions, defineConfig, filterRevertedCommits, getCommitsSinceTag, getCurrentVersion, getNextVersion, getUserConfig, inspectTag, inspectVersion, main, tagChanges, updateChangelog, validateConfig };
646
+ export { type Commit, type CommitMerge, type CommitNote, CommitParser, type CommitReference, type CommitRevert, type CommitsSinceTag, type Config, type CurrentVersion, FileManager, type FileState, type ForkConfig, ForkConfigSchema, Git, type IFileManager, Logger, type NextVersion, type ParserOptions, commitChanges, createParserOptions, defineConfig, filterRevertedCommits, getCommitsSinceTag, getCurrentVersion, getNextVersion, getUserConfig, inspect, main, tagChanges, updateChangelog, validateConfig };