fork-version 1.4.89 → 1.4.90

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Fork Version
2
2
 
3
+ ## 1.4.90 (2024-06-13)
4
+
5
+
6
+ ### Refactor
7
+
8
+ * add change log all support ([#65](https://github.com/eglavin/fork-version/issues/65)) ([93a76cb](https://github.com/eglavin/fork-version/commit/93a76cb4ca0934335c40f8d28d61355730cb64da))
9
+
10
+
3
11
  ## 1.4.89 (2024-06-12)
4
12
 
5
13
 
package/README.md CHANGED
@@ -104,6 +104,7 @@ Options:
104
104
  Flags:
105
105
  --allow-multiple-versions Don't throw an error if multiple versions are found in the given files. [Default: true]
106
106
  --commit-all Commit all changes, not just files updated by fork-version.
107
+ --changelog-all If this flag is set, all default commit types will be added to the changelog.
107
108
  --debug Output debug information.
108
109
  --dry-run No output will be written to disk or committed.
109
110
  --silent Run without logging to the terminal.
@@ -231,32 +232,33 @@ Alternatively you can define your config using a key in your `package.json` file
231
232
 
232
233
  #### Config Properties
233
234
 
234
- | Property | Type | Default | Description |
235
- | :---------------------------------------------------- | :--------------- | :---------------------- | :--------------------------------------------------------------------------------------------- |
236
- | inspectVersion | boolean | - | Print the current version and exits |
237
- | [files](#configfiles) | Array\<string> | `["package.json", ...]` | List of the files to be updated |
238
- | [glob](#configglob) | string | - | Glob pattern to match files to be updated |
239
- | path | string | `process.cwd()` | The path fork-version will run from |
240
- | changelog | string | `CHANGELOG.md` | Name of the changelog file |
241
- | header | string | `# Changelog...` | The header text for the changelog |
242
- | [tagPrefix](#configtagprefix) | string | `v` | Prefix for the created tag |
243
- | [preRelease](#configprerelease) | string / boolean | - | Make a pre-release with optional label if given value is a string |
244
- | currentVersion | string | - | Use this version instead of trying to determine one |
245
- | nextVersion | string | - | Attempt to update to this version, instead of incrementing using "conventional-commit" |
246
- | allowMultipleVersions | boolean | true | Don't throw an error if multiple versions are found in the given files. |
247
- | commitAll | boolean | false | Commit all changes, not just files updated by fork-version |
248
- | debug | boolean | false | Output debug information |
249
- | dryRun | boolean | false | No output will be written to disk or committed |
250
- | silent | boolean | false | Run without logging to the terminal |
251
- | gitTagFallback | boolean | true | If unable to find a version in the given files, fallback and attempt to use the latest git tag |
252
- | sign | boolean | false | Sign the commit with the systems GPG key |
253
- | verify | boolean | false | Run user defined git hooks before committing |
254
- | skipBump | boolean | false | Skip the bump step |
255
- | skipChangelog | boolean | false | Skip the changelog step |
256
- | skipCommit | boolean | false | Skip the commit step |
257
- | skipTag | boolean | false | Skip the tag step |
258
- | [changelogPresetConfig](#configchangelogpresetconfig) | object | {} | Override defaults from the "conventional-changelog-conventionalcommits" preset configuration |
259
- | releaseMessageSuffix | string | - | Add a suffix to the end of the release message |
235
+ | Property | Type | Default | Description |
236
+ | :---------------------------------------------------- | :--------------- | :---------------------- | :------------------------------------------------------------------------------------------------------- |
237
+ | inspectVersion | boolean | - | Print the current version and exits |
238
+ | [files](#configfiles) | Array\<string> | `["package.json", ...]` | List of the files to be updated |
239
+ | [glob](#configglob) | string | - | Glob pattern to match files to be updated |
240
+ | path | string | `process.cwd()` | The path fork-version will run from |
241
+ | changelog | string | `CHANGELOG.md` | Name of the changelog file |
242
+ | header | string | `# Changelog...` | The header text for the changelog |
243
+ | [tagPrefix](#configtagprefix) | string | `v` | Prefix for the created tag |
244
+ | [preRelease](#configprerelease) | string / boolean | - | Make a pre-release with optional label if given value is a string |
245
+ | currentVersion | string | - | Use this version instead of trying to determine one |
246
+ | nextVersion | string | - | Attempt to update to this version, instead of incrementing using "conventional-commit" |
247
+ | allowMultipleVersions | boolean | true | Don't throw an error if multiple versions are found in the given files. |
248
+ | commitAll | boolean | false | Commit all changes, not just files updated by fork-version |
249
+ | changelogAll | boolean | false | If this flag is set, all default commit types will be added to the changelog, not just `feat` and `fix`. |
250
+ | debug | boolean | false | Output debug information |
251
+ | dryRun | boolean | false | No output will be written to disk or committed |
252
+ | silent | boolean | false | Run without logging to the terminal |
253
+ | gitTagFallback | boolean | true | If unable to find a version in the given files, fallback and attempt to use the latest git tag |
254
+ | sign | boolean | false | Sign the commit with the systems GPG key |
255
+ | verify | boolean | false | Run user defined git hooks before committing |
256
+ | skipBump | boolean | false | Skip the bump step |
257
+ | skipChangelog | boolean | false | Skip the changelog step |
258
+ | skipCommit | boolean | false | Skip the commit step |
259
+ | skipTag | boolean | false | Skip the tag step |
260
+ | [changelogPresetConfig](#configchangelogpresetconfig) | object | {} | Override defaults from the "conventional-changelog-conventionalcommits" preset configuration |
261
+ | releaseMessageSuffix | string | - | Add a suffix to the end of the release message |
260
262
 
261
263
  ##### config.files
262
264
 
@@ -219,6 +219,15 @@ var ForkConfigSchema = zod.z.object({
219
219
  * @default false
220
220
  */
221
221
  commitAll: zod.z.boolean().describe("Commit all changes, not just files updated by fork-version."),
222
+ /**
223
+ * By default the conventional-changelog spec will only add commit types of `feat` and `fix` to the generated changelog.
224
+ * If this flag is set, all [default commit types](https://github.com/conventional-changelog/conventional-changelog-config-spec/blob/238093090c14bd7d5151eb5316e635623ce633f9/versions/2.2.0/schema.json#L18)
225
+ * will be added to the changelog.
226
+ * @default false
227
+ */
228
+ changelogAll: zod.z.boolean().describe(
229
+ "If this flag is set, all default commit types will be added to the changelog, not just `feat` and `fix`."
230
+ ),
222
231
  /**
223
232
  * Output debug information.
224
233
  * @default false
@@ -315,6 +324,7 @@ All notable changes to this project will be documented in this file. See [fork-v
315
324
  // Flags
316
325
  allowMultipleVersions: true,
317
326
  commitAll: false,
327
+ changelogAll: false,
318
328
  debug: false,
319
329
  dryRun: false,
320
330
  silent: false,
@@ -351,6 +361,7 @@ Options:
351
361
  Flags:
352
362
  --allow-multiple-versions Don't throw an error if multiple versions are found in the given files. [Default: true]
353
363
  --commit-all Commit all changes, not just files updated by fork-version.
364
+ --changelog-all If this flag is set, all default commit types will be added to the changelog.
354
365
  --debug Output debug information.
355
366
  --dry-run No output will be written to disk or committed.
356
367
  --silent Run without logging to the terminal.
@@ -408,6 +419,7 @@ function getCliArguments() {
408
419
  // Flags
409
420
  allowMultipleVersions: { type: "boolean" },
410
421
  commitAll: { type: "boolean" },
422
+ changelogAll: { type: "boolean" },
411
423
  debug: { type: "boolean" },
412
424
  dryRun: { type: "boolean" },
413
425
  silent: { type: "boolean" },
@@ -436,6 +448,19 @@ function getChangelogPresetConfig(mergedConfig, cliArgumentsFlags, detectedGitHo
436
448
  if (typeof conventionalChangelogConfigSpec__default.default.properties === "object") {
437
449
  Object.entries(conventionalChangelogConfigSpec__default.default.properties).forEach(([key, value]) => {
438
450
  if ("default" in value && value.default !== void 0) {
451
+ if (mergedConfig?.changelogAll && key === "types") {
452
+ const parsedTypes = zod.z.array(ChangelogPresetConfigTypeSchema).safeParse(value.default);
453
+ if (parsedTypes.success) {
454
+ parsedTypes.data.forEach((type) => {
455
+ if (!type.section) {
456
+ delete type.hidden;
457
+ type.section = "Other Changes";
458
+ }
459
+ });
460
+ preset[key] = parsedTypes.data;
461
+ return;
462
+ }
463
+ }
439
464
  preset[key] = value.default;
440
465
  }
441
466
  });
@@ -1105,4 +1130,4 @@ exports.getUserConfig = getUserConfig;
1105
1130
  exports.tagChanges = tagChanges;
1106
1131
  exports.updateChangelog = updateChangelog;
1107
1132
  //# sourceMappingURL=out.js.map
1108
- //# sourceMappingURL=chunk-B55NV4E4.cjs.map
1133
+ //# sourceMappingURL=chunk-OAJOJDJP.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/config/schema.ts","../src/config/user-config.ts","../src/config/defaults.ts","../src/config/cli-arguments.js","../src/config/changelog-preset-config.ts","../src/config/detect-git-host.ts","../src/process/version.ts","../src/utils/git-tag-version.ts","../src/utils/release-type.ts","../src/process/changelog.ts","../src/utils/file-state.ts","../src/process/commit.ts","../src/utils/format-commit-message.ts","../src/process/tag.ts","../src/strategies/json-package.ts","../src/libs/stringify-package.ts","../src/strategies/plain-text.ts","../src/strategies/ms-build-project.ts","../src/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C,SAAK,cAAc,KAAK,OAAO,UAAU,KAAK,OAAO;AAAA,EACtD;AAAA,EAVA,cAAc;AAAA,EAYP,OAAO,UAAiB;AAC9B,QAAI,CAAC,KAAK,aAAa;AACtB,cAAQ,IAAI,GAAG,QAAQ;AAAA,IACxB;AAAA,EACD;AAAA,EAEO,QAAQ,UAAiB;AAC/B,QAAI,CAAC,KAAK,aAAa;AACtB,cAAQ,KAAK,GAAG,QAAQ;AAAA,IACzB;AAAA,EACD;AAAA,EAEO,SAAS,UAAiB;AAChC,QAAI,CAAC,KAAK,aAAa;AACtB,cAAQ,MAAM,GAAG,QAAQ;AAAA,IAC1B;AAAA,EACD;AAAA,EAEO,SAAS,UAAiB;AAChC,QAAI,KAAK,OAAO,SAAS,CAAC,KAAK,aAAa;AAC3C,cAAQ,MAAM,GAAG,QAAQ;AAAA,IAC1B;AAAA,EACD;AACD","sourcesContent":["import { z } from \"zod\";\n\nexport const ChangelogPresetConfigTypeSchema = z.object({\n\t/**\n\t * The type of commit message.\n\t * @example \"feat\", \"fix\", \"chore\", etc..\n\t */\n\ttype: z.string().describe('The type of commit message, such as \"feat\", \"fix\", \"chore\".'),\n\t/**\n\t * The scope of the commit message.\n\t */\n\tscope: z.string().optional().describe(\"The scope of the commit message.\"),\n\t/**\n\t * The section of the `CHANGELOG` the commit should show up in.\n\t */\n\tsection: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"The section of the `CHANGELOG` the commit should show up in.\"),\n\t/**\n\t * Should show in the generated changelog message?\n\t */\n\thidden: z.boolean().optional().describe(\"Should show in the generated changelog message?\"),\n});\n\nexport const ChangelogPresetConfigSchema = z.object({\n\t/**\n\t * List of explicitly supported commit message types.\n\t */\n\ttypes: z\n\t\t.array(ChangelogPresetConfigTypeSchema)\n\t\t.describe(\"List of explicitly supported commit message types.\"),\n\t/**\n\t * A URL representing a specific commit at a hash.\n\t * @default \"{{host}}/{{owner}}/{{repository}}/commit/{{hash}}\"\n\t */\n\tcommitUrlFormat: z.string().describe(\"A URL representing a specific commit at a hash.\"),\n\t/**\n\t * A URL representing the comparison between two git SHAs.\n\t * @default \"{{host}}/{{owner}}/{{repository}}/compare/{{previousTag}}...{{currentTag}}\"\n\t */\n\tcompareUrlFormat: z.string().describe(\"A URL representing the comparison between two git SHAs.\"),\n\t/**\n\t * A URL representing the issue format (allowing a different URL format to be swapped in\n\t * for Gitlab, Bitbucket, etc).\n\t * @default \"{{host}}/{{owner}}/{{repository}}/issues/{{id}}\"\n\t */\n\tissueUrlFormat: z.string().describe(\"A URL representing the issue format.\"),\n\t/**\n\t * A URL representing a user's profile on GitHub, Gitlab, etc. This URL is used\n\t * for substituting @eglavin with https://github.com/eglavin in commit messages.\n\t * @default \"{{host}}/{{user}}\"\n\t */\n\tuserUrlFormat: z.string().describe(\"A URL representing a user's profile on GitHub, Gitlab, etc.\"),\n\t/**\n\t * A string to be used to format the auto-generated release commit message.\n\t * @default \"chore(release): {{currentTag}}\"\n\t */\n\treleaseCommitMessageFormat: z\n\t\t.string()\n\t\t.describe(\"A string to be used to format the auto-generated release commit message.\"),\n\t/**\n\t * List of prefixes used to detect references to issues.\n\t * @default [\"#\"]\n\t */\n\tissuePrefixes: z\n\t\t.array(z.string())\n\t\t.describe(\"List of prefixes used to detect references to issues.\"),\n});\n\nexport const ForkConfigSchema = z.object({\n\t// Commands\n\t//\n\n\t/**\n\t * If set, fork-version will print the current version and exit.\n\t * @default false\n\t */\n\tinspectVersion: z\n\t\t.boolean()\n\t\t.describe(\"If set, fork-version will print the current version and exit.\"),\n\n\t// Options\n\t//\n\n\t/**\n\t * List of the files to be updated.\n\t * @default\n\t * ```js\n\t * [\"bower.json\", \"deno.json\", \"jsr.json\", \"manifest.json\", \"npm-shrinkwrap.json\", \"package-lock.json\", \"package.json\"]\n\t * ```\n\t */\n\tfiles: z.array(z.string()).describe(\"List of the files to be updated.\"),\n\t/**\n\t * Glob pattern to match files to be updated.\n\t *\n\t * Internally we're using [glob](https://github.com/isaacs/node-glob) to match files.\n\t *\n\t * Read more about the pattern syntax [here](https://github.com/isaacs/node-glob/tree/v10.3.12?tab=readme-ov-file#glob-primer).\n\t *\n\t * @default undefined\n\t * @example \"*.json\"\n\t */\n\tglob: z.string().optional().describe(\"Glob pattern to match files to be updated.\"),\n\t/**\n\t * The path fork-version will run from.\n\t * @default\n\t * ```js\n\t * process.cwd()\n\t * ```\n\t */\n\tpath: z.string().describe('The path fork-version will run from. Defaults to \"process.cwd()\".'),\n\t/**\n\t * Name of the changelog file.\n\t * @default \"CHANGELOG.md\"\n\t */\n\tchangelog: z.string().describe('Name of the changelog file. Defaults to \"CHANGELOG.md\".'),\n\t/**\n\t * The header text for the changelog.\n\t * @default\n\t * ```markdown\n\t * # Changelog\n\t *\n\t * All notable changes to this project will be documented in this file. See [fork-version](https://github.com/eglavin/fork-version) for commit guidelines.\n\t * ```\n\t */\n\theader: z.string().describe(\"The header text for the changelog.\"),\n\t/**\n\t * Specify a prefix for the created tag.\n\t *\n\t * For instance if your version tag is prefixed by \"version/\" instead of \"v\" you have to specify\n\t * `tagPrefix: \"version/\"`.\n\t *\n\t * `tagPrefix` can also be used for a monorepo environment where you might want to deploy\n\t * multiple package from the same repository. In this case you can specify a prefix for\n\t * each package:\n\t *\n\t * | Example Value | Tag Created |\n\t * |:-------------------------|:------------------------------|\n\t * | \"\" | `1.2.3` |\n\t * | \"version/\" | `version/1.2.3` |\n\t * | \"@eglavin/fork-version-\" | `@eglavin/fork-version-1.2.3` |\n\t *\n\t * @example \"\", \"version/\", \"@eglavin/fork-version-\"\n\t * @default \"v\"\n\t */\n\ttagPrefix: z.string().describe('Specify a prefix for the created tag. Defaults to \"v\".'),\n\t/**\n\t * Make a pre-release with optional label if given value is a string.\n\t *\n\t * | Example Value | Produced Version |\n\t * |:--------------|:-----------------|\n\t * | true | `1.2.3-0` |\n\t * | \"alpha\" | `1.2.3-alpha-0` |\n\t * | \"beta\" | `1.2.3-beta-0` |\n\t *\n\t * @example true, \"alpha\", \"beta\", \"rc\"\n\t * @default undefined\n\t */\n\tpreRelease: z\n\t\t.string()\n\t\t.or(z.boolean())\n\t\t.optional()\n\t\t.describe(\"Make a pre-release with optional label if given value is a string.\"),\n\t/**\n\t * If set, fork-version will use this version instead of trying to determine one.\n\t * @example \"1.0.0\"\n\t * @default undefined\n\t */\n\tcurrentVersion: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"If set, fork-version will use this version instead of trying to determine one.\"),\n\t/**\n\t * If set, fork-version will attempt to update to this version, instead of incrementing using \"conventional-commit\".\n\t * @example \"2.0.0\"\n\t * @default undefined\n\t */\n\tnextVersion: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\n\t\t\t'If set, fork-version will attempt to update to this version, instead of incrementing using \"conventional-commit\".',\n\t\t),\n\n\t// Flags\n\t//\n\n\t/**\n\t * Don't throw an error if multiple versions are found in the given files.\n\t * @default true\n\t */\n\tallowMultipleVersions: z\n\t\t.boolean()\n\t\t.describe(\"Don't throw an error if multiple versions are found in the given files.\"),\n\t/**\n\t * Commit all changes, not just files updated by fork-version.\n\t * @default false\n\t */\n\tcommitAll: z.boolean().describe(\"Commit all changes, not just files updated by fork-version.\"),\n\t/**\n\t * By default the conventional-changelog spec will only add commit types of `feat` and `fix` to the generated changelog.\n\t * If this flag is set, all [default commit types](https://github.com/conventional-changelog/conventional-changelog-config-spec/blob/238093090c14bd7d5151eb5316e635623ce633f9/versions/2.2.0/schema.json#L18)\n\t * will be added to the changelog.\n\t * @default false\n\t */\n\tchangelogAll: z\n\t\t.boolean()\n\t\t.describe(\n\t\t\t\"If this flag is set, all default commit types will be added to the changelog, not just `feat` and `fix`.\",\n\t\t),\n\t/**\n\t * Output debug information.\n\t * @default false\n\t */\n\tdebug: z.boolean().describe(\"Output debug information.\"),\n\t/**\n\t * No output will be written to disk or committed.\n\t * @default false\n\t */\n\tdryRun: z.boolean().describe(\"No output will be written to disk or committed.\"),\n\t/**\n\t * Run without logging to the terminal.\n\t * @default false\n\t */\n\tsilent: z.boolean().describe(\"Run without logging to the terminal.\"),\n\t/**\n\t * If unable to find a version in the given files, fallback and attempt to use the latest git tag.\n\t * @default true\n\t */\n\tgitTagFallback: z\n\t\t.boolean()\n\t\t.describe(\n\t\t\t\"If unable to find a version in the given files, fallback and attempt to use the latest git tag. Defaults to true.\",\n\t\t),\n\t/**\n\t * If true, git will sign the commit with the systems GPG key.\n\t * @see {@link https://git-scm.com/docs/git-commit#Documentation/git-commit.txt--Sltkeyidgt Git - GPG Sign Commits}\n\t * @default false\n\t */\n\tsign: z.boolean().describe(\"If true, git will sign the commit with the systems GPG key.\"),\n\t/**\n\t * If true, git will run user defined git hooks before committing.\n\t * @default false\n\t */\n\tverify: z.boolean().describe(\"If true, git will run user defined git hooks before committing.\"),\n\n\t// Skip Steps\n\t//\n\n\t/**\n\t * Skip the bump step.\n\t * @default false\n\t */\n\tskipBump: z.boolean().describe(\"Skip the bump step.\"),\n\t/**\n\t * Skip the changelog step.\n\t * @default false\n\t */\n\tskipChangelog: z.boolean().describe(\"Skip the changelog step.\"),\n\t/**\n\t * Skip the commit step.\n\t * @default false\n\t */\n\tskipCommit: z.boolean().describe(\"Skip the commit step.\"),\n\t/**\n\t * Skip the tag step.\n\t * @default false\n\t */\n\tskipTag: z.boolean().describe(\"Skip the tag step.\"),\n\n\t/**\n\t * Override the default \"conventional-changelog-conventionalcommits\" preset configuration.\n\t */\n\tchangelogPresetConfig: ChangelogPresetConfigSchema.partial().describe(\n\t\t'Override the default \"conventional-changelog-conventionalcommits\" preset configuration.',\n\t),\n\n\t/**\n\t * Add a suffix to the release commit message.\n\t * @example \"[skip ci]\"\n\t */\n\treleaseMessageSuffix: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"Add a suffix to the release commit message.\"),\n});\n\nexport type ForkConfig = z.infer<typeof ForkConfigSchema>;\n\nexport type Config = Partial<ForkConfig>;\n\nexport function defineConfig(config: Config): Config {\n\treturn config;\n}\n","import { readFileSync } from \"node:fs\";\nimport { parse, resolve } from \"node:path\";\nimport JoyCon from \"joycon\";\nimport { bundleRequire } from \"bundle-require\";\nimport { glob } from \"glob\";\nimport dotgitignore from \"dotgitignore\";\n\nimport { ForkConfigSchema, type ForkConfig } from \"./schema\";\nimport { DEFAULT_CONFIG } from \"./defaults\";\nimport { getCliArguments } from \"./cli-arguments\";\nimport { getChangelogPresetConfig } from \"./changelog-preset-config\";\nimport { detectGitHost } from \"./detect-git-host\";\n\n/**\n * Name of the key in the package.json file that contains the users configuration.\n */\nconst PACKAGE_JSON_CONFIG_KEY = \"fork-version\";\n\nexport async function getUserConfig(): Promise<ForkConfig> {\n\tconst cliArguments = getCliArguments();\n\n\tconst cwd = cliArguments.flags.path ? resolve(cliArguments.flags.path) : process.cwd();\n\tconst joycon = new JoyCon({\n\t\tcwd,\n\t\tpackageKey: PACKAGE_JSON_CONFIG_KEY,\n\t\tstopDir: parse(cwd).root,\n\t});\n\tconst configFilePath = await joycon.resolve([\n\t\t\"fork.config.ts\",\n\t\t\"fork.config.js\",\n\t\t\"fork.config.cjs\",\n\t\t\"fork.config.mjs\",\n\t\t\"fork.config.json\",\n\t\t\"package.json\",\n\t]);\n\n\tconst configFile = await loadConfigFile(configFilePath);\n\n\tconst mergedConfig = {\n\t\t...DEFAULT_CONFIG,\n\t\t...configFile,\n\t\t...cliArguments.flags,\n\t} as ForkConfig;\n\n\t// If the user has defined a glob pattern, use it to find the requested files.\n\tlet globResults: string[] = [];\n\tif (mergedConfig.glob) {\n\t\tglobResults = await glob(mergedConfig.glob, {\n\t\t\tcwd: cwd,\n\t\t\tignore: [\"node_modules/**\"],\n\t\t\tnodir: true,\n\t\t});\n\t}\n\n\tconst detectedGitHost = await detectGitHost(cwd);\n\n\treturn {\n\t\t...mergedConfig,\n\n\t\tfiles: filterGitIgnoredFiles(\n\t\t\tcwd,\n\t\t\tgetFilesList(configFile?.files, cliArguments.flags?.files, globResults),\n\t\t),\n\t\tpath: cwd,\n\t\tpreRelease:\n\t\t\t// Meow doesn't support multiple flags with the same name, so we need to check both.\n\t\t\tcliArguments.flags.preReleaseTag ?? cliArguments.flags.preRelease ?? configFile.preRelease,\n\t\tchangelogPresetConfig: getChangelogPresetConfig(\n\t\t\tmergedConfig,\n\t\t\tcliArguments.flags,\n\t\t\tdetectedGitHost,\n\t\t),\n\t};\n}\n\nasync function loadConfigFile(configFilePath: string | null) {\n\tif (!configFilePath) {\n\t\treturn {};\n\t}\n\n\t// Handle json config file.\n\tif (configFilePath.endsWith(\"json\")) {\n\t\tconst fileContent = JSON.parse(readFileSync(configFilePath).toString());\n\n\t\t// Handle package.json config file.\n\t\tif (configFilePath.endsWith(\"package.json\")) {\n\t\t\tif (\n\t\t\t\tfileContent[PACKAGE_JSON_CONFIG_KEY] &&\n\t\t\t\ttypeof fileContent[PACKAGE_JSON_CONFIG_KEY] === \"object\"\n\t\t\t) {\n\t\t\t\tconst parsed = ForkConfigSchema.partial().safeParse(fileContent[PACKAGE_JSON_CONFIG_KEY]);\n\t\t\t\tif (!parsed.success) {\n\t\t\t\t\tthrow parsed.error;\n\t\t\t\t}\n\t\t\t\treturn parsed.data;\n\t\t\t}\n\n\t\t\treturn {};\n\t\t}\n\n\t\tconst parsed = ForkConfigSchema.partial().safeParse(fileContent);\n\t\tif (!parsed.success) {\n\t\t\tthrow parsed.error;\n\t\t}\n\t\treturn parsed.data;\n\t}\n\n\t// Otherwise expect config file to use js or ts.\n\tconst fileContent = await bundleRequire({ filepath: configFilePath });\n\n\tconst parsed = ForkConfigSchema.partial().safeParse(fileContent.mod.default || fileContent.mod);\n\tif (!parsed.success) {\n\t\tthrow parsed.error;\n\t}\n\treturn parsed.data;\n}\n\nfunction getFilesList(\n\tconfigFiles: string[] | undefined,\n\tcliFiles: string[] | undefined,\n\tglobResults: string[],\n): string[] {\n\tconst listOfFiles = new Set<string>();\n\n\t// Add files from the users config file\n\tif (Array.isArray(configFiles)) {\n\t\tconfigFiles.forEach((file) => listOfFiles.add(file));\n\t}\n\n\t// Add files from the cli arguments\n\tif (Array.isArray(cliFiles)) {\n\t\tcliFiles.forEach((file) => listOfFiles.add(file));\n\t}\n\n\t// Add files from glob results\n\tglobResults.forEach((file) => listOfFiles.add(file));\n\n\t// If the user has defined files use them, otherwise use the default list of files.\n\tif (listOfFiles.size) {\n\t\treturn Array.from(listOfFiles);\n\t}\n\n\treturn DEFAULT_CONFIG.files;\n}\n\nfunction filterGitIgnoredFiles(cwd: string, files: string[]) {\n\tconst dotgit = dotgitignore({ cwd });\n\n\treturn files.filter((file) => !dotgit.ignore(file));\n}\n","import type { ForkConfig } from \"./schema\";\n\nexport const DEFAULT_CONFIG: ForkConfig = {\n\t// Commands\n\tinspectVersion: false,\n\n\t// Options\n\tfiles: [\n\t\t\"package.json\",\n\t\t\"package-lock.json\",\n\t\t\"npm-shrinkwrap.json\",\n\t\t\"jsr.json\",\n\t\t\"deno.json\",\n\t\t\"manifest.json\", // Chrome extensions\n\t\t\"bower.json\",\n\t],\n\tpath: process.cwd(),\n\tchangelog: \"CHANGELOG.md\",\n\theader: `# Changelog\n\nAll notable changes to this project will be documented in this file. See [fork-version](https://github.com/eglavin/fork-version) for commit guidelines.\n`,\n\ttagPrefix: \"v\",\n\n\t// Flags\n\tallowMultipleVersions: true,\n\tcommitAll: false,\n\tchangelogAll: false,\n\tdebug: false,\n\tdryRun: false,\n\tsilent: false,\n\tgitTagFallback: true,\n\tsign: false,\n\tverify: false,\n\n\t// Skip Steps\n\tskipBump: false,\n\tskipChangelog: false,\n\tskipCommit: false,\n\tskipTag: false,\n\n\tchangelogPresetConfig: {},\n};\n","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 [options]\n\nCommands:\n --help Show this help message.\n --version Show the current version of fork-version.\n --inspect-version If set, fork-version will print the current project version and exit.\n\nOptions:\n --file, -F List of the files to be updated. [Default: [\"bower.json\", \"deno.json\", \"jsr.json\", \"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 --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\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\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\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\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\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","import { z } from \"zod\";\nimport conventionalChangelogConfigSpec from \"conventional-changelog-config-spec\";\n\nimport {\n\tChangelogPresetConfigTypeSchema,\n\tChangelogPresetConfigSchema,\n\ttype ForkConfig,\n} from \"./schema\";\nimport type { getCliArguments } from \"./cli-arguments\";\nimport type { DetectedGitHost } from \"./detect-git-host\";\n\nexport function getChangelogPresetConfig(\n\tmergedConfig: Partial<ForkConfig> | undefined,\n\tcliArgumentsFlags: ReturnType<typeof getCliArguments>[\"flags\"],\n\tdetectedGitHost: DetectedGitHost | null,\n) {\n\tconst preset: { name: string; [_: string]: unknown } = {\n\t\tname: \"conventionalcommits\",\n\t};\n\n\t// First take any default values from the conventional-changelog-config-spec\n\tif (typeof conventionalChangelogConfigSpec.properties === \"object\") {\n\t\tObject.entries(conventionalChangelogConfigSpec.properties).forEach(([key, value]) => {\n\t\t\tif (\"default\" in value && value.default !== undefined) {\n\t\t\t\t// If the user has requested to see all types, we need to remove the hidden flag from the default types.\n\t\t\t\tif (mergedConfig?.changelogAll && key === \"types\") {\n\t\t\t\t\tconst parsedTypes = z.array(ChangelogPresetConfigTypeSchema).safeParse(value.default);\n\n\t\t\t\t\tif (parsedTypes.success) {\n\t\t\t\t\t\tparsedTypes.data.forEach((type) => {\n\t\t\t\t\t\t\tif (!type.section) {\n\t\t\t\t\t\t\t\tdelete type.hidden;\n\t\t\t\t\t\t\t\ttype.section = \"Other Changes\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\tpreset[key] = parsedTypes.data;\n\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tpreset[key] = value.default;\n\t\t\t}\n\t\t});\n\t}\n\n\t// If we've detected a git host, use the values from the detected host now so that they can\n\t// be overwritten by the users config later\n\tif (detectedGitHost) {\n\t\tObject.entries(detectedGitHost).forEach(([key, value]) => {\n\t\t\tif (value !== undefined) {\n\t\t\t\tpreset[key] = value;\n\t\t\t}\n\t\t});\n\t}\n\n\t// Then overwrite with any values from the users config\n\tif (\n\t\tmergedConfig?.changelogPresetConfig &&\n\t\ttypeof mergedConfig.changelogPresetConfig === \"object\"\n\t) {\n\t\tObject.entries(mergedConfig.changelogPresetConfig).forEach(([key, value]) => {\n\t\t\tif (value !== undefined) {\n\t\t\t\tpreset[key] = value;\n\t\t\t}\n\t\t});\n\t}\n\n\t// If the user has defined a releaseMessageSuffix, append it to the releaseCommitMessageFormat\n\tif (mergedConfig?.releaseMessageSuffix && !cliArgumentsFlags?.releaseMessageSuffix) {\n\t\tpreset.releaseCommitMessageFormat = `${preset.releaseCommitMessageFormat} ${mergedConfig.releaseMessageSuffix}`;\n\t}\n\n\t// Finally overwrite with any values from the CLI arguments\n\tif (cliArgumentsFlags?.commitUrlFormat) {\n\t\tpreset.commitUrlFormat = cliArgumentsFlags.commitUrlFormat;\n\t}\n\tif (cliArgumentsFlags?.compareUrlFormat) {\n\t\tpreset.compareUrlFormat = cliArgumentsFlags.compareUrlFormat;\n\t}\n\tif (cliArgumentsFlags?.issueUrlFormat) {\n\t\tpreset.issueUrlFormat = cliArgumentsFlags.issueUrlFormat;\n\t}\n\tif (cliArgumentsFlags?.userUrlFormat) {\n\t\tpreset.userUrlFormat = cliArgumentsFlags.userUrlFormat;\n\t}\n\tif (cliArgumentsFlags?.releaseCommitMessageFormat) {\n\t\tpreset.releaseCommitMessageFormat = cliArgumentsFlags.releaseCommitMessageFormat;\n\t}\n\tif (cliArgumentsFlags?.releaseMessageSuffix) {\n\t\tpreset.releaseCommitMessageFormat = `${preset.releaseCommitMessageFormat} ${cliArgumentsFlags.releaseMessageSuffix}`;\n\t}\n\n\treturn ChangelogPresetConfigSchema.passthrough().parse(preset);\n}\n","import { execFile } from \"node:child_process\";\n\nexport interface DetectedGitHost {\n\tdetectedGitHost: string;\n\tcommitUrlFormat: string;\n\tcompareUrlFormat: string;\n\tissueUrlFormat: string;\n}\n\n/**\n * Conventional-Changelog already supports the following git hosts:\n * - Github\n * - Gitlab\n * - Bitbucket\n *\n * We want to detect if the user is using another host such as Azure DevOps,\n * if so we need to create the correct URLs so the changelog is generated\n * correctly.\n */\nexport async function detectGitHost(cwd: string): Promise<DetectedGitHost | null> {\n\tconst remoteUrl = (await new Promise((onResolve, onReject) => {\n\t\texecFile(\"git\", [\"config\", \"--get\", \"remote.origin.url\"], { cwd }, (error, stdout, stderr) => {\n\t\t\tif (error) {\n\t\t\t\tonReject(error);\n\t\t\t}\n\t\t\tonResolve(stdout ? stdout.trim() : stderr);\n\t\t});\n\t})) as string;\n\n\t// A checked out Azure DevOps remote URL looks like one of these:\n\t//\n\t// | Checkout Type | Remote URL |\n\t// | ------------- | --------------------------------------------------------------------------------------- |\n\t// | HTTPS | https://{{ORGANISATION}}@dev.azure.com/{{ORGANISATION}}/{{PROJECT}}/_git/{{REPOSITORY}} |\n\t// | SSH | git@ssh.dev.azure.com:v3/{{ORGANISATION}}/{{PROJECT}}/{{REPOSITORY}} |\n\t//\n\tif (remoteUrl.startsWith(\"https://\") && remoteUrl.includes(\"@dev.azure.com/\")) {\n\t\t/**\n\t\t * [Regex101.com](https://regex101.com/r/fF7HUc/1)\n\t\t */\n\t\tconst match =\n\t\t\t/^https:\\/\\/(?<atorganisation>.*?)@dev.azure.com\\/(?<organisation>.*?)\\/(?<project>.*?)\\/_git\\/(?<repository>.*?)(?:\\.git)?$/.exec(\n\t\t\t\tremoteUrl,\n\t\t\t);\n\n\t\tif (match?.groups) {\n\t\t\tconst { organisation = \"\", project = \"\", repository = \"\" } = match.groups;\n\n\t\t\treturn {\n\t\t\t\tdetectedGitHost: \"Azure\",\n\t\t\t\tcommitUrlFormat: `{{host}}/${organisation}/${project}/_git/${repository}/commit/{{hash}}`,\n\t\t\t\tcompareUrlFormat: `{{host}}/${organisation}/${project}/_git/${repository}/branchCompare?baseVersion=GT{{previousTag}}&targetVersion=GT{{currentTag}}`,\n\t\t\t\tissueUrlFormat: `{{host}}/${organisation}/${project}/_workitems/edit/{{id}}`,\n\t\t\t};\n\t\t}\n\t} else if (remoteUrl.startsWith(\"git@ssh.dev.azure.com:\")) {\n\t\t/**\n\t\t * [Regex101.com](https://regex101.com/r/VhNxWr/1)\n\t\t */\n\t\tconst match =\n\t\t\t/^git@ssh.dev.azure.com:v\\d\\/(?<organisation>.*?)\\/(?<project>.*?)\\/(?<repository>.*?)(?:\\.git)?$/.exec(\n\t\t\t\tremoteUrl,\n\t\t\t);\n\n\t\tif (match?.groups) {\n\t\t\tconst { organisation = \"\", project = \"\", repository = \"\" } = match.groups;\n\n\t\t\treturn {\n\t\t\t\tdetectedGitHost: \"Azure\",\n\t\t\t\tcommitUrlFormat: `{{host}}/${organisation}/${project}/_git/${repository}/commit/{{hash}}`,\n\t\t\t\tcompareUrlFormat: `{{host}}/${organisation}/${project}/_git/${repository}/branchCompare?baseVersion=GT{{previousTag}}&targetVersion=GT{{currentTag}}`,\n\t\t\t\tissueUrlFormat: `{{host}}/${organisation}/${project}/_workitems/edit/{{id}}`,\n\t\t\t};\n\t\t}\n\t}\n\n\treturn null;\n}\n","import semver, { type ReleaseType } from \"semver\";\nimport conventionalRecommendedBump from \"conventional-recommended-bump\";\n\nimport { getLatestGitTagVersion } from \"../utils/git-tag-version\";\nimport { getReleaseType } from \"../utils/release-type\";\nimport type { ForkConfig } from \"../config/schema\";\nimport type { FileManager, FileState } from \"../strategies/file-manager\";\nimport type { Logger } from \"../utils/logger\";\n\nexport interface CurrentVersion {\n\tversion: string;\n\tfiles: FileState[];\n}\n\nexport async function getCurrentVersion(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tfileManager: FileManager,\n): Promise<CurrentVersion> {\n\tconst files: FileState[] = [];\n\tconst versions = new Set<string>();\n\n\tfor (const file of config.files) {\n\t\tconst fileState = fileManager.read(file);\n\n\t\tif (fileState) {\n\t\t\tfiles.push(fileState);\n\n\t\t\tif (config.currentVersion) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tversions.add(fileState.version);\n\t\t}\n\t}\n\n\tif (config.currentVersion) {\n\t\tversions.add(config.currentVersion);\n\t}\n\n\t// If we still don't have a version, try to get the latest git tag\n\tif (versions.size === 0 && config.gitTagFallback) {\n\t\tconst version = await getLatestGitTagVersion(config.tagPrefix);\n\t\tif (version) {\n\t\t\tlogger.log(`[Version] Using git tag fallback.`);\n\t\t\tversions.add(version);\n\t\t}\n\t}\n\n\tif (versions.size === 0) {\n\t\tthrow new Error(\"Unable to find current version\");\n\t} else if (versions.size > 1) {\n\t\tif (!config.allowMultipleVersions) {\n\t\t\tthrow new Error(\"Found multiple versions\");\n\t\t}\n\t\tlogger.warn(\"[WARNING] Found multiple versions, using the first one.\");\n\t\tlogger.log(`Versions: ${Array.from(versions).join(\", \")}`);\n\t}\n\n\tconst currentVersion = semver.rsort(Array.from(versions))[0];\n\n\t// If we're just inspecting the version, output the version and exit\n\tif (config.inspectVersion) {\n\t\tconsole.log(currentVersion);\n\t\tprocess.exit(0);\n\t}\n\n\tlogger.log(`Current version: ${currentVersion}`);\n\treturn {\n\t\tfiles,\n\t\tversion: currentVersion,\n\t};\n}\n\nexport interface NextVersion {\n\tversion: string;\n\tlevel?: number;\n\tpreMajor?: boolean;\n\treason?: string;\n\treleaseType?: ReleaseType;\n}\n\nexport async function getNextVersion(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tcurrentVersion: string,\n): Promise<NextVersion> {\n\tif (config.skipBump) {\n\t\tlogger.log(\"Skip bump, using current version as next version\");\n\t\treturn {\n\t\t\tversion: currentVersion,\n\t\t};\n\t}\n\n\tif (config.nextVersion && semver.valid(config.nextVersion)) {\n\t\tlogger.log(`Next version: ${config.nextVersion}`);\n\t\treturn {\n\t\t\tversion: config.nextVersion,\n\t\t};\n\t}\n\n\tconst isPreMajor = semver.lt(currentVersion, \"1.0.0\");\n\n\tlet recommendedBump: Awaited<ReturnType<typeof conventionalRecommendedBump>>;\n\ttry {\n\t\trecommendedBump = await conventionalRecommendedBump({\n\t\t\tpreset: {\n\t\t\t\tname: \"conventionalcommits\",\n\t\t\t\t...config.changelogPresetConfig,\n\t\t\t\tpreMajor: isPreMajor,\n\t\t\t},\n\t\t\tpath: config.path,\n\t\t\ttagPrefix: config.tagPrefix,\n\t\t\tcwd: config.path,\n\t\t});\n\t} catch (error) {\n\t\tthrow new Error(`[conventional-recommended-bump] Unable to determine next version`);\n\t}\n\n\tif (recommendedBump.releaseType) {\n\t\tconst releaseType = getReleaseType(\n\t\t\trecommendedBump.releaseType,\n\t\t\tcurrentVersion,\n\t\t\tconfig.preRelease,\n\t\t);\n\n\t\tconst state: NextVersion = {\n\t\t\t...recommendedBump,\n\t\t\tpreMajor: isPreMajor,\n\t\t\treleaseType,\n\t\t\tversion:\n\t\t\t\tsemver.inc(\n\t\t\t\t\tcurrentVersion,\n\t\t\t\t\treleaseType,\n\t\t\t\t\ttypeof config.preRelease === \"string\" ? config.preRelease : undefined,\n\t\t\t\t) ?? \"\",\n\t\t};\n\n\t\tlogger.log(`Next version: ${state.version} (${state.releaseType})`);\n\t\treturn state;\n\t}\n\n\tthrow new Error(\"Unable to find next version\");\n}\n","import gitSemverTags from \"git-semver-tags\";\nimport semver from \"semver\";\n\n/**\n * Get the latest git tag version.\n *\n * @example\n * ```ts\n * const tagPrefix = \"v\";\n * await getLatestGitTagVersion(tagPrefix); // 1.2.3\n * ```\n */\nexport async function getLatestGitTagVersion(tagPrefix: string | undefined): Promise<string> {\n\tconst gitTags = await gitSemverTags({ tagPrefix });\n\tif (!gitTags.length) {\n\t\treturn \"\";\n\t}\n\n\tconst cleanedTags = [];\n\n\tfor (const tag of gitTags) {\n\t\tconst cleanedTag = semver.clean(tag.replace(new RegExp(`^${tagPrefix}`), \"\"));\n\n\t\tif (cleanedTag) {\n\t\t\tcleanedTags.push(cleanedTag);\n\t\t}\n\t}\n\n\treturn cleanedTags.sort(semver.rcompare)[0];\n}\n","import semver, { type ReleaseType } from \"semver\";\n\n/**\n * Get the priority of given type.\n * @example\n * - \"patch\" => 0\n * - \"minor\" => 1\n * - \"major\" => 2\n */\nfunction getPriority(type?: string): number {\n\treturn [\"patch\", \"minor\", \"major\"].indexOf(type ?? \"\");\n}\n\n/**\n * Get the given versions highest state.\n * @example\n * - \"patch\"\n * - \"minor\"\n * - \"major\"\n */\nfunction getVersionType(version: string): \"patch\" | \"minor\" | \"major\" | undefined {\n\tconst parseVersion = semver.parse(version);\n\n\tif (parseVersion?.major) {\n\t\treturn \"major\";\n\t} else if (parseVersion?.minor) {\n\t\treturn \"minor\";\n\t} else if (parseVersion?.patch) {\n\t\treturn \"patch\";\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Get the recommended release type for the given version depending on if\n * the user asks for a prerelease with or without a tag.\n * ```js\n * getReleaseType(\"patch\", \"1.0.0\", false) => \"patch\"\n * getReleaseType(\"major\", \"0.0.0-beta\", \"beta\") => \"premajor\"\n * ```\n */\nexport function getReleaseType(\n\treleaseType: \"major\" | \"minor\" | \"patch\",\n\tcurrentVersion: string,\n\tpreReleaseTag?: string | boolean,\n): ReleaseType {\n\tif (!preReleaseTag) {\n\t\treturn releaseType;\n\t}\n\n\tconst currentVersionsIsPreRelease = Array.isArray(semver.prerelease(currentVersion));\n\tif (currentVersionsIsPreRelease) {\n\t\tconst currentReleaseType = getVersionType(currentVersion);\n\n\t\tif (\n\t\t\tcurrentReleaseType === releaseType ||\n\t\t\tgetPriority(currentReleaseType) > getPriority(releaseType)\n\t\t) {\n\t\t\treturn \"prerelease\";\n\t\t}\n\t}\n\n\treturn `pre${releaseType}`;\n}\n","import { resolve } from \"node:path\";\nimport { writeFileSync, readFileSync } from \"node:fs\";\nimport conventionalChangelog from \"conventional-changelog\";\n\nimport { fileExists } from \"../utils/file-state\";\nimport type { ForkConfig } from \"../config/schema\";\nimport type { Logger } from \"../utils/logger\";\n\n/**\n * Matches the following changelog header formats:\n * - `## [1.2.3]`\n * - `<a name=\"1.2.3\"></a>`\n */\nconst RELEASE_PATTERN = /(^#+ \\[?[0-9]+\\.[0-9]+\\.[0-9]+|<a name=)/m;\n\n/**\n * Get the existing changelog content from the latest release onwards.\n * @see {@link RELEASE_PATTERN}\n */\nfunction getOldReleaseContent(filePath: string, exists: boolean): string {\n\tif (exists) {\n\t\tconst fileContents = readFileSync(filePath, \"utf-8\");\n\t\tconst oldContentStart = fileContents.search(RELEASE_PATTERN);\n\n\t\tif (oldContentStart !== -1) {\n\t\t\treturn fileContents.substring(oldContentStart);\n\t\t}\n\t}\n\n\treturn \"\";\n}\n\n/**\n * Generate the new changelog content for this release.\n */\nfunction getNewReleaseContent(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tnextVersion: string,\n): Promise<string> {\n\treturn new Promise<string>((onResolve) => {\n\t\tlet newContent = \"\";\n\n\t\tconventionalChangelog(\n\t\t\t{\n\t\t\t\tpreset: {\n\t\t\t\t\tname: \"conventionalcommits\",\n\t\t\t\t\t...config.changelogPresetConfig,\n\t\t\t\t},\n\t\t\t\ttagPrefix: config.tagPrefix,\n\t\t\t\twarn: (...message: string[]) => logger.debug(\"[conventional-changelog] \", ...message),\n\t\t\t\tcwd: config.path,\n\t\t\t},\n\t\t\t{\n\t\t\t\tversion: nextVersion,\n\t\t\t},\n\t\t\t{\n\t\t\t\tmerges: null,\n\t\t\t\tpath: config.path,\n\t\t\t},\n\t\t)\n\t\t\t.on(\"error\", (error) => {\n\t\t\t\tlogger.error(\"[conventional-changelog] Unable to parse changes\");\n\t\t\t\tthrow error;\n\t\t\t})\n\t\t\t.on(\"data\", (chunk) => {\n\t\t\t\tnewContent += chunk.toString();\n\t\t\t})\n\t\t\t.on(\"end\", () => {\n\t\t\t\tonResolve(newContent);\n\t\t\t});\n\t});\n}\n\nexport async function updateChangelog(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tnextVersion: string,\n): Promise<void> {\n\tif (config.skipChangelog) {\n\t\tlogger.log(\"Skip changelog update\");\n\t\treturn;\n\t}\n\n\tif (config.header.search(RELEASE_PATTERN) !== -1) {\n\t\t// Need to ensure the header doesn't contain the release pattern\n\t\tthrow new Error(\"Header cannot contain release pattern\");\n\t}\n\n\t// Create the changelog file if it doesn't exist\n\tconst changelogPath = resolve(config.path, config.changelog);\n\tif (!config.dryRun && !fileExists(changelogPath)) {\n\t\tlogger.log(`Creating Changelog file: ${changelogPath}`);\n\t\twriteFileSync(changelogPath, \"\\n\", \"utf8\");\n\t}\n\n\tconst oldContent = getOldReleaseContent(changelogPath, fileExists(changelogPath));\n\tconst newContent = await getNewReleaseContent(config, logger, nextVersion);\n\n\tlogger.log(`Updating Changelog: ${changelogPath}`);\n\tif (!config.dryRun && newContent) {\n\t\twriteFileSync(\n\t\t\tchangelogPath,\n\t\t\t`${config.header}\n${newContent}\n${oldContent}\n`.trim(),\n\t\t\t\"utf8\",\n\t\t);\n\t}\n}\n","import { lstatSync } from \"fs\";\n\n/**\n * Determine if a file exists.\n * @example\n * ```ts\n * fileExists(\"~/.bashrc\"); // true\n * fileExists(\"~/missing-file.txt\"); // false\n * ```\n */\nexport function fileExists(filePath: string): boolean {\n\ttry {\n\t\treturn lstatSync(filePath).isFile();\n\t} catch (e) {\n\t\treturn false;\n\t}\n}\n","import { resolve } from \"node:path\";\nimport { formatCommitMessage } from \"../utils/format-commit-message\";\nimport { fileExists } from \"../utils/file-state\";\nimport type { ForkConfig } from \"../config/schema\";\nimport type { FileState } from \"../strategies/file-manager\";\nimport type { Logger } from \"../utils/logger\";\nimport type { Git } from \"../utils/git\";\n\nexport async function commitChanges(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tgit: Git,\n\tfiles: FileState[],\n\tnextVersion: string,\n): Promise<void> {\n\tif (config.skipCommit) {\n\t\tlogger.log(\"Skip commit\");\n\t\treturn;\n\t}\n\n\tlogger.log(\"Committing changes\");\n\n\tconst filesToCommit: string[] = [];\n\tif (fileExists(resolve(config.path, config.changelog))) {\n\t\tfilesToCommit.push(resolve(config.path, config.changelog));\n\t}\n\tfor (const file of files) {\n\t\tfilesToCommit.push(file.path);\n\t}\n\n\t// If there are no files to commit don't continue.\n\tif (filesToCommit.length === 0) {\n\t\treturn;\n\t}\n\n\tif (config.commitAll) {\n\t\tawait git.add(\"--all\");\n\t} else {\n\t\tawait git.add(...filesToCommit);\n\t}\n\n\tconst shouldVerify = config.verify ? undefined : \"--no-verify\";\n\tconst shouldSign = config.sign ? \"--gpg-sign\" : undefined;\n\n\tawait git.commit(\n\t\tshouldVerify,\n\t\tshouldSign,\n\t\t\"--message\",\n\t\tformatCommitMessage(config.changelogPresetConfig?.releaseCommitMessageFormat, nextVersion),\n\t);\n}\n","/**\n * Formats the commit message by replacing the `{{currentTag}}` placeholder\n * globally with the new version.\n *\n * Falls back to `chore(release): {{currentTag}}` if message is argument is falsy.\n */\nexport function formatCommitMessage(message: string | undefined, version: string): string {\n\tif (!message) {\n\t\tmessage = \"chore(release): {{currentTag}}\";\n\t}\n\n\treturn message.replace(new RegExp(\"{{currentTag}}\", \"g\"), version);\n}\n","import { formatCommitMessage } from \"../utils/format-commit-message\";\nimport type { ForkConfig } from \"../config/schema\";\nimport type { Logger } from \"../utils/logger\";\nimport type { Git } from \"../utils/git\";\n\nexport async function tagChanges(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tgit: Git,\n\tnextVersion: string,\n): Promise<void> {\n\tif (config.skipTag) {\n\t\tlogger.log(\"Skip tag creation\");\n\t\treturn;\n\t}\n\n\t/** @example \"v1.2.3\" or \"version/1.2.3\" */\n\tconst tag = `${config.tagPrefix}${nextVersion}`;\n\n\tlogger.log(`Creating Tag: ${tag}`);\n\n\tawait git.tag(\n\t\tconfig.sign ? \"--sign\" : \"--annotate\",\n\t\ttag,\n\t\t\"--message\",\n\t\tformatCommitMessage(config.changelogPresetConfig?.releaseCommitMessageFormat, nextVersion),\n\t);\n}\n","import { resolve } from \"node:path\";\nimport { readFileSync, writeFileSync } from \"node:fs\";\nimport detectIndent from \"detect-indent\";\nimport { detectNewline } from \"detect-newline\";\n\nimport { stringifyPackage } from \"../libs/stringify-package\";\nimport { fileExists } from \"../utils/file-state\";\nimport type { ForkConfig } from \"../config/schema\";\nimport type { Logger } from \"../utils/logger\";\nimport type { FileState, IFileManager } from \"./file-manager\";\n\n/**\n * A json package file should have a version property, like what can be seen\n * in the package.json file in the root of this project.\n *\n * @example\n * ```json\n * {\n * \"name\": \"fork-version\",\n * \"version\": \"1.2.3\",\n * \"private\": true,\n * }\n * ```\n */\nexport class JSONPackage implements IFileManager {\n\tconstructor(\n\t\tprivate config: ForkConfig,\n\t\tprivate logger: Logger,\n\t) {}\n\n\tpublic read(fileName: string): FileState | undefined {\n\t\tconst filePath = resolve(this.config.path, fileName);\n\n\t\tif (fileExists(filePath)) {\n\t\t\tconst fileContents = readFileSync(filePath, \"utf8\");\n\t\t\tconst parsedJson = JSON.parse(fileContents);\n\n\t\t\tif (parsedJson.version) {\n\t\t\t\treturn {\n\t\t\t\t\tname: fileName,\n\t\t\t\t\tpath: filePath,\n\t\t\t\t\tversion: parsedJson.version,\n\n\t\t\t\t\tisPrivate: typeof parsedJson?.private === \"boolean\" ? parsedJson.private : true,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tthis.logger.warn(`[File Manager] Unable to determine json package: ${fileName}`);\n\t\t}\n\t}\n\n\tpublic write(fileState: FileState, newVersion: string) {\n\t\tconst fileContents = readFileSync(fileState.path, \"utf8\");\n\t\tconst parsedJson = JSON.parse(fileContents);\n\n\t\tparsedJson.version = newVersion;\n\t\tif (parsedJson.packages?.[\"\"]) {\n\t\t\tparsedJson.packages[\"\"].version = newVersion; // package-lock v2 stores version here too.\n\t\t}\n\n\t\twriteFileSync(\n\t\t\tfileState.path,\n\t\t\tstringifyPackage(parsedJson, detectIndent(fileContents).indent, detectNewline(fileContents)),\n\t\t\t\"utf8\",\n\t\t);\n\t}\n\n\tpublic isSupportedFile(fileName: string): boolean {\n\t\treturn fileName.endsWith(\".json\");\n\t}\n}\n","// https://github.com/npm/stringify-package/blob/main/LICENSE\n// Extracted from npm/stringify-package\n//\n// Copyright npm, Inc\n//\n// Permission to use, copy, modify, and/or distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\nconst DEFAULT_INDENT = 2;\nconst CRLF = \"\\r\\n\";\nconst LF = \"\\n\";\n\n/**\n * @param data The object to stringify\n * @param indent `2, 4, \" \", \"\\t\"` Number of spaces a string of spaces or tab character, defaults to 2\n * @param newline `\"\\r\\n\", \"\\n\"` Windows or Unix line endings, defaults to Unix\n */\nexport function stringifyPackage(\n\tdata: object,\n\tindent?: string | number,\n\tnewline?: typeof CRLF | typeof LF,\n): string {\n\tconst stringified = JSON.stringify(data, null, indent ?? DEFAULT_INDENT);\n\n\tif (newline === CRLF) {\n\t\treturn stringified.replace(new RegExp(LF, \"g\"), CRLF);\n\t}\n\n\treturn stringified;\n}\n","import { resolve } from \"node:path\";\nimport { readFileSync, writeFileSync } from \"node:fs\";\n\nimport { fileExists } from \"../utils/file-state\";\nimport type { ForkConfig } from \"../config/schema\";\nimport type { Logger } from \"../utils/logger\";\nimport type { FileState, IFileManager } from \"./file-manager\";\n\n/**\n * A plain text file will have just the version as the content.\n *\n * @example\n * ```txt\n * 1.2.3\n * ```\n */\nexport class PlainText implements IFileManager {\n\tconstructor(\n\t\tprivate config: ForkConfig,\n\t\tprivate logger: Logger,\n\t) {}\n\n\tpublic read(fileName: string): FileState | undefined {\n\t\tconst filePath = resolve(this.config.path, fileName);\n\n\t\tif (fileExists(filePath)) {\n\t\t\tconst fileContents = readFileSync(filePath, \"utf8\");\n\n\t\t\treturn {\n\t\t\t\tname: fileName,\n\t\t\t\tpath: filePath,\n\t\t\t\tversion: fileContents || \"\",\n\t\t\t};\n\t\t}\n\n\t\tthis.logger.warn(`[File Manager] Unable to determine plain text: ${fileName}`);\n\t}\n\n\tpublic write(fileState: FileState, newVersion: string) {\n\t\twriteFileSync(fileState.path, newVersion, \"utf8\");\n\t}\n\n\tpublic isSupportedFile(fileName: string): boolean {\n\t\treturn fileName.endsWith(\"version.txt\");\n\t}\n}\n","import { resolve } from \"node:path\";\nimport { readFileSync, writeFileSync } from \"node:fs\";\nimport * as cheerio from \"cheerio/lib/slim\";\n\nimport { fileExists } from \"../utils/file-state\";\nimport type { ForkConfig } from \"../config/schema\";\nimport type { Logger } from \"../utils/logger\";\nimport type { FileState, IFileManager } from \"./file-manager\";\n\n/**\n * A ms-build file is an xml file with a version property under the Project > PropertyGroup node.\n *\n * [Microsoft Learn - MSBuild Reference](https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild?view=vs-2022)\n *\n * @example\n * ```xml\n * <Project Sdk=\"Microsoft.NET.Sdk\">\n * <PropertyGroup>\n * <Version>1.2.3</Version>\n * </PropertyGroup>\n * </Project>\n * ```\n */\nexport class MSBuildProject implements IFileManager {\n\tconstructor(\n\t\tprivate config: ForkConfig,\n\t\tprivate logger: Logger,\n\t) {}\n\n\tpublic read(fileName: string): FileState | undefined {\n\t\tconst filePath = resolve(this.config.path, fileName);\n\n\t\tif (fileExists(filePath)) {\n\t\t\tconst fileContents = readFileSync(filePath, \"utf8\");\n\t\t\tconst $ = cheerio.load(fileContents, { xmlMode: true, decodeEntities: false });\n\n\t\t\tconst version = $(\"Project > PropertyGroup > Version\").text();\n\t\t\tif (version) {\n\t\t\t\treturn {\n\t\t\t\t\tname: fileName,\n\t\t\t\t\tpath: filePath,\n\t\t\t\t\tversion: version,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tthis.logger.warn(`[File Manager] Unable to determine ms-build package: ${fileName}`);\n\t\t}\n\t}\n\n\tpublic write(fileState: FileState, newVersion: string) {\n\t\tconst fileContents = readFileSync(fileState.path, \"utf8\");\n\t\tconst $ = cheerio.load(fileContents, { xmlMode: true, decodeEntities: false });\n\n\t\t$(\"Project > PropertyGroup > Version\").text(newVersion);\n\n\t\t// Cheerio doesn't handle self-closing tags well,\n\t\t// so we're manually adding a space before the closing tag.\n\t\tconst updatedContent = $.xml().replaceAll('\"/>', '\" />');\n\n\t\twriteFileSync(fileState.path, updatedContent, \"utf8\");\n\t}\n\n\tpublic isSupportedFile(fileName: string): boolean {\n\t\t// List of known ms-build project file extensions.\n\t\t// https://stackoverflow.com/questions/2007689/is-there-a-standard-file-extension-for-msbuild-files\n\t\treturn (\n\t\t\t[\".csproj\", \".dbproj\", \".esproj\", \".fsproj\", \".props\", \".vbproj\", \".vcxproj\"].findIndex(\n\t\t\t\t(ext) => fileName.endsWith(ext),\n\t\t\t) !== -1\n\t\t);\n\t}\n}\n","import { JSONPackage } from \"./json-package\";\nimport { PlainText } from \"./plain-text\";\nimport { MSBuildProject } from \"./ms-build-project\";\n\nimport type { ForkConfig } from \"../config/schema\";\nimport type { Logger } from \"../utils/logger\";\n\nexport interface FileState {\n\tname: string;\n\tpath: string;\n\tversion: string;\n\n\t[other: string]: unknown;\n}\n\nexport interface IFileManager {\n\tread(fileName: string): FileState | undefined;\n\twrite(fileState: FileState, newVersion: string): void;\n\tisSupportedFile(fileName: string): boolean;\n}\n\nexport class FileManager {\n\tprivate JSONPackage: JSONPackage;\n\tprivate PlainText: PlainText;\n\tprivate MSBuildProject: MSBuildProject;\n\n\tconstructor(\n\t\tprivate config: ForkConfig,\n\t\tprivate logger: Logger,\n\t) {\n\t\tthis.JSONPackage = new JSONPackage(config, logger);\n\t\tthis.PlainText = new PlainText(config, logger);\n\t\tthis.MSBuildProject = new MSBuildProject(config, logger);\n\t}\n\n\t/**\n\t * Get the state from the given file name.\n\t *\n\t * @example\n\t * ```ts\n\t * fileManager.read(\"package.json\");\n\t * ```\n\t *\n\t * @returns\n\t * ```json\n\t * { \"name\": \"package.json\", \"path\": \"/path/to/package.json\", \"version\": \"1.2.3\", \"isPrivate\": true }\n\t * ```\n\t */\n\tpublic read(fileName: string): FileState | undefined {\n\t\tconst _fileName = fileName.toLowerCase();\n\n\t\tif (this.JSONPackage.isSupportedFile(_fileName)) {\n\t\t\treturn this.JSONPackage.read(fileName);\n\t\t}\n\n\t\tif (this.PlainText.isSupportedFile(_fileName)) {\n\t\t\treturn this.PlainText.read(fileName);\n\t\t}\n\n\t\tif (this.MSBuildProject.isSupportedFile(_fileName)) {\n\t\t\treturn this.MSBuildProject.read(fileName);\n\t\t}\n\n\t\tthis.logger.error(`[File Manager] Unsupported file: ${fileName}`);\n\t}\n\n\t/**\n\t * Write the new version to the given file.\n\t *\n\t * @example\n\t * ```ts\n\t * fileManager.write(\n\t * { name: \"package.json\", path: \"/path/to/package.json\", version: \"1.2.2\" },\n\t * \"1.2.3\"\n\t * );\n\t * ```\n\t */\n\tpublic write(fileState: FileState, newVersion: string): void {\n\t\tif (this.config.dryRun) {\n\t\t\treturn;\n\t\t}\n\t\tconst _fileName = fileState.name.toLowerCase();\n\n\t\tif (this.JSONPackage.isSupportedFile(_fileName)) {\n\t\t\treturn this.JSONPackage.write(fileState, newVersion);\n\t\t}\n\n\t\tif (this.PlainText.isSupportedFile(_fileName)) {\n\t\t\treturn this.PlainText.write(fileState, newVersion);\n\t\t}\n\n\t\tif (this.MSBuildProject.isSupportedFile(_fileName)) {\n\t\t\treturn this.MSBuildProject.write(fileState, newVersion);\n\t\t}\n\n\t\tthis.logger.error(`[File Manager] Unsupported file: ${fileState.path}`);\n\t}\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { ForkConfig } from \"../config/schema\";\n\nexport class Logger {\n\tdisableLogs = false;\n\n\tconstructor(private config: Pick<ForkConfig, \"silent\" | \"debug\" | \"inspectVersion\">) {\n\t\tthis.log = this.log.bind(this);\n\t\tthis.warn = this.warn.bind(this);\n\t\tthis.error = this.error.bind(this);\n\t\tthis.debug = this.debug.bind(this);\n\n\t\t// Disable logs if silent or inspectVersion is set\n\t\tthis.disableLogs = this.config.silent || this.config.inspectVersion;\n\t}\n\n\tpublic log(...messages: any[]) {\n\t\tif (!this.disableLogs) {\n\t\t\tconsole.log(...messages);\n\t\t}\n\t}\n\n\tpublic warn(...messages: any[]) {\n\t\tif (!this.disableLogs) {\n\t\t\tconsole.warn(...messages);\n\t\t}\n\t}\n\n\tpublic error(...messages: any[]) {\n\t\tif (!this.disableLogs) {\n\t\t\tconsole.error(...messages);\n\t\t}\n\t}\n\n\tpublic debug(...messages: any[]) {\n\t\tif (this.config.debug && !this.disableLogs) {\n\t\t\tconsole.debug(...messages);\n\t\t}\n\t}\n}\n"]}
@@ -185,6 +185,15 @@ var ForkConfigSchema = z.object({
185
185
  * @default false
186
186
  */
187
187
  commitAll: z.boolean().describe("Commit all changes, not just files updated by fork-version."),
188
+ /**
189
+ * By default the conventional-changelog spec will only add commit types of `feat` and `fix` to the generated changelog.
190
+ * If this flag is set, all [default commit types](https://github.com/conventional-changelog/conventional-changelog-config-spec/blob/238093090c14bd7d5151eb5316e635623ce633f9/versions/2.2.0/schema.json#L18)
191
+ * will be added to the changelog.
192
+ * @default false
193
+ */
194
+ changelogAll: z.boolean().describe(
195
+ "If this flag is set, all default commit types will be added to the changelog, not just `feat` and `fix`."
196
+ ),
188
197
  /**
189
198
  * Output debug information.
190
199
  * @default false
@@ -281,6 +290,7 @@ All notable changes to this project will be documented in this file. See [fork-v
281
290
  // Flags
282
291
  allowMultipleVersions: true,
283
292
  commitAll: false,
293
+ changelogAll: false,
284
294
  debug: false,
285
295
  dryRun: false,
286
296
  silent: false,
@@ -317,6 +327,7 @@ Options:
317
327
  Flags:
318
328
  --allow-multiple-versions Don't throw an error if multiple versions are found in the given files. [Default: true]
319
329
  --commit-all Commit all changes, not just files updated by fork-version.
330
+ --changelog-all If this flag is set, all default commit types will be added to the changelog.
320
331
  --debug Output debug information.
321
332
  --dry-run No output will be written to disk or committed.
322
333
  --silent Run without logging to the terminal.
@@ -374,6 +385,7 @@ function getCliArguments() {
374
385
  // Flags
375
386
  allowMultipleVersions: { type: "boolean" },
376
387
  commitAll: { type: "boolean" },
388
+ changelogAll: { type: "boolean" },
377
389
  debug: { type: "boolean" },
378
390
  dryRun: { type: "boolean" },
379
391
  silent: { type: "boolean" },
@@ -402,6 +414,19 @@ function getChangelogPresetConfig(mergedConfig, cliArgumentsFlags, detectedGitHo
402
414
  if (typeof conventionalChangelogConfigSpec.properties === "object") {
403
415
  Object.entries(conventionalChangelogConfigSpec.properties).forEach(([key, value]) => {
404
416
  if ("default" in value && value.default !== void 0) {
417
+ if (mergedConfig?.changelogAll && key === "types") {
418
+ const parsedTypes = z.array(ChangelogPresetConfigTypeSchema).safeParse(value.default);
419
+ if (parsedTypes.success) {
420
+ parsedTypes.data.forEach((type) => {
421
+ if (!type.section) {
422
+ delete type.hidden;
423
+ type.section = "Other Changes";
424
+ }
425
+ });
426
+ preset[key] = parsedTypes.data;
427
+ return;
428
+ }
429
+ }
405
430
  preset[key] = value.default;
406
431
  }
407
432
  });
@@ -1062,4 +1087,4 @@ var Logger = class {
1062
1087
 
1063
1088
  export { FileManager, ForkConfigSchema, Logger, commitChanges, defineConfig, getCurrentVersion, getNextVersion, getUserConfig, tagChanges, updateChangelog };
1064
1089
  //# sourceMappingURL=out.js.map
1065
- //# sourceMappingURL=chunk-D3AY65ET.js.map
1090
+ //# sourceMappingURL=chunk-ODYTFXKR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/config/schema.ts","../src/config/user-config.ts","../src/config/defaults.ts","../src/config/cli-arguments.js","../src/config/changelog-preset-config.ts","../src/config/detect-git-host.ts","../src/process/version.ts","../src/utils/git-tag-version.ts","../src/utils/release-type.ts","../src/process/changelog.ts","../src/utils/file-state.ts","../src/process/commit.ts","../src/utils/format-commit-message.ts","../src/process/tag.ts","../src/strategies/json-package.ts","../src/libs/stringify-package.ts","../src/strategies/plain-text.ts","../src/strategies/ms-build-project.ts","../src/strategies/file-manager.ts","../src/utils/logger.ts"],"names":["z","fileContent","parsed","semver","resolve","readFileSync","writeFileSync"],"mappings":";AAAA,SAAS,SAAS;AAEX,IAAM,kCAAkC,EAAE,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKvD,MAAM,EAAE,OAAO,EAAE,SAAS,6DAA6D;AAAA;AAAA;AAAA;AAAA,EAIvF,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,kCAAkC;AAAA;AAAA;AAAA;AAAA,EAIxE,SAAS,EACP,OAAO,EACP,SAAS,EACT,SAAS,8DAA8D;AAAA;AAAA;AAAA;AAAA,EAIzE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,iDAAiD;AAC1F,CAAC;AAEM,IAAM,8BAA8B,EAAE,OAAO;AAAA;AAAA;AAAA;AAAA,EAInD,OAAO,EACL,MAAM,+BAA+B,EACrC,SAAS,oDAAoD;AAAA;AAAA;AAAA;AAAA;AAAA,EAK/D,iBAAiB,EAAE,OAAO,EAAE,SAAS,iDAAiD;AAAA;AAAA;AAAA;AAAA;AAAA,EAKtF,kBAAkB,EAAE,OAAO,EAAE,SAAS,yDAAyD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM/F,gBAAgB,EAAE,OAAO,EAAE,SAAS,sCAAsC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM1E,eAAe,EAAE,OAAO,EAAE,SAAS,6DAA6D;AAAA;AAAA;AAAA;AAAA;AAAA,EAKhG,4BAA4B,EAC1B,OAAO,EACP,SAAS,0EAA0E;AAAA;AAAA;AAAA;AAAA;AAAA,EAKrF,eAAe,EACb,MAAM,EAAE,OAAO,CAAC,EAChB,SAAS,uDAAuD;AACnE,CAAC;AAEM,IAAM,mBAAmB,EAAE,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQxC,gBAAgB,EACd,QAAQ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IAAI;AACjC,SAAK,QAAQ,KAAK,MAAM,KAAK,IAAI;AAGjC,SAAK,cAAc,KAAK,OAAO,UAAU,KAAK,OAAO;AAAA,EACtD;AAAA,EAVA,cAAc;AAAA,EAYP,OAAO,UAAiB;AAC9B,QAAI,CAAC,KAAK,aAAa;AACtB,cAAQ,IAAI,GAAG,QAAQ;AAAA,IACxB;AAAA,EACD;AAAA,EAEO,QAAQ,UAAiB;AAC/B,QAAI,CAAC,KAAK,aAAa;AACtB,cAAQ,KAAK,GAAG,QAAQ;AAAA,IACzB;AAAA,EACD;AAAA,EAEO,SAAS,UAAiB;AAChC,QAAI,CAAC,KAAK,aAAa;AACtB,cAAQ,MAAM,GAAG,QAAQ;AAAA,IAC1B;AAAA,EACD;AAAA,EAEO,SAAS,UAAiB;AAChC,QAAI,KAAK,OAAO,SAAS,CAAC,KAAK,aAAa;AAC3C,cAAQ,MAAM,GAAG,QAAQ;AAAA,IAC1B;AAAA,EACD;AACD","sourcesContent":["import { z } from \"zod\";\n\nexport const ChangelogPresetConfigTypeSchema = z.object({\n\t/**\n\t * The type of commit message.\n\t * @example \"feat\", \"fix\", \"chore\", etc..\n\t */\n\ttype: z.string().describe('The type of commit message, such as \"feat\", \"fix\", \"chore\".'),\n\t/**\n\t * The scope of the commit message.\n\t */\n\tscope: z.string().optional().describe(\"The scope of the commit message.\"),\n\t/**\n\t * The section of the `CHANGELOG` the commit should show up in.\n\t */\n\tsection: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"The section of the `CHANGELOG` the commit should show up in.\"),\n\t/**\n\t * Should show in the generated changelog message?\n\t */\n\thidden: z.boolean().optional().describe(\"Should show in the generated changelog message?\"),\n});\n\nexport const ChangelogPresetConfigSchema = z.object({\n\t/**\n\t * List of explicitly supported commit message types.\n\t */\n\ttypes: z\n\t\t.array(ChangelogPresetConfigTypeSchema)\n\t\t.describe(\"List of explicitly supported commit message types.\"),\n\t/**\n\t * A URL representing a specific commit at a hash.\n\t * @default \"{{host}}/{{owner}}/{{repository}}/commit/{{hash}}\"\n\t */\n\tcommitUrlFormat: z.string().describe(\"A URL representing a specific commit at a hash.\"),\n\t/**\n\t * A URL representing the comparison between two git SHAs.\n\t * @default \"{{host}}/{{owner}}/{{repository}}/compare/{{previousTag}}...{{currentTag}}\"\n\t */\n\tcompareUrlFormat: z.string().describe(\"A URL representing the comparison between two git SHAs.\"),\n\t/**\n\t * A URL representing the issue format (allowing a different URL format to be swapped in\n\t * for Gitlab, Bitbucket, etc).\n\t * @default \"{{host}}/{{owner}}/{{repository}}/issues/{{id}}\"\n\t */\n\tissueUrlFormat: z.string().describe(\"A URL representing the issue format.\"),\n\t/**\n\t * A URL representing a user's profile on GitHub, Gitlab, etc. This URL is used\n\t * for substituting @eglavin with https://github.com/eglavin in commit messages.\n\t * @default \"{{host}}/{{user}}\"\n\t */\n\tuserUrlFormat: z.string().describe(\"A URL representing a user's profile on GitHub, Gitlab, etc.\"),\n\t/**\n\t * A string to be used to format the auto-generated release commit message.\n\t * @default \"chore(release): {{currentTag}}\"\n\t */\n\treleaseCommitMessageFormat: z\n\t\t.string()\n\t\t.describe(\"A string to be used to format the auto-generated release commit message.\"),\n\t/**\n\t * List of prefixes used to detect references to issues.\n\t * @default [\"#\"]\n\t */\n\tissuePrefixes: z\n\t\t.array(z.string())\n\t\t.describe(\"List of prefixes used to detect references to issues.\"),\n});\n\nexport const ForkConfigSchema = z.object({\n\t// Commands\n\t//\n\n\t/**\n\t * If set, fork-version will print the current version and exit.\n\t * @default false\n\t */\n\tinspectVersion: z\n\t\t.boolean()\n\t\t.describe(\"If set, fork-version will print the current version and exit.\"),\n\n\t// Options\n\t//\n\n\t/**\n\t * List of the files to be updated.\n\t * @default\n\t * ```js\n\t * [\"bower.json\", \"deno.json\", \"jsr.json\", \"manifest.json\", \"npm-shrinkwrap.json\", \"package-lock.json\", \"package.json\"]\n\t * ```\n\t */\n\tfiles: z.array(z.string()).describe(\"List of the files to be updated.\"),\n\t/**\n\t * Glob pattern to match files to be updated.\n\t *\n\t * Internally we're using [glob](https://github.com/isaacs/node-glob) to match files.\n\t *\n\t * Read more about the pattern syntax [here](https://github.com/isaacs/node-glob/tree/v10.3.12?tab=readme-ov-file#glob-primer).\n\t *\n\t * @default undefined\n\t * @example \"*.json\"\n\t */\n\tglob: z.string().optional().describe(\"Glob pattern to match files to be updated.\"),\n\t/**\n\t * The path fork-version will run from.\n\t * @default\n\t * ```js\n\t * process.cwd()\n\t * ```\n\t */\n\tpath: z.string().describe('The path fork-version will run from. Defaults to \"process.cwd()\".'),\n\t/**\n\t * Name of the changelog file.\n\t * @default \"CHANGELOG.md\"\n\t */\n\tchangelog: z.string().describe('Name of the changelog file. Defaults to \"CHANGELOG.md\".'),\n\t/**\n\t * The header text for the changelog.\n\t * @default\n\t * ```markdown\n\t * # Changelog\n\t *\n\t * All notable changes to this project will be documented in this file. See [fork-version](https://github.com/eglavin/fork-version) for commit guidelines.\n\t * ```\n\t */\n\theader: z.string().describe(\"The header text for the changelog.\"),\n\t/**\n\t * Specify a prefix for the created tag.\n\t *\n\t * For instance if your version tag is prefixed by \"version/\" instead of \"v\" you have to specify\n\t * `tagPrefix: \"version/\"`.\n\t *\n\t * `tagPrefix` can also be used for a monorepo environment where you might want to deploy\n\t * multiple package from the same repository. In this case you can specify a prefix for\n\t * each package:\n\t *\n\t * | Example Value | Tag Created |\n\t * |:-------------------------|:------------------------------|\n\t * | \"\" | `1.2.3` |\n\t * | \"version/\" | `version/1.2.3` |\n\t * | \"@eglavin/fork-version-\" | `@eglavin/fork-version-1.2.3` |\n\t *\n\t * @example \"\", \"version/\", \"@eglavin/fork-version-\"\n\t * @default \"v\"\n\t */\n\ttagPrefix: z.string().describe('Specify a prefix for the created tag. Defaults to \"v\".'),\n\t/**\n\t * Make a pre-release with optional label if given value is a string.\n\t *\n\t * | Example Value | Produced Version |\n\t * |:--------------|:-----------------|\n\t * | true | `1.2.3-0` |\n\t * | \"alpha\" | `1.2.3-alpha-0` |\n\t * | \"beta\" | `1.2.3-beta-0` |\n\t *\n\t * @example true, \"alpha\", \"beta\", \"rc\"\n\t * @default undefined\n\t */\n\tpreRelease: z\n\t\t.string()\n\t\t.or(z.boolean())\n\t\t.optional()\n\t\t.describe(\"Make a pre-release with optional label if given value is a string.\"),\n\t/**\n\t * If set, fork-version will use this version instead of trying to determine one.\n\t * @example \"1.0.0\"\n\t * @default undefined\n\t */\n\tcurrentVersion: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"If set, fork-version will use this version instead of trying to determine one.\"),\n\t/**\n\t * If set, fork-version will attempt to update to this version, instead of incrementing using \"conventional-commit\".\n\t * @example \"2.0.0\"\n\t * @default undefined\n\t */\n\tnextVersion: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\n\t\t\t'If set, fork-version will attempt to update to this version, instead of incrementing using \"conventional-commit\".',\n\t\t),\n\n\t// Flags\n\t//\n\n\t/**\n\t * Don't throw an error if multiple versions are found in the given files.\n\t * @default true\n\t */\n\tallowMultipleVersions: z\n\t\t.boolean()\n\t\t.describe(\"Don't throw an error if multiple versions are found in the given files.\"),\n\t/**\n\t * Commit all changes, not just files updated by fork-version.\n\t * @default false\n\t */\n\tcommitAll: z.boolean().describe(\"Commit all changes, not just files updated by fork-version.\"),\n\t/**\n\t * By default the conventional-changelog spec will only add commit types of `feat` and `fix` to the generated changelog.\n\t * If this flag is set, all [default commit types](https://github.com/conventional-changelog/conventional-changelog-config-spec/blob/238093090c14bd7d5151eb5316e635623ce633f9/versions/2.2.0/schema.json#L18)\n\t * will be added to the changelog.\n\t * @default false\n\t */\n\tchangelogAll: z\n\t\t.boolean()\n\t\t.describe(\n\t\t\t\"If this flag is set, all default commit types will be added to the changelog, not just `feat` and `fix`.\",\n\t\t),\n\t/**\n\t * Output debug information.\n\t * @default false\n\t */\n\tdebug: z.boolean().describe(\"Output debug information.\"),\n\t/**\n\t * No output will be written to disk or committed.\n\t * @default false\n\t */\n\tdryRun: z.boolean().describe(\"No output will be written to disk or committed.\"),\n\t/**\n\t * Run without logging to the terminal.\n\t * @default false\n\t */\n\tsilent: z.boolean().describe(\"Run without logging to the terminal.\"),\n\t/**\n\t * If unable to find a version in the given files, fallback and attempt to use the latest git tag.\n\t * @default true\n\t */\n\tgitTagFallback: z\n\t\t.boolean()\n\t\t.describe(\n\t\t\t\"If unable to find a version in the given files, fallback and attempt to use the latest git tag. Defaults to true.\",\n\t\t),\n\t/**\n\t * If true, git will sign the commit with the systems GPG key.\n\t * @see {@link https://git-scm.com/docs/git-commit#Documentation/git-commit.txt--Sltkeyidgt Git - GPG Sign Commits}\n\t * @default false\n\t */\n\tsign: z.boolean().describe(\"If true, git will sign the commit with the systems GPG key.\"),\n\t/**\n\t * If true, git will run user defined git hooks before committing.\n\t * @default false\n\t */\n\tverify: z.boolean().describe(\"If true, git will run user defined git hooks before committing.\"),\n\n\t// Skip Steps\n\t//\n\n\t/**\n\t * Skip the bump step.\n\t * @default false\n\t */\n\tskipBump: z.boolean().describe(\"Skip the bump step.\"),\n\t/**\n\t * Skip the changelog step.\n\t * @default false\n\t */\n\tskipChangelog: z.boolean().describe(\"Skip the changelog step.\"),\n\t/**\n\t * Skip the commit step.\n\t * @default false\n\t */\n\tskipCommit: z.boolean().describe(\"Skip the commit step.\"),\n\t/**\n\t * Skip the tag step.\n\t * @default false\n\t */\n\tskipTag: z.boolean().describe(\"Skip the tag step.\"),\n\n\t/**\n\t * Override the default \"conventional-changelog-conventionalcommits\" preset configuration.\n\t */\n\tchangelogPresetConfig: ChangelogPresetConfigSchema.partial().describe(\n\t\t'Override the default \"conventional-changelog-conventionalcommits\" preset configuration.',\n\t),\n\n\t/**\n\t * Add a suffix to the release commit message.\n\t * @example \"[skip ci]\"\n\t */\n\treleaseMessageSuffix: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"Add a suffix to the release commit message.\"),\n});\n\nexport type ForkConfig = z.infer<typeof ForkConfigSchema>;\n\nexport type Config = Partial<ForkConfig>;\n\nexport function defineConfig(config: Config): Config {\n\treturn config;\n}\n","import { readFileSync } from \"node:fs\";\nimport { parse, resolve } from \"node:path\";\nimport JoyCon from \"joycon\";\nimport { bundleRequire } from \"bundle-require\";\nimport { glob } from \"glob\";\nimport dotgitignore from \"dotgitignore\";\n\nimport { ForkConfigSchema, type ForkConfig } from \"./schema\";\nimport { DEFAULT_CONFIG } from \"./defaults\";\nimport { getCliArguments } from \"./cli-arguments\";\nimport { getChangelogPresetConfig } from \"./changelog-preset-config\";\nimport { detectGitHost } from \"./detect-git-host\";\n\n/**\n * Name of the key in the package.json file that contains the users configuration.\n */\nconst PACKAGE_JSON_CONFIG_KEY = \"fork-version\";\n\nexport async function getUserConfig(): Promise<ForkConfig> {\n\tconst cliArguments = getCliArguments();\n\n\tconst cwd = cliArguments.flags.path ? resolve(cliArguments.flags.path) : process.cwd();\n\tconst joycon = new JoyCon({\n\t\tcwd,\n\t\tpackageKey: PACKAGE_JSON_CONFIG_KEY,\n\t\tstopDir: parse(cwd).root,\n\t});\n\tconst configFilePath = await joycon.resolve([\n\t\t\"fork.config.ts\",\n\t\t\"fork.config.js\",\n\t\t\"fork.config.cjs\",\n\t\t\"fork.config.mjs\",\n\t\t\"fork.config.json\",\n\t\t\"package.json\",\n\t]);\n\n\tconst configFile = await loadConfigFile(configFilePath);\n\n\tconst mergedConfig = {\n\t\t...DEFAULT_CONFIG,\n\t\t...configFile,\n\t\t...cliArguments.flags,\n\t} as ForkConfig;\n\n\t// If the user has defined a glob pattern, use it to find the requested files.\n\tlet globResults: string[] = [];\n\tif (mergedConfig.glob) {\n\t\tglobResults = await glob(mergedConfig.glob, {\n\t\t\tcwd: cwd,\n\t\t\tignore: [\"node_modules/**\"],\n\t\t\tnodir: true,\n\t\t});\n\t}\n\n\tconst detectedGitHost = await detectGitHost(cwd);\n\n\treturn {\n\t\t...mergedConfig,\n\n\t\tfiles: filterGitIgnoredFiles(\n\t\t\tcwd,\n\t\t\tgetFilesList(configFile?.files, cliArguments.flags?.files, globResults),\n\t\t),\n\t\tpath: cwd,\n\t\tpreRelease:\n\t\t\t// Meow doesn't support multiple flags with the same name, so we need to check both.\n\t\t\tcliArguments.flags.preReleaseTag ?? cliArguments.flags.preRelease ?? configFile.preRelease,\n\t\tchangelogPresetConfig: getChangelogPresetConfig(\n\t\t\tmergedConfig,\n\t\t\tcliArguments.flags,\n\t\t\tdetectedGitHost,\n\t\t),\n\t};\n}\n\nasync function loadConfigFile(configFilePath: string | null) {\n\tif (!configFilePath) {\n\t\treturn {};\n\t}\n\n\t// Handle json config file.\n\tif (configFilePath.endsWith(\"json\")) {\n\t\tconst fileContent = JSON.parse(readFileSync(configFilePath).toString());\n\n\t\t// Handle package.json config file.\n\t\tif (configFilePath.endsWith(\"package.json\")) {\n\t\t\tif (\n\t\t\t\tfileContent[PACKAGE_JSON_CONFIG_KEY] &&\n\t\t\t\ttypeof fileContent[PACKAGE_JSON_CONFIG_KEY] === \"object\"\n\t\t\t) {\n\t\t\t\tconst parsed = ForkConfigSchema.partial().safeParse(fileContent[PACKAGE_JSON_CONFIG_KEY]);\n\t\t\t\tif (!parsed.success) {\n\t\t\t\t\tthrow parsed.error;\n\t\t\t\t}\n\t\t\t\treturn parsed.data;\n\t\t\t}\n\n\t\t\treturn {};\n\t\t}\n\n\t\tconst parsed = ForkConfigSchema.partial().safeParse(fileContent);\n\t\tif (!parsed.success) {\n\t\t\tthrow parsed.error;\n\t\t}\n\t\treturn parsed.data;\n\t}\n\n\t// Otherwise expect config file to use js or ts.\n\tconst fileContent = await bundleRequire({ filepath: configFilePath });\n\n\tconst parsed = ForkConfigSchema.partial().safeParse(fileContent.mod.default || fileContent.mod);\n\tif (!parsed.success) {\n\t\tthrow parsed.error;\n\t}\n\treturn parsed.data;\n}\n\nfunction getFilesList(\n\tconfigFiles: string[] | undefined,\n\tcliFiles: string[] | undefined,\n\tglobResults: string[],\n): string[] {\n\tconst listOfFiles = new Set<string>();\n\n\t// Add files from the users config file\n\tif (Array.isArray(configFiles)) {\n\t\tconfigFiles.forEach((file) => listOfFiles.add(file));\n\t}\n\n\t// Add files from the cli arguments\n\tif (Array.isArray(cliFiles)) {\n\t\tcliFiles.forEach((file) => listOfFiles.add(file));\n\t}\n\n\t// Add files from glob results\n\tglobResults.forEach((file) => listOfFiles.add(file));\n\n\t// If the user has defined files use them, otherwise use the default list of files.\n\tif (listOfFiles.size) {\n\t\treturn Array.from(listOfFiles);\n\t}\n\n\treturn DEFAULT_CONFIG.files;\n}\n\nfunction filterGitIgnoredFiles(cwd: string, files: string[]) {\n\tconst dotgit = dotgitignore({ cwd });\n\n\treturn files.filter((file) => !dotgit.ignore(file));\n}\n","import type { ForkConfig } from \"./schema\";\n\nexport const DEFAULT_CONFIG: ForkConfig = {\n\t// Commands\n\tinspectVersion: false,\n\n\t// Options\n\tfiles: [\n\t\t\"package.json\",\n\t\t\"package-lock.json\",\n\t\t\"npm-shrinkwrap.json\",\n\t\t\"jsr.json\",\n\t\t\"deno.json\",\n\t\t\"manifest.json\", // Chrome extensions\n\t\t\"bower.json\",\n\t],\n\tpath: process.cwd(),\n\tchangelog: \"CHANGELOG.md\",\n\theader: `# Changelog\n\nAll notable changes to this project will be documented in this file. See [fork-version](https://github.com/eglavin/fork-version) for commit guidelines.\n`,\n\ttagPrefix: \"v\",\n\n\t// Flags\n\tallowMultipleVersions: true,\n\tcommitAll: false,\n\tchangelogAll: false,\n\tdebug: false,\n\tdryRun: false,\n\tsilent: false,\n\tgitTagFallback: true,\n\tsign: false,\n\tverify: false,\n\n\t// Skip Steps\n\tskipBump: false,\n\tskipChangelog: false,\n\tskipCommit: false,\n\tskipTag: false,\n\n\tchangelogPresetConfig: {},\n};\n","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 [options]\n\nCommands:\n --help Show this help message.\n --version Show the current version of fork-version.\n --inspect-version If set, fork-version will print the current project version and exit.\n\nOptions:\n --file, -F List of the files to be updated. [Default: [\"bower.json\", \"deno.json\", \"jsr.json\", \"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 --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\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\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\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\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\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","import { z } from \"zod\";\nimport conventionalChangelogConfigSpec from \"conventional-changelog-config-spec\";\n\nimport {\n\tChangelogPresetConfigTypeSchema,\n\tChangelogPresetConfigSchema,\n\ttype ForkConfig,\n} from \"./schema\";\nimport type { getCliArguments } from \"./cli-arguments\";\nimport type { DetectedGitHost } from \"./detect-git-host\";\n\nexport function getChangelogPresetConfig(\n\tmergedConfig: Partial<ForkConfig> | undefined,\n\tcliArgumentsFlags: ReturnType<typeof getCliArguments>[\"flags\"],\n\tdetectedGitHost: DetectedGitHost | null,\n) {\n\tconst preset: { name: string; [_: string]: unknown } = {\n\t\tname: \"conventionalcommits\",\n\t};\n\n\t// First take any default values from the conventional-changelog-config-spec\n\tif (typeof conventionalChangelogConfigSpec.properties === \"object\") {\n\t\tObject.entries(conventionalChangelogConfigSpec.properties).forEach(([key, value]) => {\n\t\t\tif (\"default\" in value && value.default !== undefined) {\n\t\t\t\t// If the user has requested to see all types, we need to remove the hidden flag from the default types.\n\t\t\t\tif (mergedConfig?.changelogAll && key === \"types\") {\n\t\t\t\t\tconst parsedTypes = z.array(ChangelogPresetConfigTypeSchema).safeParse(value.default);\n\n\t\t\t\t\tif (parsedTypes.success) {\n\t\t\t\t\t\tparsedTypes.data.forEach((type) => {\n\t\t\t\t\t\t\tif (!type.section) {\n\t\t\t\t\t\t\t\tdelete type.hidden;\n\t\t\t\t\t\t\t\ttype.section = \"Other Changes\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\tpreset[key] = parsedTypes.data;\n\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tpreset[key] = value.default;\n\t\t\t}\n\t\t});\n\t}\n\n\t// If we've detected a git host, use the values from the detected host now so that they can\n\t// be overwritten by the users config later\n\tif (detectedGitHost) {\n\t\tObject.entries(detectedGitHost).forEach(([key, value]) => {\n\t\t\tif (value !== undefined) {\n\t\t\t\tpreset[key] = value;\n\t\t\t}\n\t\t});\n\t}\n\n\t// Then overwrite with any values from the users config\n\tif (\n\t\tmergedConfig?.changelogPresetConfig &&\n\t\ttypeof mergedConfig.changelogPresetConfig === \"object\"\n\t) {\n\t\tObject.entries(mergedConfig.changelogPresetConfig).forEach(([key, value]) => {\n\t\t\tif (value !== undefined) {\n\t\t\t\tpreset[key] = value;\n\t\t\t}\n\t\t});\n\t}\n\n\t// If the user has defined a releaseMessageSuffix, append it to the releaseCommitMessageFormat\n\tif (mergedConfig?.releaseMessageSuffix && !cliArgumentsFlags?.releaseMessageSuffix) {\n\t\tpreset.releaseCommitMessageFormat = `${preset.releaseCommitMessageFormat} ${mergedConfig.releaseMessageSuffix}`;\n\t}\n\n\t// Finally overwrite with any values from the CLI arguments\n\tif (cliArgumentsFlags?.commitUrlFormat) {\n\t\tpreset.commitUrlFormat = cliArgumentsFlags.commitUrlFormat;\n\t}\n\tif (cliArgumentsFlags?.compareUrlFormat) {\n\t\tpreset.compareUrlFormat = cliArgumentsFlags.compareUrlFormat;\n\t}\n\tif (cliArgumentsFlags?.issueUrlFormat) {\n\t\tpreset.issueUrlFormat = cliArgumentsFlags.issueUrlFormat;\n\t}\n\tif (cliArgumentsFlags?.userUrlFormat) {\n\t\tpreset.userUrlFormat = cliArgumentsFlags.userUrlFormat;\n\t}\n\tif (cliArgumentsFlags?.releaseCommitMessageFormat) {\n\t\tpreset.releaseCommitMessageFormat = cliArgumentsFlags.releaseCommitMessageFormat;\n\t}\n\tif (cliArgumentsFlags?.releaseMessageSuffix) {\n\t\tpreset.releaseCommitMessageFormat = `${preset.releaseCommitMessageFormat} ${cliArgumentsFlags.releaseMessageSuffix}`;\n\t}\n\n\treturn ChangelogPresetConfigSchema.passthrough().parse(preset);\n}\n","import { execFile } from \"node:child_process\";\n\nexport interface DetectedGitHost {\n\tdetectedGitHost: string;\n\tcommitUrlFormat: string;\n\tcompareUrlFormat: string;\n\tissueUrlFormat: string;\n}\n\n/**\n * Conventional-Changelog already supports the following git hosts:\n * - Github\n * - Gitlab\n * - Bitbucket\n *\n * We want to detect if the user is using another host such as Azure DevOps,\n * if so we need to create the correct URLs so the changelog is generated\n * correctly.\n */\nexport async function detectGitHost(cwd: string): Promise<DetectedGitHost | null> {\n\tconst remoteUrl = (await new Promise((onResolve, onReject) => {\n\t\texecFile(\"git\", [\"config\", \"--get\", \"remote.origin.url\"], { cwd }, (error, stdout, stderr) => {\n\t\t\tif (error) {\n\t\t\t\tonReject(error);\n\t\t\t}\n\t\t\tonResolve(stdout ? stdout.trim() : stderr);\n\t\t});\n\t})) as string;\n\n\t// A checked out Azure DevOps remote URL looks like one of these:\n\t//\n\t// | Checkout Type | Remote URL |\n\t// | ------------- | --------------------------------------------------------------------------------------- |\n\t// | HTTPS | https://{{ORGANISATION}}@dev.azure.com/{{ORGANISATION}}/{{PROJECT}}/_git/{{REPOSITORY}} |\n\t// | SSH | git@ssh.dev.azure.com:v3/{{ORGANISATION}}/{{PROJECT}}/{{REPOSITORY}} |\n\t//\n\tif (remoteUrl.startsWith(\"https://\") && remoteUrl.includes(\"@dev.azure.com/\")) {\n\t\t/**\n\t\t * [Regex101.com](https://regex101.com/r/fF7HUc/1)\n\t\t */\n\t\tconst match =\n\t\t\t/^https:\\/\\/(?<atorganisation>.*?)@dev.azure.com\\/(?<organisation>.*?)\\/(?<project>.*?)\\/_git\\/(?<repository>.*?)(?:\\.git)?$/.exec(\n\t\t\t\tremoteUrl,\n\t\t\t);\n\n\t\tif (match?.groups) {\n\t\t\tconst { organisation = \"\", project = \"\", repository = \"\" } = match.groups;\n\n\t\t\treturn {\n\t\t\t\tdetectedGitHost: \"Azure\",\n\t\t\t\tcommitUrlFormat: `{{host}}/${organisation}/${project}/_git/${repository}/commit/{{hash}}`,\n\t\t\t\tcompareUrlFormat: `{{host}}/${organisation}/${project}/_git/${repository}/branchCompare?baseVersion=GT{{previousTag}}&targetVersion=GT{{currentTag}}`,\n\t\t\t\tissueUrlFormat: `{{host}}/${organisation}/${project}/_workitems/edit/{{id}}`,\n\t\t\t};\n\t\t}\n\t} else if (remoteUrl.startsWith(\"git@ssh.dev.azure.com:\")) {\n\t\t/**\n\t\t * [Regex101.com](https://regex101.com/r/VhNxWr/1)\n\t\t */\n\t\tconst match =\n\t\t\t/^git@ssh.dev.azure.com:v\\d\\/(?<organisation>.*?)\\/(?<project>.*?)\\/(?<repository>.*?)(?:\\.git)?$/.exec(\n\t\t\t\tremoteUrl,\n\t\t\t);\n\n\t\tif (match?.groups) {\n\t\t\tconst { organisation = \"\", project = \"\", repository = \"\" } = match.groups;\n\n\t\t\treturn {\n\t\t\t\tdetectedGitHost: \"Azure\",\n\t\t\t\tcommitUrlFormat: `{{host}}/${organisation}/${project}/_git/${repository}/commit/{{hash}}`,\n\t\t\t\tcompareUrlFormat: `{{host}}/${organisation}/${project}/_git/${repository}/branchCompare?baseVersion=GT{{previousTag}}&targetVersion=GT{{currentTag}}`,\n\t\t\t\tissueUrlFormat: `{{host}}/${organisation}/${project}/_workitems/edit/{{id}}`,\n\t\t\t};\n\t\t}\n\t}\n\n\treturn null;\n}\n","import semver, { type ReleaseType } from \"semver\";\nimport conventionalRecommendedBump from \"conventional-recommended-bump\";\n\nimport { getLatestGitTagVersion } from \"../utils/git-tag-version\";\nimport { getReleaseType } from \"../utils/release-type\";\nimport type { ForkConfig } from \"../config/schema\";\nimport type { FileManager, FileState } from \"../strategies/file-manager\";\nimport type { Logger } from \"../utils/logger\";\n\nexport interface CurrentVersion {\n\tversion: string;\n\tfiles: FileState[];\n}\n\nexport async function getCurrentVersion(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tfileManager: FileManager,\n): Promise<CurrentVersion> {\n\tconst files: FileState[] = [];\n\tconst versions = new Set<string>();\n\n\tfor (const file of config.files) {\n\t\tconst fileState = fileManager.read(file);\n\n\t\tif (fileState) {\n\t\t\tfiles.push(fileState);\n\n\t\t\tif (config.currentVersion) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tversions.add(fileState.version);\n\t\t}\n\t}\n\n\tif (config.currentVersion) {\n\t\tversions.add(config.currentVersion);\n\t}\n\n\t// If we still don't have a version, try to get the latest git tag\n\tif (versions.size === 0 && config.gitTagFallback) {\n\t\tconst version = await getLatestGitTagVersion(config.tagPrefix);\n\t\tif (version) {\n\t\t\tlogger.log(`[Version] Using git tag fallback.`);\n\t\t\tversions.add(version);\n\t\t}\n\t}\n\n\tif (versions.size === 0) {\n\t\tthrow new Error(\"Unable to find current version\");\n\t} else if (versions.size > 1) {\n\t\tif (!config.allowMultipleVersions) {\n\t\t\tthrow new Error(\"Found multiple versions\");\n\t\t}\n\t\tlogger.warn(\"[WARNING] Found multiple versions, using the first one.\");\n\t\tlogger.log(`Versions: ${Array.from(versions).join(\", \")}`);\n\t}\n\n\tconst currentVersion = semver.rsort(Array.from(versions))[0];\n\n\t// If we're just inspecting the version, output the version and exit\n\tif (config.inspectVersion) {\n\t\tconsole.log(currentVersion);\n\t\tprocess.exit(0);\n\t}\n\n\tlogger.log(`Current version: ${currentVersion}`);\n\treturn {\n\t\tfiles,\n\t\tversion: currentVersion,\n\t};\n}\n\nexport interface NextVersion {\n\tversion: string;\n\tlevel?: number;\n\tpreMajor?: boolean;\n\treason?: string;\n\treleaseType?: ReleaseType;\n}\n\nexport async function getNextVersion(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tcurrentVersion: string,\n): Promise<NextVersion> {\n\tif (config.skipBump) {\n\t\tlogger.log(\"Skip bump, using current version as next version\");\n\t\treturn {\n\t\t\tversion: currentVersion,\n\t\t};\n\t}\n\n\tif (config.nextVersion && semver.valid(config.nextVersion)) {\n\t\tlogger.log(`Next version: ${config.nextVersion}`);\n\t\treturn {\n\t\t\tversion: config.nextVersion,\n\t\t};\n\t}\n\n\tconst isPreMajor = semver.lt(currentVersion, \"1.0.0\");\n\n\tlet recommendedBump: Awaited<ReturnType<typeof conventionalRecommendedBump>>;\n\ttry {\n\t\trecommendedBump = await conventionalRecommendedBump({\n\t\t\tpreset: {\n\t\t\t\tname: \"conventionalcommits\",\n\t\t\t\t...config.changelogPresetConfig,\n\t\t\t\tpreMajor: isPreMajor,\n\t\t\t},\n\t\t\tpath: config.path,\n\t\t\ttagPrefix: config.tagPrefix,\n\t\t\tcwd: config.path,\n\t\t});\n\t} catch (error) {\n\t\tthrow new Error(`[conventional-recommended-bump] Unable to determine next version`);\n\t}\n\n\tif (recommendedBump.releaseType) {\n\t\tconst releaseType = getReleaseType(\n\t\t\trecommendedBump.releaseType,\n\t\t\tcurrentVersion,\n\t\t\tconfig.preRelease,\n\t\t);\n\n\t\tconst state: NextVersion = {\n\t\t\t...recommendedBump,\n\t\t\tpreMajor: isPreMajor,\n\t\t\treleaseType,\n\t\t\tversion:\n\t\t\t\tsemver.inc(\n\t\t\t\t\tcurrentVersion,\n\t\t\t\t\treleaseType,\n\t\t\t\t\ttypeof config.preRelease === \"string\" ? config.preRelease : undefined,\n\t\t\t\t) ?? \"\",\n\t\t};\n\n\t\tlogger.log(`Next version: ${state.version} (${state.releaseType})`);\n\t\treturn state;\n\t}\n\n\tthrow new Error(\"Unable to find next version\");\n}\n","import gitSemverTags from \"git-semver-tags\";\nimport semver from \"semver\";\n\n/**\n * Get the latest git tag version.\n *\n * @example\n * ```ts\n * const tagPrefix = \"v\";\n * await getLatestGitTagVersion(tagPrefix); // 1.2.3\n * ```\n */\nexport async function getLatestGitTagVersion(tagPrefix: string | undefined): Promise<string> {\n\tconst gitTags = await gitSemverTags({ tagPrefix });\n\tif (!gitTags.length) {\n\t\treturn \"\";\n\t}\n\n\tconst cleanedTags = [];\n\n\tfor (const tag of gitTags) {\n\t\tconst cleanedTag = semver.clean(tag.replace(new RegExp(`^${tagPrefix}`), \"\"));\n\n\t\tif (cleanedTag) {\n\t\t\tcleanedTags.push(cleanedTag);\n\t\t}\n\t}\n\n\treturn cleanedTags.sort(semver.rcompare)[0];\n}\n","import semver, { type ReleaseType } from \"semver\";\n\n/**\n * Get the priority of given type.\n * @example\n * - \"patch\" => 0\n * - \"minor\" => 1\n * - \"major\" => 2\n */\nfunction getPriority(type?: string): number {\n\treturn [\"patch\", \"minor\", \"major\"].indexOf(type ?? \"\");\n}\n\n/**\n * Get the given versions highest state.\n * @example\n * - \"patch\"\n * - \"minor\"\n * - \"major\"\n */\nfunction getVersionType(version: string): \"patch\" | \"minor\" | \"major\" | undefined {\n\tconst parseVersion = semver.parse(version);\n\n\tif (parseVersion?.major) {\n\t\treturn \"major\";\n\t} else if (parseVersion?.minor) {\n\t\treturn \"minor\";\n\t} else if (parseVersion?.patch) {\n\t\treturn \"patch\";\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Get the recommended release type for the given version depending on if\n * the user asks for a prerelease with or without a tag.\n * ```js\n * getReleaseType(\"patch\", \"1.0.0\", false) => \"patch\"\n * getReleaseType(\"major\", \"0.0.0-beta\", \"beta\") => \"premajor\"\n * ```\n */\nexport function getReleaseType(\n\treleaseType: \"major\" | \"minor\" | \"patch\",\n\tcurrentVersion: string,\n\tpreReleaseTag?: string | boolean,\n): ReleaseType {\n\tif (!preReleaseTag) {\n\t\treturn releaseType;\n\t}\n\n\tconst currentVersionsIsPreRelease = Array.isArray(semver.prerelease(currentVersion));\n\tif (currentVersionsIsPreRelease) {\n\t\tconst currentReleaseType = getVersionType(currentVersion);\n\n\t\tif (\n\t\t\tcurrentReleaseType === releaseType ||\n\t\t\tgetPriority(currentReleaseType) > getPriority(releaseType)\n\t\t) {\n\t\t\treturn \"prerelease\";\n\t\t}\n\t}\n\n\treturn `pre${releaseType}`;\n}\n","import { resolve } from \"node:path\";\nimport { writeFileSync, readFileSync } from \"node:fs\";\nimport conventionalChangelog from \"conventional-changelog\";\n\nimport { fileExists } from \"../utils/file-state\";\nimport type { ForkConfig } from \"../config/schema\";\nimport type { Logger } from \"../utils/logger\";\n\n/**\n * Matches the following changelog header formats:\n * - `## [1.2.3]`\n * - `<a name=\"1.2.3\"></a>`\n */\nconst RELEASE_PATTERN = /(^#+ \\[?[0-9]+\\.[0-9]+\\.[0-9]+|<a name=)/m;\n\n/**\n * Get the existing changelog content from the latest release onwards.\n * @see {@link RELEASE_PATTERN}\n */\nfunction getOldReleaseContent(filePath: string, exists: boolean): string {\n\tif (exists) {\n\t\tconst fileContents = readFileSync(filePath, \"utf-8\");\n\t\tconst oldContentStart = fileContents.search(RELEASE_PATTERN);\n\n\t\tif (oldContentStart !== -1) {\n\t\t\treturn fileContents.substring(oldContentStart);\n\t\t}\n\t}\n\n\treturn \"\";\n}\n\n/**\n * Generate the new changelog content for this release.\n */\nfunction getNewReleaseContent(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tnextVersion: string,\n): Promise<string> {\n\treturn new Promise<string>((onResolve) => {\n\t\tlet newContent = \"\";\n\n\t\tconventionalChangelog(\n\t\t\t{\n\t\t\t\tpreset: {\n\t\t\t\t\tname: \"conventionalcommits\",\n\t\t\t\t\t...config.changelogPresetConfig,\n\t\t\t\t},\n\t\t\t\ttagPrefix: config.tagPrefix,\n\t\t\t\twarn: (...message: string[]) => logger.debug(\"[conventional-changelog] \", ...message),\n\t\t\t\tcwd: config.path,\n\t\t\t},\n\t\t\t{\n\t\t\t\tversion: nextVersion,\n\t\t\t},\n\t\t\t{\n\t\t\t\tmerges: null,\n\t\t\t\tpath: config.path,\n\t\t\t},\n\t\t)\n\t\t\t.on(\"error\", (error) => {\n\t\t\t\tlogger.error(\"[conventional-changelog] Unable to parse changes\");\n\t\t\t\tthrow error;\n\t\t\t})\n\t\t\t.on(\"data\", (chunk) => {\n\t\t\t\tnewContent += chunk.toString();\n\t\t\t})\n\t\t\t.on(\"end\", () => {\n\t\t\t\tonResolve(newContent);\n\t\t\t});\n\t});\n}\n\nexport async function updateChangelog(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tnextVersion: string,\n): Promise<void> {\n\tif (config.skipChangelog) {\n\t\tlogger.log(\"Skip changelog update\");\n\t\treturn;\n\t}\n\n\tif (config.header.search(RELEASE_PATTERN) !== -1) {\n\t\t// Need to ensure the header doesn't contain the release pattern\n\t\tthrow new Error(\"Header cannot contain release pattern\");\n\t}\n\n\t// Create the changelog file if it doesn't exist\n\tconst changelogPath = resolve(config.path, config.changelog);\n\tif (!config.dryRun && !fileExists(changelogPath)) {\n\t\tlogger.log(`Creating Changelog file: ${changelogPath}`);\n\t\twriteFileSync(changelogPath, \"\\n\", \"utf8\");\n\t}\n\n\tconst oldContent = getOldReleaseContent(changelogPath, fileExists(changelogPath));\n\tconst newContent = await getNewReleaseContent(config, logger, nextVersion);\n\n\tlogger.log(`Updating Changelog: ${changelogPath}`);\n\tif (!config.dryRun && newContent) {\n\t\twriteFileSync(\n\t\t\tchangelogPath,\n\t\t\t`${config.header}\n${newContent}\n${oldContent}\n`.trim(),\n\t\t\t\"utf8\",\n\t\t);\n\t}\n}\n","import { lstatSync } from \"fs\";\n\n/**\n * Determine if a file exists.\n * @example\n * ```ts\n * fileExists(\"~/.bashrc\"); // true\n * fileExists(\"~/missing-file.txt\"); // false\n * ```\n */\nexport function fileExists(filePath: string): boolean {\n\ttry {\n\t\treturn lstatSync(filePath).isFile();\n\t} catch (e) {\n\t\treturn false;\n\t}\n}\n","import { resolve } from \"node:path\";\nimport { formatCommitMessage } from \"../utils/format-commit-message\";\nimport { fileExists } from \"../utils/file-state\";\nimport type { ForkConfig } from \"../config/schema\";\nimport type { FileState } from \"../strategies/file-manager\";\nimport type { Logger } from \"../utils/logger\";\nimport type { Git } from \"../utils/git\";\n\nexport async function commitChanges(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tgit: Git,\n\tfiles: FileState[],\n\tnextVersion: string,\n): Promise<void> {\n\tif (config.skipCommit) {\n\t\tlogger.log(\"Skip commit\");\n\t\treturn;\n\t}\n\n\tlogger.log(\"Committing changes\");\n\n\tconst filesToCommit: string[] = [];\n\tif (fileExists(resolve(config.path, config.changelog))) {\n\t\tfilesToCommit.push(resolve(config.path, config.changelog));\n\t}\n\tfor (const file of files) {\n\t\tfilesToCommit.push(file.path);\n\t}\n\n\t// If there are no files to commit don't continue.\n\tif (filesToCommit.length === 0) {\n\t\treturn;\n\t}\n\n\tif (config.commitAll) {\n\t\tawait git.add(\"--all\");\n\t} else {\n\t\tawait git.add(...filesToCommit);\n\t}\n\n\tconst shouldVerify = config.verify ? undefined : \"--no-verify\";\n\tconst shouldSign = config.sign ? \"--gpg-sign\" : undefined;\n\n\tawait git.commit(\n\t\tshouldVerify,\n\t\tshouldSign,\n\t\t\"--message\",\n\t\tformatCommitMessage(config.changelogPresetConfig?.releaseCommitMessageFormat, nextVersion),\n\t);\n}\n","/**\n * Formats the commit message by replacing the `{{currentTag}}` placeholder\n * globally with the new version.\n *\n * Falls back to `chore(release): {{currentTag}}` if message is argument is falsy.\n */\nexport function formatCommitMessage(message: string | undefined, version: string): string {\n\tif (!message) {\n\t\tmessage = \"chore(release): {{currentTag}}\";\n\t}\n\n\treturn message.replace(new RegExp(\"{{currentTag}}\", \"g\"), version);\n}\n","import { formatCommitMessage } from \"../utils/format-commit-message\";\nimport type { ForkConfig } from \"../config/schema\";\nimport type { Logger } from \"../utils/logger\";\nimport type { Git } from \"../utils/git\";\n\nexport async function tagChanges(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tgit: Git,\n\tnextVersion: string,\n): Promise<void> {\n\tif (config.skipTag) {\n\t\tlogger.log(\"Skip tag creation\");\n\t\treturn;\n\t}\n\n\t/** @example \"v1.2.3\" or \"version/1.2.3\" */\n\tconst tag = `${config.tagPrefix}${nextVersion}`;\n\n\tlogger.log(`Creating Tag: ${tag}`);\n\n\tawait git.tag(\n\t\tconfig.sign ? \"--sign\" : \"--annotate\",\n\t\ttag,\n\t\t\"--message\",\n\t\tformatCommitMessage(config.changelogPresetConfig?.releaseCommitMessageFormat, nextVersion),\n\t);\n}\n","import { resolve } from \"node:path\";\nimport { readFileSync, writeFileSync } from \"node:fs\";\nimport detectIndent from \"detect-indent\";\nimport { detectNewline } from \"detect-newline\";\n\nimport { stringifyPackage } from \"../libs/stringify-package\";\nimport { fileExists } from \"../utils/file-state\";\nimport type { ForkConfig } from \"../config/schema\";\nimport type { Logger } from \"../utils/logger\";\nimport type { FileState, IFileManager } from \"./file-manager\";\n\n/**\n * A json package file should have a version property, like what can be seen\n * in the package.json file in the root of this project.\n *\n * @example\n * ```json\n * {\n * \"name\": \"fork-version\",\n * \"version\": \"1.2.3\",\n * \"private\": true,\n * }\n * ```\n */\nexport class JSONPackage implements IFileManager {\n\tconstructor(\n\t\tprivate config: ForkConfig,\n\t\tprivate logger: Logger,\n\t) {}\n\n\tpublic read(fileName: string): FileState | undefined {\n\t\tconst filePath = resolve(this.config.path, fileName);\n\n\t\tif (fileExists(filePath)) {\n\t\t\tconst fileContents = readFileSync(filePath, \"utf8\");\n\t\t\tconst parsedJson = JSON.parse(fileContents);\n\n\t\t\tif (parsedJson.version) {\n\t\t\t\treturn {\n\t\t\t\t\tname: fileName,\n\t\t\t\t\tpath: filePath,\n\t\t\t\t\tversion: parsedJson.version,\n\n\t\t\t\t\tisPrivate: typeof parsedJson?.private === \"boolean\" ? parsedJson.private : true,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tthis.logger.warn(`[File Manager] Unable to determine json package: ${fileName}`);\n\t\t}\n\t}\n\n\tpublic write(fileState: FileState, newVersion: string) {\n\t\tconst fileContents = readFileSync(fileState.path, \"utf8\");\n\t\tconst parsedJson = JSON.parse(fileContents);\n\n\t\tparsedJson.version = newVersion;\n\t\tif (parsedJson.packages?.[\"\"]) {\n\t\t\tparsedJson.packages[\"\"].version = newVersion; // package-lock v2 stores version here too.\n\t\t}\n\n\t\twriteFileSync(\n\t\t\tfileState.path,\n\t\t\tstringifyPackage(parsedJson, detectIndent(fileContents).indent, detectNewline(fileContents)),\n\t\t\t\"utf8\",\n\t\t);\n\t}\n\n\tpublic isSupportedFile(fileName: string): boolean {\n\t\treturn fileName.endsWith(\".json\");\n\t}\n}\n","// https://github.com/npm/stringify-package/blob/main/LICENSE\n// Extracted from npm/stringify-package\n//\n// Copyright npm, Inc\n//\n// Permission to use, copy, modify, and/or distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\nconst DEFAULT_INDENT = 2;\nconst CRLF = \"\\r\\n\";\nconst LF = \"\\n\";\n\n/**\n * @param data The object to stringify\n * @param indent `2, 4, \" \", \"\\t\"` Number of spaces a string of spaces or tab character, defaults to 2\n * @param newline `\"\\r\\n\", \"\\n\"` Windows or Unix line endings, defaults to Unix\n */\nexport function stringifyPackage(\n\tdata: object,\n\tindent?: string | number,\n\tnewline?: typeof CRLF | typeof LF,\n): string {\n\tconst stringified = JSON.stringify(data, null, indent ?? DEFAULT_INDENT);\n\n\tif (newline === CRLF) {\n\t\treturn stringified.replace(new RegExp(LF, \"g\"), CRLF);\n\t}\n\n\treturn stringified;\n}\n","import { resolve } from \"node:path\";\nimport { readFileSync, writeFileSync } from \"node:fs\";\n\nimport { fileExists } from \"../utils/file-state\";\nimport type { ForkConfig } from \"../config/schema\";\nimport type { Logger } from \"../utils/logger\";\nimport type { FileState, IFileManager } from \"./file-manager\";\n\n/**\n * A plain text file will have just the version as the content.\n *\n * @example\n * ```txt\n * 1.2.3\n * ```\n */\nexport class PlainText implements IFileManager {\n\tconstructor(\n\t\tprivate config: ForkConfig,\n\t\tprivate logger: Logger,\n\t) {}\n\n\tpublic read(fileName: string): FileState | undefined {\n\t\tconst filePath = resolve(this.config.path, fileName);\n\n\t\tif (fileExists(filePath)) {\n\t\t\tconst fileContents = readFileSync(filePath, \"utf8\");\n\n\t\t\treturn {\n\t\t\t\tname: fileName,\n\t\t\t\tpath: filePath,\n\t\t\t\tversion: fileContents || \"\",\n\t\t\t};\n\t\t}\n\n\t\tthis.logger.warn(`[File Manager] Unable to determine plain text: ${fileName}`);\n\t}\n\n\tpublic write(fileState: FileState, newVersion: string) {\n\t\twriteFileSync(fileState.path, newVersion, \"utf8\");\n\t}\n\n\tpublic isSupportedFile(fileName: string): boolean {\n\t\treturn fileName.endsWith(\"version.txt\");\n\t}\n}\n","import { resolve } from \"node:path\";\nimport { readFileSync, writeFileSync } from \"node:fs\";\nimport * as cheerio from \"cheerio/lib/slim\";\n\nimport { fileExists } from \"../utils/file-state\";\nimport type { ForkConfig } from \"../config/schema\";\nimport type { Logger } from \"../utils/logger\";\nimport type { FileState, IFileManager } from \"./file-manager\";\n\n/**\n * A ms-build file is an xml file with a version property under the Project > PropertyGroup node.\n *\n * [Microsoft Learn - MSBuild Reference](https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild?view=vs-2022)\n *\n * @example\n * ```xml\n * <Project Sdk=\"Microsoft.NET.Sdk\">\n * <PropertyGroup>\n * <Version>1.2.3</Version>\n * </PropertyGroup>\n * </Project>\n * ```\n */\nexport class MSBuildProject implements IFileManager {\n\tconstructor(\n\t\tprivate config: ForkConfig,\n\t\tprivate logger: Logger,\n\t) {}\n\n\tpublic read(fileName: string): FileState | undefined {\n\t\tconst filePath = resolve(this.config.path, fileName);\n\n\t\tif (fileExists(filePath)) {\n\t\t\tconst fileContents = readFileSync(filePath, \"utf8\");\n\t\t\tconst $ = cheerio.load(fileContents, { xmlMode: true, decodeEntities: false });\n\n\t\t\tconst version = $(\"Project > PropertyGroup > Version\").text();\n\t\t\tif (version) {\n\t\t\t\treturn {\n\t\t\t\t\tname: fileName,\n\t\t\t\t\tpath: filePath,\n\t\t\t\t\tversion: version,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tthis.logger.warn(`[File Manager] Unable to determine ms-build package: ${fileName}`);\n\t\t}\n\t}\n\n\tpublic write(fileState: FileState, newVersion: string) {\n\t\tconst fileContents = readFileSync(fileState.path, \"utf8\");\n\t\tconst $ = cheerio.load(fileContents, { xmlMode: true, decodeEntities: false });\n\n\t\t$(\"Project > PropertyGroup > Version\").text(newVersion);\n\n\t\t// Cheerio doesn't handle self-closing tags well,\n\t\t// so we're manually adding a space before the closing tag.\n\t\tconst updatedContent = $.xml().replaceAll('\"/>', '\" />');\n\n\t\twriteFileSync(fileState.path, updatedContent, \"utf8\");\n\t}\n\n\tpublic isSupportedFile(fileName: string): boolean {\n\t\t// List of known ms-build project file extensions.\n\t\t// https://stackoverflow.com/questions/2007689/is-there-a-standard-file-extension-for-msbuild-files\n\t\treturn (\n\t\t\t[\".csproj\", \".dbproj\", \".esproj\", \".fsproj\", \".props\", \".vbproj\", \".vcxproj\"].findIndex(\n\t\t\t\t(ext) => fileName.endsWith(ext),\n\t\t\t) !== -1\n\t\t);\n\t}\n}\n","import { JSONPackage } from \"./json-package\";\nimport { PlainText } from \"./plain-text\";\nimport { MSBuildProject } from \"./ms-build-project\";\n\nimport type { ForkConfig } from \"../config/schema\";\nimport type { Logger } from \"../utils/logger\";\n\nexport interface FileState {\n\tname: string;\n\tpath: string;\n\tversion: string;\n\n\t[other: string]: unknown;\n}\n\nexport interface IFileManager {\n\tread(fileName: string): FileState | undefined;\n\twrite(fileState: FileState, newVersion: string): void;\n\tisSupportedFile(fileName: string): boolean;\n}\n\nexport class FileManager {\n\tprivate JSONPackage: JSONPackage;\n\tprivate PlainText: PlainText;\n\tprivate MSBuildProject: MSBuildProject;\n\n\tconstructor(\n\t\tprivate config: ForkConfig,\n\t\tprivate logger: Logger,\n\t) {\n\t\tthis.JSONPackage = new JSONPackage(config, logger);\n\t\tthis.PlainText = new PlainText(config, logger);\n\t\tthis.MSBuildProject = new MSBuildProject(config, logger);\n\t}\n\n\t/**\n\t * Get the state from the given file name.\n\t *\n\t * @example\n\t * ```ts\n\t * fileManager.read(\"package.json\");\n\t * ```\n\t *\n\t * @returns\n\t * ```json\n\t * { \"name\": \"package.json\", \"path\": \"/path/to/package.json\", \"version\": \"1.2.3\", \"isPrivate\": true }\n\t * ```\n\t */\n\tpublic read(fileName: string): FileState | undefined {\n\t\tconst _fileName = fileName.toLowerCase();\n\n\t\tif (this.JSONPackage.isSupportedFile(_fileName)) {\n\t\t\treturn this.JSONPackage.read(fileName);\n\t\t}\n\n\t\tif (this.PlainText.isSupportedFile(_fileName)) {\n\t\t\treturn this.PlainText.read(fileName);\n\t\t}\n\n\t\tif (this.MSBuildProject.isSupportedFile(_fileName)) {\n\t\t\treturn this.MSBuildProject.read(fileName);\n\t\t}\n\n\t\tthis.logger.error(`[File Manager] Unsupported file: ${fileName}`);\n\t}\n\n\t/**\n\t * Write the new version to the given file.\n\t *\n\t * @example\n\t * ```ts\n\t * fileManager.write(\n\t * { name: \"package.json\", path: \"/path/to/package.json\", version: \"1.2.2\" },\n\t * \"1.2.3\"\n\t * );\n\t * ```\n\t */\n\tpublic write(fileState: FileState, newVersion: string): void {\n\t\tif (this.config.dryRun) {\n\t\t\treturn;\n\t\t}\n\t\tconst _fileName = fileState.name.toLowerCase();\n\n\t\tif (this.JSONPackage.isSupportedFile(_fileName)) {\n\t\t\treturn this.JSONPackage.write(fileState, newVersion);\n\t\t}\n\n\t\tif (this.PlainText.isSupportedFile(_fileName)) {\n\t\t\treturn this.PlainText.write(fileState, newVersion);\n\t\t}\n\n\t\tif (this.MSBuildProject.isSupportedFile(_fileName)) {\n\t\t\treturn this.MSBuildProject.write(fileState, newVersion);\n\t\t}\n\n\t\tthis.logger.error(`[File Manager] Unsupported file: ${fileState.path}`);\n\t}\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { ForkConfig } from \"../config/schema\";\n\nexport class Logger {\n\tdisableLogs = false;\n\n\tconstructor(private config: Pick<ForkConfig, \"silent\" | \"debug\" | \"inspectVersion\">) {\n\t\tthis.log = this.log.bind(this);\n\t\tthis.warn = this.warn.bind(this);\n\t\tthis.error = this.error.bind(this);\n\t\tthis.debug = this.debug.bind(this);\n\n\t\t// Disable logs if silent or inspectVersion is set\n\t\tthis.disableLogs = this.config.silent || this.config.inspectVersion;\n\t}\n\n\tpublic log(...messages: any[]) {\n\t\tif (!this.disableLogs) {\n\t\t\tconsole.log(...messages);\n\t\t}\n\t}\n\n\tpublic warn(...messages: any[]) {\n\t\tif (!this.disableLogs) {\n\t\t\tconsole.warn(...messages);\n\t\t}\n\t}\n\n\tpublic error(...messages: any[]) {\n\t\tif (!this.disableLogs) {\n\t\t\tconsole.error(...messages);\n\t\t}\n\t}\n\n\tpublic debug(...messages: any[]) {\n\t\tif (this.config.debug && !this.disableLogs) {\n\t\t\tconsole.debug(...messages);\n\t\t}\n\t}\n}\n"]}
package/dist/cli.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
- var chunkB55NV4E4_cjs = require('./chunk-B55NV4E4.cjs');
4
+ var chunkOAJOJDJP_cjs = require('./chunk-OAJOJDJP.cjs');
5
5
  var fs = require('fs');
6
6
  var path = require('path');
7
7
  var child_process = require('child_process');
@@ -60,22 +60,22 @@ var Git = class {
60
60
  // src/cli.ts
61
61
  async function runFork() {
62
62
  const startTime = Date.now();
63
- const config = await chunkB55NV4E4_cjs.getUserConfig();
64
- const logger = new chunkB55NV4E4_cjs.Logger(config);
65
- const fileManager = new chunkB55NV4E4_cjs.FileManager(config, logger);
63
+ const config = await chunkOAJOJDJP_cjs.getUserConfig();
64
+ const logger = new chunkOAJOJDJP_cjs.Logger(config);
65
+ const fileManager = new chunkOAJOJDJP_cjs.FileManager(config, logger);
66
66
  const git = new Git(config, logger);
67
67
  logger.log(`Running fork-version - ${(/* @__PURE__ */ new Date()).toUTCString()}`);
68
68
  logger.log(config.dryRun ? "[DRY RUN] No changes will be written to disk.\n" : "");
69
- const current = await chunkB55NV4E4_cjs.getCurrentVersion(config, logger, fileManager);
70
- const next = await chunkB55NV4E4_cjs.getNextVersion(config, logger, current.version);
69
+ const current = await chunkOAJOJDJP_cjs.getCurrentVersion(config, logger, fileManager);
70
+ const next = await chunkOAJOJDJP_cjs.getNextVersion(config, logger, current.version);
71
71
  logger.log("Updating Files: ");
72
72
  for (const outFile of current.files) {
73
73
  logger.log(` - ${outFile.path}`);
74
74
  fileManager.write(outFile, next.version);
75
75
  }
76
- await chunkB55NV4E4_cjs.updateChangelog(config, logger, next.version);
77
- await chunkB55NV4E4_cjs.commitChanges(config, logger, git, current.files, next.version);
78
- await chunkB55NV4E4_cjs.tagChanges(config, logger, git, next.version);
76
+ await chunkOAJOJDJP_cjs.updateChangelog(config, logger, next.version);
77
+ await chunkOAJOJDJP_cjs.commitChanges(config, logger, git, current.files, next.version);
78
+ await chunkOAJOJDJP_cjs.tagChanges(config, logger, git, next.version);
79
79
  const branchName = await git.currentBranch();
80
80
  logger.log(
81
81
  `
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { getUserConfig, Logger, FileManager, getCurrentVersion, getNextVersion, updateChangelog, commitChanges, tagChanges } from './chunk-D3AY65ET.js';
2
+ import { getUserConfig, Logger, FileManager, getCurrentVersion, getNextVersion, updateChangelog, commitChanges, tagChanges } from './chunk-ODYTFXKR.js';
3
3
  import { writeFileSync } from 'fs';
4
4
  import { join } from 'path';
5
5
  import { execFile } from 'child_process';
package/dist/index.cjs CHANGED
@@ -1,48 +1,48 @@
1
1
  'use strict';
2
2
 
3
- var chunkB55NV4E4_cjs = require('./chunk-B55NV4E4.cjs');
3
+ var chunkOAJOJDJP_cjs = require('./chunk-OAJOJDJP.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "FileManager", {
8
8
  enumerable: true,
9
- get: function () { return chunkB55NV4E4_cjs.FileManager; }
9
+ get: function () { return chunkOAJOJDJP_cjs.FileManager; }
10
10
  });
11
11
  Object.defineProperty(exports, "ForkConfigSchema", {
12
12
  enumerable: true,
13
- get: function () { return chunkB55NV4E4_cjs.ForkConfigSchema; }
13
+ get: function () { return chunkOAJOJDJP_cjs.ForkConfigSchema; }
14
14
  });
15
15
  Object.defineProperty(exports, "Logger", {
16
16
  enumerable: true,
17
- get: function () { return chunkB55NV4E4_cjs.Logger; }
17
+ get: function () { return chunkOAJOJDJP_cjs.Logger; }
18
18
  });
19
19
  Object.defineProperty(exports, "commitChanges", {
20
20
  enumerable: true,
21
- get: function () { return chunkB55NV4E4_cjs.commitChanges; }
21
+ get: function () { return chunkOAJOJDJP_cjs.commitChanges; }
22
22
  });
23
23
  Object.defineProperty(exports, "defineConfig", {
24
24
  enumerable: true,
25
- get: function () { return chunkB55NV4E4_cjs.defineConfig; }
25
+ get: function () { return chunkOAJOJDJP_cjs.defineConfig; }
26
26
  });
27
27
  Object.defineProperty(exports, "getCurrentVersion", {
28
28
  enumerable: true,
29
- get: function () { return chunkB55NV4E4_cjs.getCurrentVersion; }
29
+ get: function () { return chunkOAJOJDJP_cjs.getCurrentVersion; }
30
30
  });
31
31
  Object.defineProperty(exports, "getNextVersion", {
32
32
  enumerable: true,
33
- get: function () { return chunkB55NV4E4_cjs.getNextVersion; }
33
+ get: function () { return chunkOAJOJDJP_cjs.getNextVersion; }
34
34
  });
35
35
  Object.defineProperty(exports, "getUserConfig", {
36
36
  enumerable: true,
37
- get: function () { return chunkB55NV4E4_cjs.getUserConfig; }
37
+ get: function () { return chunkOAJOJDJP_cjs.getUserConfig; }
38
38
  });
39
39
  Object.defineProperty(exports, "tagChanges", {
40
40
  enumerable: true,
41
- get: function () { return chunkB55NV4E4_cjs.tagChanges; }
41
+ get: function () { return chunkOAJOJDJP_cjs.tagChanges; }
42
42
  });
43
43
  Object.defineProperty(exports, "updateChangelog", {
44
44
  enumerable: true,
45
- get: function () { return chunkB55NV4E4_cjs.updateChangelog; }
45
+ get: function () { return chunkOAJOJDJP_cjs.updateChangelog; }
46
46
  });
47
47
  //# sourceMappingURL=out.js.map
48
48
  //# sourceMappingURL=index.cjs.map
package/dist/index.d.cts CHANGED
@@ -104,6 +104,13 @@ declare const ForkConfigSchema: z.ZodObject<{
104
104
  * @default false
105
105
  */
106
106
  commitAll: z.ZodBoolean;
107
+ /**
108
+ * By default the conventional-changelog spec will only add commit types of `feat` and `fix` to the generated changelog.
109
+ * If this flag is set, all [default commit types](https://github.com/conventional-changelog/conventional-changelog-config-spec/blob/238093090c14bd7d5151eb5316e635623ce633f9/versions/2.2.0/schema.json#L18)
110
+ * will be added to the changelog.
111
+ * @default false
112
+ */
113
+ changelogAll: z.ZodBoolean;
107
114
  /**
108
115
  * Output debug information.
109
116
  * @default false
@@ -235,6 +242,7 @@ declare const ForkConfigSchema: z.ZodObject<{
235
242
  tagPrefix: string;
236
243
  allowMultipleVersions: boolean;
237
244
  commitAll: boolean;
245
+ changelogAll: boolean;
238
246
  debug: boolean;
239
247
  dryRun: boolean;
240
248
  silent: boolean;
@@ -273,6 +281,7 @@ declare const ForkConfigSchema: z.ZodObject<{
273
281
  tagPrefix: string;
274
282
  allowMultipleVersions: boolean;
275
283
  commitAll: boolean;
284
+ changelogAll: boolean;
276
285
  debug: boolean;
277
286
  dryRun: boolean;
278
287
  silent: boolean;
package/dist/index.d.ts CHANGED
@@ -104,6 +104,13 @@ declare const ForkConfigSchema: z.ZodObject<{
104
104
  * @default false
105
105
  */
106
106
  commitAll: z.ZodBoolean;
107
+ /**
108
+ * By default the conventional-changelog spec will only add commit types of `feat` and `fix` to the generated changelog.
109
+ * If this flag is set, all [default commit types](https://github.com/conventional-changelog/conventional-changelog-config-spec/blob/238093090c14bd7d5151eb5316e635623ce633f9/versions/2.2.0/schema.json#L18)
110
+ * will be added to the changelog.
111
+ * @default false
112
+ */
113
+ changelogAll: z.ZodBoolean;
107
114
  /**
108
115
  * Output debug information.
109
116
  * @default false
@@ -235,6 +242,7 @@ declare const ForkConfigSchema: z.ZodObject<{
235
242
  tagPrefix: string;
236
243
  allowMultipleVersions: boolean;
237
244
  commitAll: boolean;
245
+ changelogAll: boolean;
238
246
  debug: boolean;
239
247
  dryRun: boolean;
240
248
  silent: boolean;
@@ -273,6 +281,7 @@ declare const ForkConfigSchema: z.ZodObject<{
273
281
  tagPrefix: string;
274
282
  allowMultipleVersions: boolean;
275
283
  commitAll: boolean;
284
+ changelogAll: boolean;
276
285
  debug: boolean;
277
286
  dryRun: boolean;
278
287
  silent: boolean;
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export { FileManager, ForkConfigSchema, Logger, commitChanges, defineConfig, getCurrentVersion, getNextVersion, getUserConfig, tagChanges, updateChangelog } from './chunk-D3AY65ET.js';
1
+ export { FileManager, ForkConfigSchema, Logger, commitChanges, defineConfig, getCurrentVersion, getNextVersion, getUserConfig, tagChanges, updateChangelog } from './chunk-ODYTFXKR.js';
2
2
  //# sourceMappingURL=out.js.map
3
3
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fork-version",
3
- "version": "1.4.89",
3
+ "version": "1.4.90",
4
4
  "license": "MIT",
5
5
  "description": "Fork-Version automates version control tasks such as determining, updating, and committing versions, files, and changelogs, simplifying the process when adhering to the conventional commit standard.",
6
6
  "keywords": [
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/config/schema.ts","../src/config/user-config.ts","../src/config/defaults.ts","../src/config/cli-arguments.js","../src/config/changelog-preset-config.ts","../src/config/detect-git-host.ts","../src/process/version.ts","../src/utils/git-tag-version.ts","../src/utils/release-type.ts","../src/process/changelog.ts","../src/utils/file-state.ts","../src/process/commit.ts","../src/utils/format-commit-message.ts","../src/process/tag.ts","../src/strategies/json-package.ts","../src/libs/stringify-package.ts","../src/strategies/plain-text.ts","../src/strategies/ms-build-project.ts","../src/strategies/file-manager.ts","../src/utils/logger.ts"],"names":["fileContent","parsed","semver","resolve","readFileSync","writeFileSync"],"mappings":";AAAA,SAAS,SAAS;AAElB,I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\n\t * The type of commit message.\n\t * @example \"feat\", \"fix\", \"chore\", etc..\n\t */\n\ttype: z.string().describe('The type of commit message, such as \"feat\", \"fix\", \"chore\".'),\n\t/**\n\t * The scope of the commit message.\n\t */\n\tscope: z.string().optional().describe(\"The scope of the commit message.\"),\n\t/**\n\t * The section of the `CHANGELOG` the commit should show up in.\n\t */\n\tsection: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"The section of the `CHANGELOG` the commit should show up in.\"),\n\t/**\n\t * Should show in the generated changelog message?\n\t */\n\thidden: z.boolean().optional().describe(\"Should show in the generated changelog message?\"),\n});\n\nexport const ChangelogPresetConfigSchema = z.object({\n\t/**\n\t * List of explicitly supported commit message types.\n\t */\n\ttypes: z\n\t\t.array(ChangelogPresetConfigTypeSchema)\n\t\t.describe(\"List of explicitly supported commit message types.\"),\n\t/**\n\t * A URL representing a specific commit at a hash.\n\t * @default \"{{host}}/{{owner}}/{{repository}}/commit/{{hash}}\"\n\t */\n\tcommitUrlFormat: z.string().describe(\"A URL representing a specific commit at a hash.\"),\n\t/**\n\t * A URL representing the comparison between two git SHAs.\n\t * @default \"{{host}}/{{owner}}/{{repository}}/compare/{{previousTag}}...{{currentTag}}\"\n\t */\n\tcompareUrlFormat: z.string().describe(\"A URL representing the comparison between two git SHAs.\"),\n\t/**\n\t * A URL representing the issue format (allowing a different URL format to be swapped in\n\t * for Gitlab, Bitbucket, etc).\n\t * @default \"{{host}}/{{owner}}/{{repository}}/issues/{{id}}\"\n\t */\n\tissueUrlFormat: z.string().describe(\"A URL representing the issue format.\"),\n\t/**\n\t * A URL representing a user's profile on GitHub, Gitlab, etc. This URL is used\n\t * for substituting @eglavin with https://github.com/eglavin in commit messages.\n\t * @default \"{{host}}/{{user}}\"\n\t */\n\tuserUrlFormat: z.string().describe(\"A URL representing a user's profile on GitHub, Gitlab, etc.\"),\n\t/**\n\t * A string to be used to format the auto-generated release commit message.\n\t * @default \"chore(release): {{currentTag}}\"\n\t */\n\treleaseCommitMessageFormat: z\n\t\t.string()\n\t\t.describe(\"A string to be used to format the auto-generated release commit message.\"),\n\t/**\n\t * List of prefixes used to detect references to issues.\n\t * @default [\"#\"]\n\t */\n\tissuePrefixes: z\n\t\t.array(z.string())\n\t\t.describe(\"List of prefixes used to detect references to issues.\"),\n});\n\nexport const ForkConfigSchema = z.object({\n\t// Commands\n\t//\n\n\t/**\n\t * If set, fork-version will print the current version and exit.\n\t * @default false\n\t */\n\tinspectVersion: z\n\t\t.boolean()\n\t\t.describe(\"If set, fork-version will print the current version and exit.\"),\n\n\t// Options\n\t//\n\n\t/**\n\t * List of the files to be updated.\n\t * @default\n\t * ```js\n\t * [\"bower.json\", \"deno.json\", \"jsr.json\", \"manifest.json\", \"npm-shrinkwrap.json\", \"package-lock.json\", \"package.json\"]\n\t * ```\n\t */\n\tfiles: z.array(z.string()).describe(\"List of the files to be updated.\"),\n\t/**\n\t * Glob pattern to match files to be updated.\n\t *\n\t * Internally we're using [glob](https://github.com/isaacs/node-glob) to match files.\n\t *\n\t * Read more about the pattern syntax [here](https://github.com/isaacs/node-glob/tree/v10.3.12?tab=readme-ov-file#glob-primer).\n\t *\n\t * @default undefined\n\t * @example \"*.json\"\n\t */\n\tglob: z.string().optional().describe(\"Glob pattern to match files to be updated.\"),\n\t/**\n\t * The path fork-version will run from.\n\t * @default\n\t * ```js\n\t * process.cwd()\n\t * ```\n\t */\n\tpath: z.string().describe('The path fork-version will run from. Defaults to \"process.cwd()\".'),\n\t/**\n\t * Name of the changelog file.\n\t * @default \"CHANGELOG.md\"\n\t */\n\tchangelog: z.string().describe('Name of the changelog file. Defaults to \"CHANGELOG.md\".'),\n\t/**\n\t * The header text for the changelog.\n\t * @default\n\t * ```markdown\n\t * # Changelog\n\t *\n\t * All notable changes to this project will be documented in this file. See [fork-version](https://github.com/eglavin/fork-version) for commit guidelines.\n\t * ```\n\t */\n\theader: z.string().describe(\"The header text for the changelog.\"),\n\t/**\n\t * Specify a prefix for the created tag.\n\t *\n\t * For instance if your version tag is prefixed by \"version/\" instead of \"v\" you have to specify\n\t * `tagPrefix: \"version/\"`.\n\t *\n\t * `tagPrefix` can also be used for a monorepo environment where you might want to deploy\n\t * multiple package from the same repository. In this case you can specify a prefix for\n\t * each package:\n\t *\n\t * | Example Value | Tag Created |\n\t * |:-------------------------|:------------------------------|\n\t * | \"\" | `1.2.3` |\n\t * | \"version/\" | `version/1.2.3` |\n\t * | \"@eglavin/fork-version-\" | `@eglavin/fork-version-1.2.3` |\n\t *\n\t * @example \"\", \"version/\", \"@eglavin/fork-version-\"\n\t * @default \"v\"\n\t */\n\ttagPrefix: z.string().describe('Specify a prefix for the created tag. Defaults to \"v\".'),\n\t/**\n\t * Make a pre-release with optional label if given value is a string.\n\t *\n\t * | Example Value | Produced Version |\n\t * |:--------------|:-----------------|\n\t * | true | `1.2.3-0` |\n\t * | \"alpha\" | `1.2.3-alpha-0` |\n\t * | \"beta\" | `1.2.3-beta-0` |\n\t *\n\t * @example true, \"alpha\", \"beta\", \"rc\"\n\t * @default undefined\n\t */\n\tpreRelease: z\n\t\t.string()\n\t\t.or(z.boolean())\n\t\t.optional()\n\t\t.describe(\"Make a pre-release with optional label if given value is a string.\"),\n\t/**\n\t * If set, fork-version will use this version instead of trying to determine one.\n\t * @example \"1.0.0\"\n\t * @default undefined\n\t */\n\tcurrentVersion: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"If set, fork-version will use this version instead of trying to determine one.\"),\n\t/**\n\t * If set, fork-version will attempt to update to this version, instead of incrementing using \"conventional-commit\".\n\t * @example \"2.0.0\"\n\t * @default undefined\n\t */\n\tnextVersion: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\n\t\t\t'If set, fork-version will attempt to update to this version, instead of incrementing using \"conventional-commit\".',\n\t\t),\n\n\t// Flags\n\t//\n\n\t/**\n\t * Don't throw an error if multiple versions are found in the given files.\n\t * @default true\n\t */\n\tallowMultipleVersions: z\n\t\t.boolean()\n\t\t.describe(\"Don't throw an error if multiple versions are found in the given files.\"),\n\t/**\n\t * Commit all changes, not just files updated by fork-version.\n\t * @default false\n\t */\n\tcommitAll: z.boolean().describe(\"Commit all changes, not just files updated by fork-version.\"),\n\t/**\n\t * Output debug information.\n\t * @default false\n\t */\n\tdebug: z.boolean().describe(\"Output debug information.\"),\n\t/**\n\t * No output will be written to disk or committed.\n\t * @default false\n\t */\n\tdryRun: z.boolean().describe(\"No output will be written to disk or committed.\"),\n\t/**\n\t * Run without logging to the terminal.\n\t * @default false\n\t */\n\tsilent: z.boolean().describe(\"Run without logging to the terminal.\"),\n\t/**\n\t * If unable to find a version in the given files, fallback and attempt to use the latest git tag.\n\t * @default true\n\t */\n\tgitTagFallback: z\n\t\t.boolean()\n\t\t.describe(\n\t\t\t\"If unable to find a version in the given files, fallback and attempt to use the latest git tag. Defaults to true.\",\n\t\t),\n\t/**\n\t * If true, git will sign the commit with the systems GPG key.\n\t * @see {@link https://git-scm.com/docs/git-commit#Documentation/git-commit.txt--Sltkeyidgt Git - GPG Sign Commits}\n\t * @default false\n\t */\n\tsign: z.boolean().describe(\"If true, git will sign the commit with the systems GPG key.\"),\n\t/**\n\t * If true, git will run user defined git hooks before committing.\n\t * @default false\n\t */\n\tverify: z.boolean().describe(\"If true, git will run user defined git hooks before committing.\"),\n\n\t// Skip Steps\n\t//\n\n\t/**\n\t * Skip the bump step.\n\t * @default false\n\t */\n\tskipBump: z.boolean().describe(\"Skip the bump step.\"),\n\t/**\n\t * Skip the changelog step.\n\t * @default false\n\t */\n\tskipChangelog: z.boolean().describe(\"Skip the changelog step.\"),\n\t/**\n\t * Skip the commit step.\n\t * @default false\n\t */\n\tskipCommit: z.boolean().describe(\"Skip the commit step.\"),\n\t/**\n\t * Skip the tag step.\n\t * @default false\n\t */\n\tskipTag: z.boolean().describe(\"Skip the tag step.\"),\n\n\t/**\n\t * Override the default \"conventional-changelog-conventionalcommits\" preset configuration.\n\t */\n\tchangelogPresetConfig: ChangelogPresetConfigSchema.partial().describe(\n\t\t'Override the default \"conventional-changelog-conventionalcommits\" preset configuration.',\n\t),\n\n\t/**\n\t * Add a suffix to the release commit message.\n\t * @example \"[skip ci]\"\n\t */\n\treleaseMessageSuffix: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"Add a suffix to the release commit message.\"),\n});\n\nexport type ForkConfig = z.infer<typeof ForkConfigSchema>;\n\nexport type Config = Partial<ForkConfig>;\n\nexport function defineConfig(config: Config): Config {\n\treturn config;\n}\n","import { readFileSync } from \"node:fs\";\nimport { parse, resolve } from \"node:path\";\nimport JoyCon from \"joycon\";\nimport { bundleRequire } from \"bundle-require\";\nimport { glob } from \"glob\";\nimport dotgitignore from \"dotgitignore\";\n\nimport { ForkConfigSchema, type ForkConfig } from \"./schema\";\nimport { DEFAULT_CONFIG } from \"./defaults\";\nimport { getCliArguments } from \"./cli-arguments\";\nimport { getChangelogPresetConfig } from \"./changelog-preset-config\";\nimport { detectGitHost } from \"./detect-git-host\";\n\n/**\n * Name of the key in the package.json file that contains the users configuration.\n */\nconst PACKAGE_JSON_CONFIG_KEY = \"fork-version\";\n\nexport async function getUserConfig(): Promise<ForkConfig> {\n\tconst cliArguments = getCliArguments();\n\n\tconst cwd = cliArguments.flags.path ? resolve(cliArguments.flags.path) : process.cwd();\n\tconst joycon = new JoyCon({\n\t\tcwd,\n\t\tpackageKey: PACKAGE_JSON_CONFIG_KEY,\n\t\tstopDir: parse(cwd).root,\n\t});\n\tconst configFilePath = await joycon.resolve([\n\t\t\"fork.config.ts\",\n\t\t\"fork.config.js\",\n\t\t\"fork.config.cjs\",\n\t\t\"fork.config.mjs\",\n\t\t\"fork.config.json\",\n\t\t\"package.json\",\n\t]);\n\n\tconst configFile = await loadConfigFile(configFilePath);\n\n\tconst mergedConfig = {\n\t\t...DEFAULT_CONFIG,\n\t\t...configFile,\n\t\t...cliArguments.flags,\n\t} as ForkConfig;\n\n\t// If the user has defined a glob pattern, use it to find the requested files.\n\tlet globResults: string[] = [];\n\tif (mergedConfig.glob) {\n\t\tglobResults = await glob(mergedConfig.glob, {\n\t\t\tcwd: cwd,\n\t\t\tignore: [\"node_modules/**\"],\n\t\t\tnodir: true,\n\t\t});\n\t}\n\n\tconst detectedGitHost = await detectGitHost(cwd);\n\n\treturn {\n\t\t...mergedConfig,\n\n\t\tfiles: filterGitIgnoredFiles(\n\t\t\tcwd,\n\t\t\tgetFilesList(configFile?.files, cliArguments.flags?.files, globResults),\n\t\t),\n\t\tpath: cwd,\n\t\tpreRelease:\n\t\t\t// Meow doesn't support multiple flags with the same name, so we need to check both.\n\t\t\tcliArguments.flags.preReleaseTag ?? cliArguments.flags.preRelease ?? configFile.preRelease,\n\t\tchangelogPresetConfig: getChangelogPresetConfig(\n\t\t\tmergedConfig,\n\t\t\tcliArguments.flags,\n\t\t\tdetectedGitHost,\n\t\t),\n\t};\n}\n\nasync function loadConfigFile(configFilePath: string | null) {\n\tif (!configFilePath) {\n\t\treturn {};\n\t}\n\n\t// Handle json config file.\n\tif (configFilePath.endsWith(\"json\")) {\n\t\tconst fileContent = JSON.parse(readFileSync(configFilePath).toString());\n\n\t\t// Handle package.json config file.\n\t\tif (configFilePath.endsWith(\"package.json\")) {\n\t\t\tif (\n\t\t\t\tfileContent[PACKAGE_JSON_CONFIG_KEY] &&\n\t\t\t\ttypeof fileContent[PACKAGE_JSON_CONFIG_KEY] === \"object\"\n\t\t\t) {\n\t\t\t\tconst parsed = ForkConfigSchema.partial().safeParse(fileContent[PACKAGE_JSON_CONFIG_KEY]);\n\t\t\t\tif (!parsed.success) {\n\t\t\t\t\tthrow parsed.error;\n\t\t\t\t}\n\t\t\t\treturn parsed.data;\n\t\t\t}\n\n\t\t\treturn {};\n\t\t}\n\n\t\tconst parsed = ForkConfigSchema.partial().safeParse(fileContent);\n\t\tif (!parsed.success) {\n\t\t\tthrow parsed.error;\n\t\t}\n\t\treturn parsed.data;\n\t}\n\n\t// Otherwise expect config file to use js or ts.\n\tconst fileContent = await bundleRequire({ filepath: configFilePath });\n\n\tconst parsed = ForkConfigSchema.partial().safeParse(fileContent.mod.default || fileContent.mod);\n\tif (!parsed.success) {\n\t\tthrow parsed.error;\n\t}\n\treturn parsed.data;\n}\n\nfunction getFilesList(\n\tconfigFiles: string[] | undefined,\n\tcliFiles: string[] | undefined,\n\tglobResults: string[],\n): string[] {\n\tconst listOfFiles = new Set<string>();\n\n\t// Add files from the users config file\n\tif (Array.isArray(configFiles)) {\n\t\tconfigFiles.forEach((file) => listOfFiles.add(file));\n\t}\n\n\t// Add files from the cli arguments\n\tif (Array.isArray(cliFiles)) {\n\t\tcliFiles.forEach((file) => listOfFiles.add(file));\n\t}\n\n\t// Add files from glob results\n\tglobResults.forEach((file) => listOfFiles.add(file));\n\n\t// If the user has defined files use them, otherwise use the default list of files.\n\tif (listOfFiles.size) {\n\t\treturn Array.from(listOfFiles);\n\t}\n\n\treturn DEFAULT_CONFIG.files;\n}\n\nfunction filterGitIgnoredFiles(cwd: string, files: string[]) {\n\tconst dotgit = dotgitignore({ cwd });\n\n\treturn files.filter((file) => !dotgit.ignore(file));\n}\n","import type { ForkConfig } from \"./schema\";\n\nexport const DEFAULT_CONFIG: ForkConfig = {\n\t// Commands\n\tinspectVersion: false,\n\n\t// Options\n\tfiles: [\n\t\t\"package.json\",\n\t\t\"package-lock.json\",\n\t\t\"npm-shrinkwrap.json\",\n\t\t\"jsr.json\",\n\t\t\"deno.json\",\n\t\t\"manifest.json\", // Chrome extensions\n\t\t\"bower.json\",\n\t],\n\tpath: process.cwd(),\n\tchangelog: \"CHANGELOG.md\",\n\theader: `# Changelog\n\nAll notable changes to this project will be documented in this file. See [fork-version](https://github.com/eglavin/fork-version) for commit guidelines.\n`,\n\ttagPrefix: \"v\",\n\n\t// Flags\n\tallowMultipleVersions: true,\n\tcommitAll: false,\n\tdebug: false,\n\tdryRun: false,\n\tsilent: false,\n\tgitTagFallback: true,\n\tsign: false,\n\tverify: false,\n\n\t// Skip Steps\n\tskipBump: false,\n\tskipChangelog: false,\n\tskipCommit: false,\n\tskipTag: false,\n\n\tchangelogPresetConfig: {},\n};\n","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 [options]\n\nCommands:\n --help Show this help message.\n --version Show the current version of fork-version.\n --inspect-version If set, fork-version will print the current project version and exit.\n\nOptions:\n --file, -F List of the files to be updated. [Default: [\"bower.json\", \"deno.json\", \"jsr.json\", \"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 --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\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 --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\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\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\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\n\t\t\t// Flags\n\t\t\tallowMultipleVersions: { type: \"boolean\" },\n\t\t\tcommitAll: { 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","import conventionalChangelogConfigSpec from \"conventional-changelog-config-spec\";\n\nimport { ChangelogPresetConfigSchema, type ForkConfig } from \"./schema\";\nimport type { getCliArguments } from \"./cli-arguments\";\nimport type { DetectedGitHost } from \"./detect-git-host\";\n\nexport function getChangelogPresetConfig(\n\tmergedConfig: Partial<ForkConfig> | undefined,\n\tcliArgumentsFlags: ReturnType<typeof getCliArguments>[\"flags\"],\n\tdetectedGitHost: DetectedGitHost | null,\n) {\n\tconst preset: { name: string; [_: string]: unknown } = {\n\t\tname: \"conventionalcommits\",\n\t};\n\n\t// First take any default values from the conventional-changelog-config-spec\n\tif (typeof conventionalChangelogConfigSpec.properties === \"object\") {\n\t\tObject.entries(conventionalChangelogConfigSpec.properties).forEach(([key, value]) => {\n\t\t\tif (\"default\" in value && value.default !== undefined) {\n\t\t\t\tpreset[key] = value.default;\n\t\t\t}\n\t\t});\n\t}\n\n\t// If we've detected a git host, use the values from the detected host now so that they can\n\t// be overwritten by the users config later\n\tif (detectedGitHost) {\n\t\tObject.entries(detectedGitHost).forEach(([key, value]) => {\n\t\t\tif (value !== undefined) {\n\t\t\t\tpreset[key] = value;\n\t\t\t}\n\t\t});\n\t}\n\n\t// Then overwrite with any values from the users config\n\tif (\n\t\tmergedConfig?.changelogPresetConfig &&\n\t\ttypeof mergedConfig.changelogPresetConfig === \"object\"\n\t) {\n\t\tObject.entries(mergedConfig.changelogPresetConfig).forEach(([key, value]) => {\n\t\t\tif (value !== undefined) {\n\t\t\t\tpreset[key] = value;\n\t\t\t}\n\t\t});\n\t}\n\n\t// If the user has defined a releaseMessageSuffix, append it to the releaseCommitMessageFormat\n\tif (mergedConfig?.releaseMessageSuffix && !cliArgumentsFlags?.releaseMessageSuffix) {\n\t\tpreset.releaseCommitMessageFormat = `${preset.releaseCommitMessageFormat} ${mergedConfig.releaseMessageSuffix}`;\n\t}\n\n\t// Finally overwrite with any values from the CLI arguments\n\tif (cliArgumentsFlags?.commitUrlFormat) {\n\t\tpreset.commitUrlFormat = cliArgumentsFlags.commitUrlFormat;\n\t}\n\tif (cliArgumentsFlags?.compareUrlFormat) {\n\t\tpreset.compareUrlFormat = cliArgumentsFlags.compareUrlFormat;\n\t}\n\tif (cliArgumentsFlags?.issueUrlFormat) {\n\t\tpreset.issueUrlFormat = cliArgumentsFlags.issueUrlFormat;\n\t}\n\tif (cliArgumentsFlags?.userUrlFormat) {\n\t\tpreset.userUrlFormat = cliArgumentsFlags.userUrlFormat;\n\t}\n\tif (cliArgumentsFlags?.releaseCommitMessageFormat) {\n\t\tpreset.releaseCommitMessageFormat = cliArgumentsFlags.releaseCommitMessageFormat;\n\t}\n\tif (cliArgumentsFlags?.releaseMessageSuffix) {\n\t\tpreset.releaseCommitMessageFormat = `${preset.releaseCommitMessageFormat} ${cliArgumentsFlags.releaseMessageSuffix}`;\n\t}\n\n\treturn ChangelogPresetConfigSchema.passthrough().parse(preset);\n}\n","import { execFile } from \"node:child_process\";\n\nexport interface DetectedGitHost {\n\tdetectedGitHost: string;\n\tcommitUrlFormat: string;\n\tcompareUrlFormat: string;\n\tissueUrlFormat: string;\n}\n\n/**\n * Conventional-Changelog already supports the following git hosts:\n * - Github\n * - Gitlab\n * - Bitbucket\n *\n * We want to detect if the user is using another host such as Azure DevOps,\n * if so we need to create the correct URLs so the changelog is generated\n * correctly.\n */\nexport async function detectGitHost(cwd: string): Promise<DetectedGitHost | null> {\n\tconst remoteUrl = (await new Promise((onResolve, onReject) => {\n\t\texecFile(\"git\", [\"config\", \"--get\", \"remote.origin.url\"], { cwd }, (error, stdout, stderr) => {\n\t\t\tif (error) {\n\t\t\t\tonReject(error);\n\t\t\t}\n\t\t\tonResolve(stdout ? stdout.trim() : stderr);\n\t\t});\n\t})) as string;\n\n\t// A checked out Azure DevOps remote URL looks like one of these:\n\t//\n\t// | Checkout Type | Remote URL |\n\t// | ------------- | --------------------------------------------------------------------------------------- |\n\t// | HTTPS | https://{{ORGANISATION}}@dev.azure.com/{{ORGANISATION}}/{{PROJECT}}/_git/{{REPOSITORY}} |\n\t// | SSH | git@ssh.dev.azure.com:v3/{{ORGANISATION}}/{{PROJECT}}/{{REPOSITORY}} |\n\t//\n\tif (remoteUrl.startsWith(\"https://\") && remoteUrl.includes(\"@dev.azure.com/\")) {\n\t\t/**\n\t\t * [Regex101.com](https://regex101.com/r/fF7HUc/1)\n\t\t */\n\t\tconst match =\n\t\t\t/^https:\\/\\/(?<atorganisation>.*?)@dev.azure.com\\/(?<organisation>.*?)\\/(?<project>.*?)\\/_git\\/(?<repository>.*?)(?:\\.git)?$/.exec(\n\t\t\t\tremoteUrl,\n\t\t\t);\n\n\t\tif (match?.groups) {\n\t\t\tconst { organisation = \"\", project = \"\", repository = \"\" } = match.groups;\n\n\t\t\treturn {\n\t\t\t\tdetectedGitHost: \"Azure\",\n\t\t\t\tcommitUrlFormat: `{{host}}/${organisation}/${project}/_git/${repository}/commit/{{hash}}`,\n\t\t\t\tcompareUrlFormat: `{{host}}/${organisation}/${project}/_git/${repository}/branchCompare?baseVersion=GT{{previousTag}}&targetVersion=GT{{currentTag}}`,\n\t\t\t\tissueUrlFormat: `{{host}}/${organisation}/${project}/_workitems/edit/{{id}}`,\n\t\t\t};\n\t\t}\n\t} else if (remoteUrl.startsWith(\"git@ssh.dev.azure.com:\")) {\n\t\t/**\n\t\t * [Regex101.com](https://regex101.com/r/VhNxWr/1)\n\t\t */\n\t\tconst match =\n\t\t\t/^git@ssh.dev.azure.com:v\\d\\/(?<organisation>.*?)\\/(?<project>.*?)\\/(?<repository>.*?)(?:\\.git)?$/.exec(\n\t\t\t\tremoteUrl,\n\t\t\t);\n\n\t\tif (match?.groups) {\n\t\t\tconst { organisation = \"\", project = \"\", repository = \"\" } = match.groups;\n\n\t\t\treturn {\n\t\t\t\tdetectedGitHost: \"Azure\",\n\t\t\t\tcommitUrlFormat: `{{host}}/${organisation}/${project}/_git/${repository}/commit/{{hash}}`,\n\t\t\t\tcompareUrlFormat: `{{host}}/${organisation}/${project}/_git/${repository}/branchCompare?baseVersion=GT{{previousTag}}&targetVersion=GT{{currentTag}}`,\n\t\t\t\tissueUrlFormat: `{{host}}/${organisation}/${project}/_workitems/edit/{{id}}`,\n\t\t\t};\n\t\t}\n\t}\n\n\treturn null;\n}\n","import semver, { type ReleaseType } from \"semver\";\nimport conventionalRecommendedBump from \"conventional-recommended-bump\";\n\nimport { getLatestGitTagVersion } from \"../utils/git-tag-version\";\nimport { getReleaseType } from \"../utils/release-type\";\nimport type { ForkConfig } from \"../config/schema\";\nimport type { FileManager, FileState } from \"../strategies/file-manager\";\nimport type { Logger } from \"../utils/logger\";\n\nexport interface CurrentVersion {\n\tversion: string;\n\tfiles: FileState[];\n}\n\nexport async function getCurrentVersion(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tfileManager: FileManager,\n): Promise<CurrentVersion> {\n\tconst files: FileState[] = [];\n\tconst versions = new Set<string>();\n\n\tfor (const file of config.files) {\n\t\tconst fileState = fileManager.read(file);\n\n\t\tif (fileState) {\n\t\t\tfiles.push(fileState);\n\n\t\t\tif (config.currentVersion) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tversions.add(fileState.version);\n\t\t}\n\t}\n\n\tif (config.currentVersion) {\n\t\tversions.add(config.currentVersion);\n\t}\n\n\t// If we still don't have a version, try to get the latest git tag\n\tif (versions.size === 0 && config.gitTagFallback) {\n\t\tconst version = await getLatestGitTagVersion(config.tagPrefix);\n\t\tif (version) {\n\t\t\tlogger.log(`[Version] Using git tag fallback.`);\n\t\t\tversions.add(version);\n\t\t}\n\t}\n\n\tif (versions.size === 0) {\n\t\tthrow new Error(\"Unable to find current version\");\n\t} else if (versions.size > 1) {\n\t\tif (!config.allowMultipleVersions) {\n\t\t\tthrow new Error(\"Found multiple versions\");\n\t\t}\n\t\tlogger.warn(\"[WARNING] Found multiple versions, using the first one.\");\n\t\tlogger.log(`Versions: ${Array.from(versions).join(\", \")}`);\n\t}\n\n\tconst currentVersion = semver.rsort(Array.from(versions))[0];\n\n\t// If we're just inspecting the version, output the version and exit\n\tif (config.inspectVersion) {\n\t\tconsole.log(currentVersion);\n\t\tprocess.exit(0);\n\t}\n\n\tlogger.log(`Current version: ${currentVersion}`);\n\treturn {\n\t\tfiles,\n\t\tversion: currentVersion,\n\t};\n}\n\nexport interface NextVersion {\n\tversion: string;\n\tlevel?: number;\n\tpreMajor?: boolean;\n\treason?: string;\n\treleaseType?: ReleaseType;\n}\n\nexport async function getNextVersion(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tcurrentVersion: string,\n): Promise<NextVersion> {\n\tif (config.skipBump) {\n\t\tlogger.log(\"Skip bump, using current version as next version\");\n\t\treturn {\n\t\t\tversion: currentVersion,\n\t\t};\n\t}\n\n\tif (config.nextVersion && semver.valid(config.nextVersion)) {\n\t\tlogger.log(`Next version: ${config.nextVersion}`);\n\t\treturn {\n\t\t\tversion: config.nextVersion,\n\t\t};\n\t}\n\n\tconst isPreMajor = semver.lt(currentVersion, \"1.0.0\");\n\n\tlet recommendedBump: Awaited<ReturnType<typeof conventionalRecommendedBump>>;\n\ttry {\n\t\trecommendedBump = await conventionalRecommendedBump({\n\t\t\tpreset: {\n\t\t\t\tname: \"conventionalcommits\",\n\t\t\t\t...config.changelogPresetConfig,\n\t\t\t\tpreMajor: isPreMajor,\n\t\t\t},\n\t\t\tpath: config.path,\n\t\t\ttagPrefix: config.tagPrefix,\n\t\t\tcwd: config.path,\n\t\t});\n\t} catch (error) {\n\t\tthrow new Error(`[conventional-recommended-bump] Unable to determine next version`);\n\t}\n\n\tif (recommendedBump.releaseType) {\n\t\tconst releaseType = getReleaseType(\n\t\t\trecommendedBump.releaseType,\n\t\t\tcurrentVersion,\n\t\t\tconfig.preRelease,\n\t\t);\n\n\t\tconst state: NextVersion = {\n\t\t\t...recommendedBump,\n\t\t\tpreMajor: isPreMajor,\n\t\t\treleaseType,\n\t\t\tversion:\n\t\t\t\tsemver.inc(\n\t\t\t\t\tcurrentVersion,\n\t\t\t\t\treleaseType,\n\t\t\t\t\ttypeof config.preRelease === \"string\" ? config.preRelease : undefined,\n\t\t\t\t) ?? \"\",\n\t\t};\n\n\t\tlogger.log(`Next version: ${state.version} (${state.releaseType})`);\n\t\treturn state;\n\t}\n\n\tthrow new Error(\"Unable to find next version\");\n}\n","import gitSemverTags from \"git-semver-tags\";\nimport semver from \"semver\";\n\n/**\n * Get the latest git tag version.\n *\n * @example\n * ```ts\n * const tagPrefix = \"v\";\n * await getLatestGitTagVersion(tagPrefix); // 1.2.3\n * ```\n */\nexport async function getLatestGitTagVersion(tagPrefix: string | undefined): Promise<string> {\n\tconst gitTags = await gitSemverTags({ tagPrefix });\n\tif (!gitTags.length) {\n\t\treturn \"\";\n\t}\n\n\tconst cleanedTags = [];\n\n\tfor (const tag of gitTags) {\n\t\tconst cleanedTag = semver.clean(tag.replace(new RegExp(`^${tagPrefix}`), \"\"));\n\n\t\tif (cleanedTag) {\n\t\t\tcleanedTags.push(cleanedTag);\n\t\t}\n\t}\n\n\treturn cleanedTags.sort(semver.rcompare)[0];\n}\n","import semver, { type ReleaseType } from \"semver\";\n\n/**\n * Get the priority of given type.\n * @example\n * - \"patch\" => 0\n * - \"minor\" => 1\n * - \"major\" => 2\n */\nfunction getPriority(type?: string): number {\n\treturn [\"patch\", \"minor\", \"major\"].indexOf(type ?? \"\");\n}\n\n/**\n * Get the given versions highest state.\n * @example\n * - \"patch\"\n * - \"minor\"\n * - \"major\"\n */\nfunction getVersionType(version: string): \"patch\" | \"minor\" | \"major\" | undefined {\n\tconst parseVersion = semver.parse(version);\n\n\tif (parseVersion?.major) {\n\t\treturn \"major\";\n\t} else if (parseVersion?.minor) {\n\t\treturn \"minor\";\n\t} else if (parseVersion?.patch) {\n\t\treturn \"patch\";\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Get the recommended release type for the given version depending on if\n * the user asks for a prerelease with or without a tag.\n * ```js\n * getReleaseType(\"patch\", \"1.0.0\", false) => \"patch\"\n * getReleaseType(\"major\", \"0.0.0-beta\", \"beta\") => \"premajor\"\n * ```\n */\nexport function getReleaseType(\n\treleaseType: \"major\" | \"minor\" | \"patch\",\n\tcurrentVersion: string,\n\tpreReleaseTag?: string | boolean,\n): ReleaseType {\n\tif (!preReleaseTag) {\n\t\treturn releaseType;\n\t}\n\n\tconst currentVersionsIsPreRelease = Array.isArray(semver.prerelease(currentVersion));\n\tif (currentVersionsIsPreRelease) {\n\t\tconst currentReleaseType = getVersionType(currentVersion);\n\n\t\tif (\n\t\t\tcurrentReleaseType === releaseType ||\n\t\t\tgetPriority(currentReleaseType) > getPriority(releaseType)\n\t\t) {\n\t\t\treturn \"prerelease\";\n\t\t}\n\t}\n\n\treturn `pre${releaseType}`;\n}\n","import { resolve } from \"node:path\";\nimport { writeFileSync, readFileSync } from \"node:fs\";\nimport conventionalChangelog from \"conventional-changelog\";\n\nimport { fileExists } from \"../utils/file-state\";\nimport type { ForkConfig } from \"../config/schema\";\nimport type { Logger } from \"../utils/logger\";\n\n/**\n * Matches the following changelog header formats:\n * - `## [1.2.3]`\n * - `<a name=\"1.2.3\"></a>`\n */\nconst RELEASE_PATTERN = /(^#+ \\[?[0-9]+\\.[0-9]+\\.[0-9]+|<a name=)/m;\n\n/**\n * Get the existing changelog content from the latest release onwards.\n * @see {@link RELEASE_PATTERN}\n */\nfunction getOldReleaseContent(filePath: string, exists: boolean): string {\n\tif (exists) {\n\t\tconst fileContents = readFileSync(filePath, \"utf-8\");\n\t\tconst oldContentStart = fileContents.search(RELEASE_PATTERN);\n\n\t\tif (oldContentStart !== -1) {\n\t\t\treturn fileContents.substring(oldContentStart);\n\t\t}\n\t}\n\n\treturn \"\";\n}\n\n/**\n * Generate the new changelog content for this release.\n */\nfunction getNewReleaseContent(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tnextVersion: string,\n): Promise<string> {\n\treturn new Promise<string>((onResolve) => {\n\t\tlet newContent = \"\";\n\n\t\tconventionalChangelog(\n\t\t\t{\n\t\t\t\tpreset: {\n\t\t\t\t\tname: \"conventionalcommits\",\n\t\t\t\t\t...config.changelogPresetConfig,\n\t\t\t\t},\n\t\t\t\ttagPrefix: config.tagPrefix,\n\t\t\t\twarn: (...message: string[]) => logger.debug(\"[conventional-changelog] \", ...message),\n\t\t\t\tcwd: config.path,\n\t\t\t},\n\t\t\t{\n\t\t\t\tversion: nextVersion,\n\t\t\t},\n\t\t\t{\n\t\t\t\tmerges: null,\n\t\t\t\tpath: config.path,\n\t\t\t},\n\t\t)\n\t\t\t.on(\"error\", (error) => {\n\t\t\t\tlogger.error(\"[conventional-changelog] Unable to parse changes\");\n\t\t\t\tthrow error;\n\t\t\t})\n\t\t\t.on(\"data\", (chunk) => {\n\t\t\t\tnewContent += chunk.toString();\n\t\t\t})\n\t\t\t.on(\"end\", () => {\n\t\t\t\tonResolve(newContent);\n\t\t\t});\n\t});\n}\n\nexport async function updateChangelog(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tnextVersion: string,\n): Promise<void> {\n\tif (config.skipChangelog) {\n\t\tlogger.log(\"Skip changelog update\");\n\t\treturn;\n\t}\n\n\tif (config.header.search(RELEASE_PATTERN) !== -1) {\n\t\t// Need to ensure the header doesn't contain the release pattern\n\t\tthrow new Error(\"Header cannot contain release pattern\");\n\t}\n\n\t// Create the changelog file if it doesn't exist\n\tconst changelogPath = resolve(config.path, config.changelog);\n\tif (!config.dryRun && !fileExists(changelogPath)) {\n\t\tlogger.log(`Creating Changelog file: ${changelogPath}`);\n\t\twriteFileSync(changelogPath, \"\\n\", \"utf8\");\n\t}\n\n\tconst oldContent = getOldReleaseContent(changelogPath, fileExists(changelogPath));\n\tconst newContent = await getNewReleaseContent(config, logger, nextVersion);\n\n\tlogger.log(`Updating Changelog: ${changelogPath}`);\n\tif (!config.dryRun && newContent) {\n\t\twriteFileSync(\n\t\t\tchangelogPath,\n\t\t\t`${config.header}\n${newContent}\n${oldContent}\n`.trim(),\n\t\t\t\"utf8\",\n\t\t);\n\t}\n}\n","import { lstatSync } from \"fs\";\n\n/**\n * Determine if a file exists.\n * @example\n * ```ts\n * fileExists(\"~/.bashrc\"); // true\n * fileExists(\"~/missing-file.txt\"); // false\n * ```\n */\nexport function fileExists(filePath: string): boolean {\n\ttry {\n\t\treturn lstatSync(filePath).isFile();\n\t} catch (e) {\n\t\treturn false;\n\t}\n}\n","import { resolve } from \"node:path\";\nimport { formatCommitMessage } from \"../utils/format-commit-message\";\nimport { fileExists } from \"../utils/file-state\";\nimport type { ForkConfig } from \"../config/schema\";\nimport type { FileState } from \"../strategies/file-manager\";\nimport type { Logger } from \"../utils/logger\";\nimport type { Git } from \"../utils/git\";\n\nexport async function commitChanges(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tgit: Git,\n\tfiles: FileState[],\n\tnextVersion: string,\n): Promise<void> {\n\tif (config.skipCommit) {\n\t\tlogger.log(\"Skip commit\");\n\t\treturn;\n\t}\n\n\tlogger.log(\"Committing changes\");\n\n\tconst filesToCommit: string[] = [];\n\tif (fileExists(resolve(config.path, config.changelog))) {\n\t\tfilesToCommit.push(resolve(config.path, config.changelog));\n\t}\n\tfor (const file of files) {\n\t\tfilesToCommit.push(file.path);\n\t}\n\n\t// If there are no files to commit don't continue.\n\tif (filesToCommit.length === 0) {\n\t\treturn;\n\t}\n\n\tif (config.commitAll) {\n\t\tawait git.add(\"--all\");\n\t} else {\n\t\tawait git.add(...filesToCommit);\n\t}\n\n\tconst shouldVerify = config.verify ? undefined : \"--no-verify\";\n\tconst shouldSign = config.sign ? \"--gpg-sign\" : undefined;\n\n\tawait git.commit(\n\t\tshouldVerify,\n\t\tshouldSign,\n\t\t\"--message\",\n\t\tformatCommitMessage(config.changelogPresetConfig?.releaseCommitMessageFormat, nextVersion),\n\t);\n}\n","/**\n * Formats the commit message by replacing the `{{currentTag}}` placeholder\n * globally with the new version.\n *\n * Falls back to `chore(release): {{currentTag}}` if message is argument is falsy.\n */\nexport function formatCommitMessage(message: string | undefined, version: string): string {\n\tif (!message) {\n\t\tmessage = \"chore(release): {{currentTag}}\";\n\t}\n\n\treturn message.replace(new RegExp(\"{{currentTag}}\", \"g\"), version);\n}\n","import { formatCommitMessage } from \"../utils/format-commit-message\";\nimport type { ForkConfig } from \"../config/schema\";\nimport type { Logger } from \"../utils/logger\";\nimport type { Git } from \"../utils/git\";\n\nexport async function tagChanges(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tgit: Git,\n\tnextVersion: string,\n): Promise<void> {\n\tif (config.skipTag) {\n\t\tlogger.log(\"Skip tag creation\");\n\t\treturn;\n\t}\n\n\t/** @example \"v1.2.3\" or \"version/1.2.3\" */\n\tconst tag = `${config.tagPrefix}${nextVersion}`;\n\n\tlogger.log(`Creating Tag: ${tag}`);\n\n\tawait git.tag(\n\t\tconfig.sign ? \"--sign\" : \"--annotate\",\n\t\ttag,\n\t\t\"--message\",\n\t\tformatCommitMessage(config.changelogPresetConfig?.releaseCommitMessageFormat, nextVersion),\n\t);\n}\n","import { resolve } from \"node:path\";\nimport { readFileSync, writeFileSync } from \"node:fs\";\nimport detectIndent from \"detect-indent\";\nimport { detectNewline } from \"detect-newline\";\n\nimport { stringifyPackage } from \"../libs/stringify-package\";\nimport { fileExists } from \"../utils/file-state\";\nimport type { ForkConfig } from \"../config/schema\";\nimport type { Logger } from \"../utils/logger\";\nimport type { FileState, IFileManager } from \"./file-manager\";\n\n/**\n * A json package file should have a version property, like what can be seen\n * in the package.json file in the root of this project.\n *\n * @example\n * ```json\n * {\n * \"name\": \"fork-version\",\n * \"version\": \"1.2.3\",\n * \"private\": true,\n * }\n * ```\n */\nexport class JSONPackage implements IFileManager {\n\tconstructor(\n\t\tprivate config: ForkConfig,\n\t\tprivate logger: Logger,\n\t) {}\n\n\tpublic read(fileName: string): FileState | undefined {\n\t\tconst filePath = resolve(this.config.path, fileName);\n\n\t\tif (fileExists(filePath)) {\n\t\t\tconst fileContents = readFileSync(filePath, \"utf8\");\n\t\t\tconst parsedJson = JSON.parse(fileContents);\n\n\t\t\tif (parsedJson.version) {\n\t\t\t\treturn {\n\t\t\t\t\tname: fileName,\n\t\t\t\t\tpath: filePath,\n\t\t\t\t\tversion: parsedJson.version,\n\n\t\t\t\t\tisPrivate: typeof parsedJson?.private === \"boolean\" ? parsedJson.private : true,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tthis.logger.warn(`[File Manager] Unable to determine json package: ${fileName}`);\n\t\t}\n\t}\n\n\tpublic write(fileState: FileState, newVersion: string) {\n\t\tconst fileContents = readFileSync(fileState.path, \"utf8\");\n\t\tconst parsedJson = JSON.parse(fileContents);\n\n\t\tparsedJson.version = newVersion;\n\t\tif (parsedJson.packages?.[\"\"]) {\n\t\t\tparsedJson.packages[\"\"].version = newVersion; // package-lock v2 stores version here too.\n\t\t}\n\n\t\twriteFileSync(\n\t\t\tfileState.path,\n\t\t\tstringifyPackage(parsedJson, detectIndent(fileContents).indent, detectNewline(fileContents)),\n\t\t\t\"utf8\",\n\t\t);\n\t}\n\n\tpublic isSupportedFile(fileName: string): boolean {\n\t\treturn fileName.endsWith(\".json\");\n\t}\n}\n","// https://github.com/npm/stringify-package/blob/main/LICENSE\n// Extracted from npm/stringify-package\n//\n// Copyright npm, Inc\n//\n// Permission to use, copy, modify, and/or distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\nconst DEFAULT_INDENT = 2;\nconst CRLF = \"\\r\\n\";\nconst LF = \"\\n\";\n\n/**\n * @param data The object to stringify\n * @param indent `2, 4, \" \", \"\\t\"` Number of spaces a string of spaces or tab character, defaults to 2\n * @param newline `\"\\r\\n\", \"\\n\"` Windows or Unix line endings, defaults to Unix\n */\nexport function stringifyPackage(\n\tdata: object,\n\tindent?: string | number,\n\tnewline?: typeof CRLF | typeof LF,\n): string {\n\tconst stringified = JSON.stringify(data, null, indent ?? DEFAULT_INDENT);\n\n\tif (newline === CRLF) {\n\t\treturn stringified.replace(new RegExp(LF, \"g\"), CRLF);\n\t}\n\n\treturn stringified;\n}\n","import { resolve } from \"node:path\";\nimport { readFileSync, writeFileSync } from \"node:fs\";\n\nimport { fileExists } from \"../utils/file-state\";\nimport type { ForkConfig } from \"../config/schema\";\nimport type { Logger } from \"../utils/logger\";\nimport type { FileState, IFileManager } from \"./file-manager\";\n\n/**\n * A plain text file will have just the version as the content.\n *\n * @example\n * ```txt\n * 1.2.3\n * ```\n */\nexport class PlainText implements IFileManager {\n\tconstructor(\n\t\tprivate config: ForkConfig,\n\t\tprivate logger: Logger,\n\t) {}\n\n\tpublic read(fileName: string): FileState | undefined {\n\t\tconst filePath = resolve(this.config.path, fileName);\n\n\t\tif (fileExists(filePath)) {\n\t\t\tconst fileContents = readFileSync(filePath, \"utf8\");\n\n\t\t\treturn {\n\t\t\t\tname: fileName,\n\t\t\t\tpath: filePath,\n\t\t\t\tversion: fileContents || \"\",\n\t\t\t};\n\t\t}\n\n\t\tthis.logger.warn(`[File Manager] Unable to determine plain text: ${fileName}`);\n\t}\n\n\tpublic write(fileState: FileState, newVersion: string) {\n\t\twriteFileSync(fileState.path, newVersion, \"utf8\");\n\t}\n\n\tpublic isSupportedFile(fileName: string): boolean {\n\t\treturn fileName.endsWith(\"version.txt\");\n\t}\n}\n","import { resolve } from \"node:path\";\nimport { readFileSync, writeFileSync } from \"node:fs\";\nimport * as cheerio from \"cheerio/lib/slim\";\n\nimport { fileExists } from \"../utils/file-state\";\nimport type { ForkConfig } from \"../config/schema\";\nimport type { Logger } from \"../utils/logger\";\nimport type { FileState, IFileManager } from \"./file-manager\";\n\n/**\n * A ms-build file is an xml file with a version property under the Project > PropertyGroup node.\n *\n * [Microsoft Learn - MSBuild Reference](https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild?view=vs-2022)\n *\n * @example\n * ```xml\n * <Project Sdk=\"Microsoft.NET.Sdk\">\n * <PropertyGroup>\n * <Version>1.2.3</Version>\n * </PropertyGroup>\n * </Project>\n * ```\n */\nexport class MSBuildProject implements IFileManager {\n\tconstructor(\n\t\tprivate config: ForkConfig,\n\t\tprivate logger: Logger,\n\t) {}\n\n\tpublic read(fileName: string): FileState | undefined {\n\t\tconst filePath = resolve(this.config.path, fileName);\n\n\t\tif (fileExists(filePath)) {\n\t\t\tconst fileContents = readFileSync(filePath, \"utf8\");\n\t\t\tconst $ = cheerio.load(fileContents, { xmlMode: true, decodeEntities: false });\n\n\t\t\tconst version = $(\"Project > PropertyGroup > Version\").text();\n\t\t\tif (version) {\n\t\t\t\treturn {\n\t\t\t\t\tname: fileName,\n\t\t\t\t\tpath: filePath,\n\t\t\t\t\tversion: version,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tthis.logger.warn(`[File Manager] Unable to determine ms-build package: ${fileName}`);\n\t\t}\n\t}\n\n\tpublic write(fileState: FileState, newVersion: string) {\n\t\tconst fileContents = readFileSync(fileState.path, \"utf8\");\n\t\tconst $ = cheerio.load(fileContents, { xmlMode: true, decodeEntities: false });\n\n\t\t$(\"Project > PropertyGroup > Version\").text(newVersion);\n\n\t\t// Cheerio doesn't handle self-closing tags well,\n\t\t// so we're manually adding a space before the closing tag.\n\t\tconst updatedContent = $.xml().replaceAll('\"/>', '\" />');\n\n\t\twriteFileSync(fileState.path, updatedContent, \"utf8\");\n\t}\n\n\tpublic isSupportedFile(fileName: string): boolean {\n\t\t// List of known ms-build project file extensions.\n\t\t// https://stackoverflow.com/questions/2007689/is-there-a-standard-file-extension-for-msbuild-files\n\t\treturn (\n\t\t\t[\".csproj\", \".dbproj\", \".esproj\", \".fsproj\", \".props\", \".vbproj\", \".vcxproj\"].findIndex(\n\t\t\t\t(ext) => fileName.endsWith(ext),\n\t\t\t) !== -1\n\t\t);\n\t}\n}\n","import { JSONPackage } from \"./json-package\";\nimport { PlainText } from \"./plain-text\";\nimport { MSBuildProject } from \"./ms-build-project\";\n\nimport type { ForkConfig } from \"../config/schema\";\nimport type { Logger } from \"../utils/logger\";\n\nexport interface FileState {\n\tname: string;\n\tpath: string;\n\tversion: string;\n\n\t[other: string]: unknown;\n}\n\nexport interface IFileManager {\n\tread(fileName: string): FileState | undefined;\n\twrite(fileState: FileState, newVersion: string): void;\n\tisSupportedFile(fileName: string): boolean;\n}\n\nexport class FileManager {\n\tprivate JSONPackage: JSONPackage;\n\tprivate PlainText: PlainText;\n\tprivate MSBuildProject: MSBuildProject;\n\n\tconstructor(\n\t\tprivate config: ForkConfig,\n\t\tprivate logger: Logger,\n\t) {\n\t\tthis.JSONPackage = new JSONPackage(config, logger);\n\t\tthis.PlainText = new PlainText(config, logger);\n\t\tthis.MSBuildProject = new MSBuildProject(config, logger);\n\t}\n\n\t/**\n\t * Get the state from the given file name.\n\t *\n\t * @example\n\t * ```ts\n\t * fileManager.read(\"package.json\");\n\t * ```\n\t *\n\t * @returns\n\t * ```json\n\t * { \"name\": \"package.json\", \"path\": \"/path/to/package.json\", \"version\": \"1.2.3\", \"isPrivate\": true }\n\t * ```\n\t */\n\tpublic read(fileName: string): FileState | undefined {\n\t\tconst _fileName = fileName.toLowerCase();\n\n\t\tif (this.JSONPackage.isSupportedFile(_fileName)) {\n\t\t\treturn this.JSONPackage.read(fileName);\n\t\t}\n\n\t\tif (this.PlainText.isSupportedFile(_fileName)) {\n\t\t\treturn this.PlainText.read(fileName);\n\t\t}\n\n\t\tif (this.MSBuildProject.isSupportedFile(_fileName)) {\n\t\t\treturn this.MSBuildProject.read(fileName);\n\t\t}\n\n\t\tthis.logger.error(`[File Manager] Unsupported file: ${fileName}`);\n\t}\n\n\t/**\n\t * Write the new version to the given file.\n\t *\n\t * @example\n\t * ```ts\n\t * fileManager.write(\n\t * { name: \"package.json\", path: \"/path/to/package.json\", version: \"1.2.2\" },\n\t * \"1.2.3\"\n\t * );\n\t * ```\n\t */\n\tpublic write(fileState: FileState, newVersion: string): void {\n\t\tif (this.config.dryRun) {\n\t\t\treturn;\n\t\t}\n\t\tconst _fileName = fileState.name.toLowerCase();\n\n\t\tif (this.JSONPackage.isSupportedFile(_fileName)) {\n\t\t\treturn this.JSONPackage.write(fileState, newVersion);\n\t\t}\n\n\t\tif (this.PlainText.isSupportedFile(_fileName)) {\n\t\t\treturn this.PlainText.write(fileState, newVersion);\n\t\t}\n\n\t\tif (this.MSBuildProject.isSupportedFile(_fileName)) {\n\t\t\treturn this.MSBuildProject.write(fileState, newVersion);\n\t\t}\n\n\t\tthis.logger.error(`[File Manager] Unsupported file: ${fileState.path}`);\n\t}\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { ForkConfig } from \"../config/schema\";\n\nexport class Logger {\n\tdisableLogs = false;\n\n\tconstructor(private config: Pick<ForkConfig, \"silent\" | \"debug\" | \"inspectVersion\">) {\n\t\tthis.log = this.log.bind(this);\n\t\tthis.warn = this.warn.bind(this);\n\t\tthis.error = this.error.bind(this);\n\t\tthis.debug = this.debug.bind(this);\n\n\t\t// Disable logs if silent or inspectVersion is set\n\t\tthis.disableLogs = this.config.silent || this.config.inspectVersion;\n\t}\n\n\tpublic log(...messages: any[]) {\n\t\tif (!this.disableLogs) {\n\t\t\tconsole.log(...messages);\n\t\t}\n\t}\n\n\tpublic warn(...messages: any[]) {\n\t\tif (!this.disableLogs) {\n\t\t\tconsole.warn(...messages);\n\t\t}\n\t}\n\n\tpublic error(...messages: any[]) {\n\t\tif (!this.disableLogs) {\n\t\t\tconsole.error(...messages);\n\t\t}\n\t}\n\n\tpublic debug(...messages: any[]) {\n\t\tif (this.config.debug && !this.disableLogs) {\n\t\t\tconsole.debug(...messages);\n\t\t}\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/config/schema.ts","../src/config/user-config.ts","../src/config/defaults.ts","../src/config/cli-arguments.js","../src/config/changelog-preset-config.ts","../src/config/detect-git-host.ts","../src/process/version.ts","../src/utils/git-tag-version.ts","../src/utils/release-type.ts","../src/process/changelog.ts","../src/utils/file-state.ts","../src/process/commit.ts","../src/utils/format-commit-message.ts","../src/process/tag.ts","../src/strategies/json-package.ts","../src/libs/stringify-package.ts","../src/strategies/plain-text.ts","../src/strategies/ms-build-project.ts","../src/strategies/file-manager.ts","../src/utils/logger.ts"],"names":["fileContent","parsed","semver","resolve","readFileSync","writeFileSync"],"mappings":";AAAA,SAAS,SAAS;AAElB,IAAM,kCAAkC,EAAE,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKhD,MAAM,EAAE,OAAO,EAAE,SAAS,6DAA6D;AAAA;AAAA;AAAA;AAAA,EAIvF,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,kCAAkC;AAAA;AAAA;AAAA;AAAA,EAIxE,SAAS,EACP,OAAO,EACP,SAAS,EACT,SAAS,8DAA8D;AAAA;AAAA;AAAA;AAAA,EAIzE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,iDAAiD;AAC1F,CAAC;AAEM,IAAM,8BAA8B,EAAE,OAAO;AAAA;AAAA;AAAA;AAAA,EAInD,OAAO,EACL,MAAM,+BAA+B,EACrC,SAAS,oDAAoD;AAAA;AAAA;AAAA;AAAA;AAAA,EAK/D,iBAAiB,EAAE,OAAO,EAAE,SAAS,iDAAiD;AAAA;AAAA;AAAA;AAAA;AAAA,EAKt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AAK,QAAQ,KAAK,MAAM,KAAK,IAAI;AAGjC,SAAK,cAAc,KAAK,OAAO,UAAU,KAAK,OAAO;AAAA,EACtD;AAAA,EAVA,cAAc;AAAA,EAYP,OAAO,UAAiB;AAC9B,QAAI,CAAC,KAAK,aAAa;AACtB,cAAQ,IAAI,GAAG,QAAQ;AAAA,IACxB;AAAA,EACD;AAAA,EAEO,QAAQ,UAAiB;AAC/B,QAAI,CAAC,KAAK,aAAa;AACtB,cAAQ,KAAK,GAAG,QAAQ;AAAA,IACzB;AAAA,EACD;AAAA,EAEO,SAAS,UAAiB;AAChC,QAAI,CAAC,KAAK,aAAa;AACtB,cAAQ,MAAM,GAAG,QAAQ;AAAA,IAC1B;AAAA,EACD;AAAA,EAEO,SAAS,UAAiB;AAChC,QAAI,KAAK,OAAO,SAAS,CAAC,KAAK,aAAa;AAC3C,cAAQ,MAAM,GAAG,QAAQ;AAAA,IAC1B;AAAA,EACD;AACD","sourcesContent":["import { z } from \"zod\";\n\nconst ChangelogPresetConfigTypeSchema = z.object({\n\t/**\n\t * The type of commit message.\n\t * @example \"feat\", \"fix\", \"chore\", etc..\n\t */\n\ttype: z.string().describe('The type of commit message, such as \"feat\", \"fix\", \"chore\".'),\n\t/**\n\t * The scope of the commit message.\n\t */\n\tscope: z.string().optional().describe(\"The scope of the commit message.\"),\n\t/**\n\t * The section of the `CHANGELOG` the commit should show up in.\n\t */\n\tsection: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"The section of the `CHANGELOG` the commit should show up in.\"),\n\t/**\n\t * Should show in the generated changelog message?\n\t */\n\thidden: z.boolean().optional().describe(\"Should show in the generated changelog message?\"),\n});\n\nexport const ChangelogPresetConfigSchema = z.object({\n\t/**\n\t * List of explicitly supported commit message types.\n\t */\n\ttypes: z\n\t\t.array(ChangelogPresetConfigTypeSchema)\n\t\t.describe(\"List of explicitly supported commit message types.\"),\n\t/**\n\t * A URL representing a specific commit at a hash.\n\t * @default \"{{host}}/{{owner}}/{{repository}}/commit/{{hash}}\"\n\t */\n\tcommitUrlFormat: z.string().describe(\"A URL representing a specific commit at a hash.\"),\n\t/**\n\t * A URL representing the comparison between two git SHAs.\n\t * @default \"{{host}}/{{owner}}/{{repository}}/compare/{{previousTag}}...{{currentTag}}\"\n\t */\n\tcompareUrlFormat: z.string().describe(\"A URL representing the comparison between two git SHAs.\"),\n\t/**\n\t * A URL representing the issue format (allowing a different URL format to be swapped in\n\t * for Gitlab, Bitbucket, etc).\n\t * @default \"{{host}}/{{owner}}/{{repository}}/issues/{{id}}\"\n\t */\n\tissueUrlFormat: z.string().describe(\"A URL representing the issue format.\"),\n\t/**\n\t * A URL representing a user's profile on GitHub, Gitlab, etc. This URL is used\n\t * for substituting @eglavin with https://github.com/eglavin in commit messages.\n\t * @default \"{{host}}/{{user}}\"\n\t */\n\tuserUrlFormat: z.string().describe(\"A URL representing a user's profile on GitHub, Gitlab, etc.\"),\n\t/**\n\t * A string to be used to format the auto-generated release commit message.\n\t * @default \"chore(release): {{currentTag}}\"\n\t */\n\treleaseCommitMessageFormat: z\n\t\t.string()\n\t\t.describe(\"A string to be used to format the auto-generated release commit message.\"),\n\t/**\n\t * List of prefixes used to detect references to issues.\n\t * @default [\"#\"]\n\t */\n\tissuePrefixes: z\n\t\t.array(z.string())\n\t\t.describe(\"List of prefixes used to detect references to issues.\"),\n});\n\nexport const ForkConfigSchema = z.object({\n\t// Commands\n\t//\n\n\t/**\n\t * If set, fork-version will print the current version and exit.\n\t * @default false\n\t */\n\tinspectVersion: z\n\t\t.boolean()\n\t\t.describe(\"If set, fork-version will print the current version and exit.\"),\n\n\t// Options\n\t//\n\n\t/**\n\t * List of the files to be updated.\n\t * @default\n\t * ```js\n\t * [\"bower.json\", \"deno.json\", \"jsr.json\", \"manifest.json\", \"npm-shrinkwrap.json\", \"package-lock.json\", \"package.json\"]\n\t * ```\n\t */\n\tfiles: z.array(z.string()).describe(\"List of the files to be updated.\"),\n\t/**\n\t * Glob pattern to match files to be updated.\n\t *\n\t * Internally we're using [glob](https://github.com/isaacs/node-glob) to match files.\n\t *\n\t * Read more about the pattern syntax [here](https://github.com/isaacs/node-glob/tree/v10.3.12?tab=readme-ov-file#glob-primer).\n\t *\n\t * @default undefined\n\t * @example \"*.json\"\n\t */\n\tglob: z.string().optional().describe(\"Glob pattern to match files to be updated.\"),\n\t/**\n\t * The path fork-version will run from.\n\t * @default\n\t * ```js\n\t * process.cwd()\n\t * ```\n\t */\n\tpath: z.string().describe('The path fork-version will run from. Defaults to \"process.cwd()\".'),\n\t/**\n\t * Name of the changelog file.\n\t * @default \"CHANGELOG.md\"\n\t */\n\tchangelog: z.string().describe('Name of the changelog file. Defaults to \"CHANGELOG.md\".'),\n\t/**\n\t * The header text for the changelog.\n\t * @default\n\t * ```markdown\n\t * # Changelog\n\t *\n\t * All notable changes to this project will be documented in this file. See [fork-version](https://github.com/eglavin/fork-version) for commit guidelines.\n\t * ```\n\t */\n\theader: z.string().describe(\"The header text for the changelog.\"),\n\t/**\n\t * Specify a prefix for the created tag.\n\t *\n\t * For instance if your version tag is prefixed by \"version/\" instead of \"v\" you have to specify\n\t * `tagPrefix: \"version/\"`.\n\t *\n\t * `tagPrefix` can also be used for a monorepo environment where you might want to deploy\n\t * multiple package from the same repository. In this case you can specify a prefix for\n\t * each package:\n\t *\n\t * | Example Value | Tag Created |\n\t * |:-------------------------|:------------------------------|\n\t * | \"\" | `1.2.3` |\n\t * | \"version/\" | `version/1.2.3` |\n\t * | \"@eglavin/fork-version-\" | `@eglavin/fork-version-1.2.3` |\n\t *\n\t * @example \"\", \"version/\", \"@eglavin/fork-version-\"\n\t * @default \"v\"\n\t */\n\ttagPrefix: z.string().describe('Specify a prefix for the created tag. Defaults to \"v\".'),\n\t/**\n\t * Make a pre-release with optional label if given value is a string.\n\t *\n\t * | Example Value | Produced Version |\n\t * |:--------------|:-----------------|\n\t * | true | `1.2.3-0` |\n\t * | \"alpha\" | `1.2.3-alpha-0` |\n\t * | \"beta\" | `1.2.3-beta-0` |\n\t *\n\t * @example true, \"alpha\", \"beta\", \"rc\"\n\t * @default undefined\n\t */\n\tpreRelease: z\n\t\t.string()\n\t\t.or(z.boolean())\n\t\t.optional()\n\t\t.describe(\"Make a pre-release with optional label if given value is a string.\"),\n\t/**\n\t * If set, fork-version will use this version instead of trying to determine one.\n\t * @example \"1.0.0\"\n\t * @default undefined\n\t */\n\tcurrentVersion: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"If set, fork-version will use this version instead of trying to determine one.\"),\n\t/**\n\t * If set, fork-version will attempt to update to this version, instead of incrementing using \"conventional-commit\".\n\t * @example \"2.0.0\"\n\t * @default undefined\n\t */\n\tnextVersion: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\n\t\t\t'If set, fork-version will attempt to update to this version, instead of incrementing using \"conventional-commit\".',\n\t\t),\n\n\t// Flags\n\t//\n\n\t/**\n\t * Don't throw an error if multiple versions are found in the given files.\n\t * @default true\n\t */\n\tallowMultipleVersions: z\n\t\t.boolean()\n\t\t.describe(\"Don't throw an error if multiple versions are found in the given files.\"),\n\t/**\n\t * Commit all changes, not just files updated by fork-version.\n\t * @default false\n\t */\n\tcommitAll: z.boolean().describe(\"Commit all changes, not just files updated by fork-version.\"),\n\t/**\n\t * Output debug information.\n\t * @default false\n\t */\n\tdebug: z.boolean().describe(\"Output debug information.\"),\n\t/**\n\t * No output will be written to disk or committed.\n\t * @default false\n\t */\n\tdryRun: z.boolean().describe(\"No output will be written to disk or committed.\"),\n\t/**\n\t * Run without logging to the terminal.\n\t * @default false\n\t */\n\tsilent: z.boolean().describe(\"Run without logging to the terminal.\"),\n\t/**\n\t * If unable to find a version in the given files, fallback and attempt to use the latest git tag.\n\t * @default true\n\t */\n\tgitTagFallback: z\n\t\t.boolean()\n\t\t.describe(\n\t\t\t\"If unable to find a version in the given files, fallback and attempt to use the latest git tag. Defaults to true.\",\n\t\t),\n\t/**\n\t * If true, git will sign the commit with the systems GPG key.\n\t * @see {@link https://git-scm.com/docs/git-commit#Documentation/git-commit.txt--Sltkeyidgt Git - GPG Sign Commits}\n\t * @default false\n\t */\n\tsign: z.boolean().describe(\"If true, git will sign the commit with the systems GPG key.\"),\n\t/**\n\t * If true, git will run user defined git hooks before committing.\n\t * @default false\n\t */\n\tverify: z.boolean().describe(\"If true, git will run user defined git hooks before committing.\"),\n\n\t// Skip Steps\n\t//\n\n\t/**\n\t * Skip the bump step.\n\t * @default false\n\t */\n\tskipBump: z.boolean().describe(\"Skip the bump step.\"),\n\t/**\n\t * Skip the changelog step.\n\t * @default false\n\t */\n\tskipChangelog: z.boolean().describe(\"Skip the changelog step.\"),\n\t/**\n\t * Skip the commit step.\n\t * @default false\n\t */\n\tskipCommit: z.boolean().describe(\"Skip the commit step.\"),\n\t/**\n\t * Skip the tag step.\n\t * @default false\n\t */\n\tskipTag: z.boolean().describe(\"Skip the tag step.\"),\n\n\t/**\n\t * Override the default \"conventional-changelog-conventionalcommits\" preset configuration.\n\t */\n\tchangelogPresetConfig: ChangelogPresetConfigSchema.partial().describe(\n\t\t'Override the default \"conventional-changelog-conventionalcommits\" preset configuration.',\n\t),\n\n\t/**\n\t * Add a suffix to the release commit message.\n\t * @example \"[skip ci]\"\n\t */\n\treleaseMessageSuffix: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"Add a suffix to the release commit message.\"),\n});\n\nexport type ForkConfig = z.infer<typeof ForkConfigSchema>;\n\nexport type Config = Partial<ForkConfig>;\n\nexport function defineConfig(config: Config): Config {\n\treturn config;\n}\n","import { readFileSync } from \"node:fs\";\nimport { parse, resolve } from \"node:path\";\nimport JoyCon from \"joycon\";\nimport { bundleRequire } from \"bundle-require\";\nimport { glob } from \"glob\";\nimport dotgitignore from \"dotgitignore\";\n\nimport { ForkConfigSchema, type ForkConfig } from \"./schema\";\nimport { DEFAULT_CONFIG } from \"./defaults\";\nimport { getCliArguments } from \"./cli-arguments\";\nimport { getChangelogPresetConfig } from \"./changelog-preset-config\";\nimport { detectGitHost } from \"./detect-git-host\";\n\n/**\n * Name of the key in the package.json file that contains the users configuration.\n */\nconst PACKAGE_JSON_CONFIG_KEY = \"fork-version\";\n\nexport async function getUserConfig(): Promise<ForkConfig> {\n\tconst cliArguments = getCliArguments();\n\n\tconst cwd = cliArguments.flags.path ? resolve(cliArguments.flags.path) : process.cwd();\n\tconst joycon = new JoyCon({\n\t\tcwd,\n\t\tpackageKey: PACKAGE_JSON_CONFIG_KEY,\n\t\tstopDir: parse(cwd).root,\n\t});\n\tconst configFilePath = await joycon.resolve([\n\t\t\"fork.config.ts\",\n\t\t\"fork.config.js\",\n\t\t\"fork.config.cjs\",\n\t\t\"fork.config.mjs\",\n\t\t\"fork.config.json\",\n\t\t\"package.json\",\n\t]);\n\n\tconst configFile = await loadConfigFile(configFilePath);\n\n\tconst mergedConfig = {\n\t\t...DEFAULT_CONFIG,\n\t\t...configFile,\n\t\t...cliArguments.flags,\n\t} as ForkConfig;\n\n\t// If the user has defined a glob pattern, use it to find the requested files.\n\tlet globResults: string[] = [];\n\tif (mergedConfig.glob) {\n\t\tglobResults = await glob(mergedConfig.glob, {\n\t\t\tcwd: cwd,\n\t\t\tignore: [\"node_modules/**\"],\n\t\t\tnodir: true,\n\t\t});\n\t}\n\n\tconst detectedGitHost = await detectGitHost(cwd);\n\n\treturn {\n\t\t...mergedConfig,\n\n\t\tfiles: filterGitIgnoredFiles(\n\t\t\tcwd,\n\t\t\tgetFilesList(configFile?.files, cliArguments.flags?.files, globResults),\n\t\t),\n\t\tpath: cwd,\n\t\tpreRelease:\n\t\t\t// Meow doesn't support multiple flags with the same name, so we need to check both.\n\t\t\tcliArguments.flags.preReleaseTag ?? cliArguments.flags.preRelease ?? configFile.preRelease,\n\t\tchangelogPresetConfig: getChangelogPresetConfig(\n\t\t\tmergedConfig,\n\t\t\tcliArguments.flags,\n\t\t\tdetectedGitHost,\n\t\t),\n\t};\n}\n\nasync function loadConfigFile(configFilePath: string | null) {\n\tif (!configFilePath) {\n\t\treturn {};\n\t}\n\n\t// Handle json config file.\n\tif (configFilePath.endsWith(\"json\")) {\n\t\tconst fileContent = JSON.parse(readFileSync(configFilePath).toString());\n\n\t\t// Handle package.json config file.\n\t\tif (configFilePath.endsWith(\"package.json\")) {\n\t\t\tif (\n\t\t\t\tfileContent[PACKAGE_JSON_CONFIG_KEY] &&\n\t\t\t\ttypeof fileContent[PACKAGE_JSON_CONFIG_KEY] === \"object\"\n\t\t\t) {\n\t\t\t\tconst parsed = ForkConfigSchema.partial().safeParse(fileContent[PACKAGE_JSON_CONFIG_KEY]);\n\t\t\t\tif (!parsed.success) {\n\t\t\t\t\tthrow parsed.error;\n\t\t\t\t}\n\t\t\t\treturn parsed.data;\n\t\t\t}\n\n\t\t\treturn {};\n\t\t}\n\n\t\tconst parsed = ForkConfigSchema.partial().safeParse(fileContent);\n\t\tif (!parsed.success) {\n\t\t\tthrow parsed.error;\n\t\t}\n\t\treturn parsed.data;\n\t}\n\n\t// Otherwise expect config file to use js or ts.\n\tconst fileContent = await bundleRequire({ filepath: configFilePath });\n\n\tconst parsed = ForkConfigSchema.partial().safeParse(fileContent.mod.default || fileContent.mod);\n\tif (!parsed.success) {\n\t\tthrow parsed.error;\n\t}\n\treturn parsed.data;\n}\n\nfunction getFilesList(\n\tconfigFiles: string[] | undefined,\n\tcliFiles: string[] | undefined,\n\tglobResults: string[],\n): string[] {\n\tconst listOfFiles = new Set<string>();\n\n\t// Add files from the users config file\n\tif (Array.isArray(configFiles)) {\n\t\tconfigFiles.forEach((file) => listOfFiles.add(file));\n\t}\n\n\t// Add files from the cli arguments\n\tif (Array.isArray(cliFiles)) {\n\t\tcliFiles.forEach((file) => listOfFiles.add(file));\n\t}\n\n\t// Add files from glob results\n\tglobResults.forEach((file) => listOfFiles.add(file));\n\n\t// If the user has defined files use them, otherwise use the default list of files.\n\tif (listOfFiles.size) {\n\t\treturn Array.from(listOfFiles);\n\t}\n\n\treturn DEFAULT_CONFIG.files;\n}\n\nfunction filterGitIgnoredFiles(cwd: string, files: string[]) {\n\tconst dotgit = dotgitignore({ cwd });\n\n\treturn files.filter((file) => !dotgit.ignore(file));\n}\n","import type { ForkConfig } from \"./schema\";\n\nexport const DEFAULT_CONFIG: ForkConfig = {\n\t// Commands\n\tinspectVersion: false,\n\n\t// Options\n\tfiles: [\n\t\t\"package.json\",\n\t\t\"package-lock.json\",\n\t\t\"npm-shrinkwrap.json\",\n\t\t\"jsr.json\",\n\t\t\"deno.json\",\n\t\t\"manifest.json\", // Chrome extensions\n\t\t\"bower.json\",\n\t],\n\tpath: process.cwd(),\n\tchangelog: \"CHANGELOG.md\",\n\theader: `# Changelog\n\nAll notable changes to this project will be documented in this file. See [fork-version](https://github.com/eglavin/fork-version) for commit guidelines.\n`,\n\ttagPrefix: \"v\",\n\n\t// Flags\n\tallowMultipleVersions: true,\n\tcommitAll: false,\n\tdebug: false,\n\tdryRun: false,\n\tsilent: false,\n\tgitTagFallback: true,\n\tsign: false,\n\tverify: false,\n\n\t// Skip Steps\n\tskipBump: false,\n\tskipChangelog: false,\n\tskipCommit: false,\n\tskipTag: false,\n\n\tchangelogPresetConfig: {},\n};\n","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 [options]\n\nCommands:\n --help Show this help message.\n --version Show the current version of fork-version.\n --inspect-version If set, fork-version will print the current project version and exit.\n\nOptions:\n --file, -F List of the files to be updated. [Default: [\"bower.json\", \"deno.json\", \"jsr.json\", \"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 --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\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 --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\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\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\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\n\t\t\t// Flags\n\t\t\tallowMultipleVersions: { type: \"boolean\" },\n\t\t\tcommitAll: { 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","import conventionalChangelogConfigSpec from \"conventional-changelog-config-spec\";\n\nimport { ChangelogPresetConfigSchema, type ForkConfig } from \"./schema\";\nimport type { getCliArguments } from \"./cli-arguments\";\nimport type { DetectedGitHost } from \"./detect-git-host\";\n\nexport function getChangelogPresetConfig(\n\tmergedConfig: Partial<ForkConfig> | undefined,\n\tcliArgumentsFlags: ReturnType<typeof getCliArguments>[\"flags\"],\n\tdetectedGitHost: DetectedGitHost | null,\n) {\n\tconst preset: { name: string; [_: string]: unknown } = {\n\t\tname: \"conventionalcommits\",\n\t};\n\n\t// First take any default values from the conventional-changelog-config-spec\n\tif (typeof conventionalChangelogConfigSpec.properties === \"object\") {\n\t\tObject.entries(conventionalChangelogConfigSpec.properties).forEach(([key, value]) => {\n\t\t\tif (\"default\" in value && value.default !== undefined) {\n\t\t\t\tpreset[key] = value.default;\n\t\t\t}\n\t\t});\n\t}\n\n\t// If we've detected a git host, use the values from the detected host now so that they can\n\t// be overwritten by the users config later\n\tif (detectedGitHost) {\n\t\tObject.entries(detectedGitHost).forEach(([key, value]) => {\n\t\t\tif (value !== undefined) {\n\t\t\t\tpreset[key] = value;\n\t\t\t}\n\t\t});\n\t}\n\n\t// Then overwrite with any values from the users config\n\tif (\n\t\tmergedConfig?.changelogPresetConfig &&\n\t\ttypeof mergedConfig.changelogPresetConfig === \"object\"\n\t) {\n\t\tObject.entries(mergedConfig.changelogPresetConfig).forEach(([key, value]) => {\n\t\t\tif (value !== undefined) {\n\t\t\t\tpreset[key] = value;\n\t\t\t}\n\t\t});\n\t}\n\n\t// If the user has defined a releaseMessageSuffix, append it to the releaseCommitMessageFormat\n\tif (mergedConfig?.releaseMessageSuffix && !cliArgumentsFlags?.releaseMessageSuffix) {\n\t\tpreset.releaseCommitMessageFormat = `${preset.releaseCommitMessageFormat} ${mergedConfig.releaseMessageSuffix}`;\n\t}\n\n\t// Finally overwrite with any values from the CLI arguments\n\tif (cliArgumentsFlags?.commitUrlFormat) {\n\t\tpreset.commitUrlFormat = cliArgumentsFlags.commitUrlFormat;\n\t}\n\tif (cliArgumentsFlags?.compareUrlFormat) {\n\t\tpreset.compareUrlFormat = cliArgumentsFlags.compareUrlFormat;\n\t}\n\tif (cliArgumentsFlags?.issueUrlFormat) {\n\t\tpreset.issueUrlFormat = cliArgumentsFlags.issueUrlFormat;\n\t}\n\tif (cliArgumentsFlags?.userUrlFormat) {\n\t\tpreset.userUrlFormat = cliArgumentsFlags.userUrlFormat;\n\t}\n\tif (cliArgumentsFlags?.releaseCommitMessageFormat) {\n\t\tpreset.releaseCommitMessageFormat = cliArgumentsFlags.releaseCommitMessageFormat;\n\t}\n\tif (cliArgumentsFlags?.releaseMessageSuffix) {\n\t\tpreset.releaseCommitMessageFormat = `${preset.releaseCommitMessageFormat} ${cliArgumentsFlags.releaseMessageSuffix}`;\n\t}\n\n\treturn ChangelogPresetConfigSchema.passthrough().parse(preset);\n}\n","import { execFile } from \"node:child_process\";\n\nexport interface DetectedGitHost {\n\tdetectedGitHost: string;\n\tcommitUrlFormat: string;\n\tcompareUrlFormat: string;\n\tissueUrlFormat: string;\n}\n\n/**\n * Conventional-Changelog already supports the following git hosts:\n * - Github\n * - Gitlab\n * - Bitbucket\n *\n * We want to detect if the user is using another host such as Azure DevOps,\n * if so we need to create the correct URLs so the changelog is generated\n * correctly.\n */\nexport async function detectGitHost(cwd: string): Promise<DetectedGitHost | null> {\n\tconst remoteUrl = (await new Promise((onResolve, onReject) => {\n\t\texecFile(\"git\", [\"config\", \"--get\", \"remote.origin.url\"], { cwd }, (error, stdout, stderr) => {\n\t\t\tif (error) {\n\t\t\t\tonReject(error);\n\t\t\t}\n\t\t\tonResolve(stdout ? stdout.trim() : stderr);\n\t\t});\n\t})) as string;\n\n\t// A checked out Azure DevOps remote URL looks like one of these:\n\t//\n\t// | Checkout Type | Remote URL |\n\t// | ------------- | --------------------------------------------------------------------------------------- |\n\t// | HTTPS | https://{{ORGANISATION}}@dev.azure.com/{{ORGANISATION}}/{{PROJECT}}/_git/{{REPOSITORY}} |\n\t// | SSH | git@ssh.dev.azure.com:v3/{{ORGANISATION}}/{{PROJECT}}/{{REPOSITORY}} |\n\t//\n\tif (remoteUrl.startsWith(\"https://\") && remoteUrl.includes(\"@dev.azure.com/\")) {\n\t\t/**\n\t\t * [Regex101.com](https://regex101.com/r/fF7HUc/1)\n\t\t */\n\t\tconst match =\n\t\t\t/^https:\\/\\/(?<atorganisation>.*?)@dev.azure.com\\/(?<organisation>.*?)\\/(?<project>.*?)\\/_git\\/(?<repository>.*?)(?:\\.git)?$/.exec(\n\t\t\t\tremoteUrl,\n\t\t\t);\n\n\t\tif (match?.groups) {\n\t\t\tconst { organisation = \"\", project = \"\", repository = \"\" } = match.groups;\n\n\t\t\treturn {\n\t\t\t\tdetectedGitHost: \"Azure\",\n\t\t\t\tcommitUrlFormat: `{{host}}/${organisation}/${project}/_git/${repository}/commit/{{hash}}`,\n\t\t\t\tcompareUrlFormat: `{{host}}/${organisation}/${project}/_git/${repository}/branchCompare?baseVersion=GT{{previousTag}}&targetVersion=GT{{currentTag}}`,\n\t\t\t\tissueUrlFormat: `{{host}}/${organisation}/${project}/_workitems/edit/{{id}}`,\n\t\t\t};\n\t\t}\n\t} else if (remoteUrl.startsWith(\"git@ssh.dev.azure.com:\")) {\n\t\t/**\n\t\t * [Regex101.com](https://regex101.com/r/VhNxWr/1)\n\t\t */\n\t\tconst match =\n\t\t\t/^git@ssh.dev.azure.com:v\\d\\/(?<organisation>.*?)\\/(?<project>.*?)\\/(?<repository>.*?)(?:\\.git)?$/.exec(\n\t\t\t\tremoteUrl,\n\t\t\t);\n\n\t\tif (match?.groups) {\n\t\t\tconst { organisation = \"\", project = \"\", repository = \"\" } = match.groups;\n\n\t\t\treturn {\n\t\t\t\tdetectedGitHost: \"Azure\",\n\t\t\t\tcommitUrlFormat: `{{host}}/${organisation}/${project}/_git/${repository}/commit/{{hash}}`,\n\t\t\t\tcompareUrlFormat: `{{host}}/${organisation}/${project}/_git/${repository}/branchCompare?baseVersion=GT{{previousTag}}&targetVersion=GT{{currentTag}}`,\n\t\t\t\tissueUrlFormat: `{{host}}/${organisation}/${project}/_workitems/edit/{{id}}`,\n\t\t\t};\n\t\t}\n\t}\n\n\treturn null;\n}\n","import semver, { type ReleaseType } from \"semver\";\nimport conventionalRecommendedBump from \"conventional-recommended-bump\";\n\nimport { getLatestGitTagVersion } from \"../utils/git-tag-version\";\nimport { getReleaseType } from \"../utils/release-type\";\nimport type { ForkConfig } from \"../config/schema\";\nimport type { FileManager, FileState } from \"../strategies/file-manager\";\nimport type { Logger } from \"../utils/logger\";\n\nexport interface CurrentVersion {\n\tversion: string;\n\tfiles: FileState[];\n}\n\nexport async function getCurrentVersion(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tfileManager: FileManager,\n): Promise<CurrentVersion> {\n\tconst files: FileState[] = [];\n\tconst versions = new Set<string>();\n\n\tfor (const file of config.files) {\n\t\tconst fileState = fileManager.read(file);\n\n\t\tif (fileState) {\n\t\t\tfiles.push(fileState);\n\n\t\t\tif (config.currentVersion) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tversions.add(fileState.version);\n\t\t}\n\t}\n\n\tif (config.currentVersion) {\n\t\tversions.add(config.currentVersion);\n\t}\n\n\t// If we still don't have a version, try to get the latest git tag\n\tif (versions.size === 0 && config.gitTagFallback) {\n\t\tconst version = await getLatestGitTagVersion(config.tagPrefix);\n\t\tif (version) {\n\t\t\tlogger.log(`[Version] Using git tag fallback.`);\n\t\t\tversions.add(version);\n\t\t}\n\t}\n\n\tif (versions.size === 0) {\n\t\tthrow new Error(\"Unable to find current version\");\n\t} else if (versions.size > 1) {\n\t\tif (!config.allowMultipleVersions) {\n\t\t\tthrow new Error(\"Found multiple versions\");\n\t\t}\n\t\tlogger.warn(\"[WARNING] Found multiple versions, using the first one.\");\n\t\tlogger.log(`Versions: ${Array.from(versions).join(\", \")}`);\n\t}\n\n\tconst currentVersion = semver.rsort(Array.from(versions))[0];\n\n\t// If we're just inspecting the version, output the version and exit\n\tif (config.inspectVersion) {\n\t\tconsole.log(currentVersion);\n\t\tprocess.exit(0);\n\t}\n\n\tlogger.log(`Current version: ${currentVersion}`);\n\treturn {\n\t\tfiles,\n\t\tversion: currentVersion,\n\t};\n}\n\nexport interface NextVersion {\n\tversion: string;\n\tlevel?: number;\n\tpreMajor?: boolean;\n\treason?: string;\n\treleaseType?: ReleaseType;\n}\n\nexport async function getNextVersion(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tcurrentVersion: string,\n): Promise<NextVersion> {\n\tif (config.skipBump) {\n\t\tlogger.log(\"Skip bump, using current version as next version\");\n\t\treturn {\n\t\t\tversion: currentVersion,\n\t\t};\n\t}\n\n\tif (config.nextVersion && semver.valid(config.nextVersion)) {\n\t\tlogger.log(`Next version: ${config.nextVersion}`);\n\t\treturn {\n\t\t\tversion: config.nextVersion,\n\t\t};\n\t}\n\n\tconst isPreMajor = semver.lt(currentVersion, \"1.0.0\");\n\n\tlet recommendedBump: Awaited<ReturnType<typeof conventionalRecommendedBump>>;\n\ttry {\n\t\trecommendedBump = await conventionalRecommendedBump({\n\t\t\tpreset: {\n\t\t\t\tname: \"conventionalcommits\",\n\t\t\t\t...config.changelogPresetConfig,\n\t\t\t\tpreMajor: isPreMajor,\n\t\t\t},\n\t\t\tpath: config.path,\n\t\t\ttagPrefix: config.tagPrefix,\n\t\t\tcwd: config.path,\n\t\t});\n\t} catch (error) {\n\t\tthrow new Error(`[conventional-recommended-bump] Unable to determine next version`);\n\t}\n\n\tif (recommendedBump.releaseType) {\n\t\tconst releaseType = getReleaseType(\n\t\t\trecommendedBump.releaseType,\n\t\t\tcurrentVersion,\n\t\t\tconfig.preRelease,\n\t\t);\n\n\t\tconst state: NextVersion = {\n\t\t\t...recommendedBump,\n\t\t\tpreMajor: isPreMajor,\n\t\t\treleaseType,\n\t\t\tversion:\n\t\t\t\tsemver.inc(\n\t\t\t\t\tcurrentVersion,\n\t\t\t\t\treleaseType,\n\t\t\t\t\ttypeof config.preRelease === \"string\" ? config.preRelease : undefined,\n\t\t\t\t) ?? \"\",\n\t\t};\n\n\t\tlogger.log(`Next version: ${state.version} (${state.releaseType})`);\n\t\treturn state;\n\t}\n\n\tthrow new Error(\"Unable to find next version\");\n}\n","import gitSemverTags from \"git-semver-tags\";\nimport semver from \"semver\";\n\n/**\n * Get the latest git tag version.\n *\n * @example\n * ```ts\n * const tagPrefix = \"v\";\n * await getLatestGitTagVersion(tagPrefix); // 1.2.3\n * ```\n */\nexport async function getLatestGitTagVersion(tagPrefix: string | undefined): Promise<string> {\n\tconst gitTags = await gitSemverTags({ tagPrefix });\n\tif (!gitTags.length) {\n\t\treturn \"\";\n\t}\n\n\tconst cleanedTags = [];\n\n\tfor (const tag of gitTags) {\n\t\tconst cleanedTag = semver.clean(tag.replace(new RegExp(`^${tagPrefix}`), \"\"));\n\n\t\tif (cleanedTag) {\n\t\t\tcleanedTags.push(cleanedTag);\n\t\t}\n\t}\n\n\treturn cleanedTags.sort(semver.rcompare)[0];\n}\n","import semver, { type ReleaseType } from \"semver\";\n\n/**\n * Get the priority of given type.\n * @example\n * - \"patch\" => 0\n * - \"minor\" => 1\n * - \"major\" => 2\n */\nfunction getPriority(type?: string): number {\n\treturn [\"patch\", \"minor\", \"major\"].indexOf(type ?? \"\");\n}\n\n/**\n * Get the given versions highest state.\n * @example\n * - \"patch\"\n * - \"minor\"\n * - \"major\"\n */\nfunction getVersionType(version: string): \"patch\" | \"minor\" | \"major\" | undefined {\n\tconst parseVersion = semver.parse(version);\n\n\tif (parseVersion?.major) {\n\t\treturn \"major\";\n\t} else if (parseVersion?.minor) {\n\t\treturn \"minor\";\n\t} else if (parseVersion?.patch) {\n\t\treturn \"patch\";\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Get the recommended release type for the given version depending on if\n * the user asks for a prerelease with or without a tag.\n * ```js\n * getReleaseType(\"patch\", \"1.0.0\", false) => \"patch\"\n * getReleaseType(\"major\", \"0.0.0-beta\", \"beta\") => \"premajor\"\n * ```\n */\nexport function getReleaseType(\n\treleaseType: \"major\" | \"minor\" | \"patch\",\n\tcurrentVersion: string,\n\tpreReleaseTag?: string | boolean,\n): ReleaseType {\n\tif (!preReleaseTag) {\n\t\treturn releaseType;\n\t}\n\n\tconst currentVersionsIsPreRelease = Array.isArray(semver.prerelease(currentVersion));\n\tif (currentVersionsIsPreRelease) {\n\t\tconst currentReleaseType = getVersionType(currentVersion);\n\n\t\tif (\n\t\t\tcurrentReleaseType === releaseType ||\n\t\t\tgetPriority(currentReleaseType) > getPriority(releaseType)\n\t\t) {\n\t\t\treturn \"prerelease\";\n\t\t}\n\t}\n\n\treturn `pre${releaseType}`;\n}\n","import { resolve } from \"node:path\";\nimport { writeFileSync, readFileSync } from \"node:fs\";\nimport conventionalChangelog from \"conventional-changelog\";\n\nimport { fileExists } from \"../utils/file-state\";\nimport type { ForkConfig } from \"../config/schema\";\nimport type { Logger } from \"../utils/logger\";\n\n/**\n * Matches the following changelog header formats:\n * - `## [1.2.3]`\n * - `<a name=\"1.2.3\"></a>`\n */\nconst RELEASE_PATTERN = /(^#+ \\[?[0-9]+\\.[0-9]+\\.[0-9]+|<a name=)/m;\n\n/**\n * Get the existing changelog content from the latest release onwards.\n * @see {@link RELEASE_PATTERN}\n */\nfunction getOldReleaseContent(filePath: string, exists: boolean): string {\n\tif (exists) {\n\t\tconst fileContents = readFileSync(filePath, \"utf-8\");\n\t\tconst oldContentStart = fileContents.search(RELEASE_PATTERN);\n\n\t\tif (oldContentStart !== -1) {\n\t\t\treturn fileContents.substring(oldContentStart);\n\t\t}\n\t}\n\n\treturn \"\";\n}\n\n/**\n * Generate the new changelog content for this release.\n */\nfunction getNewReleaseContent(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tnextVersion: string,\n): Promise<string> {\n\treturn new Promise<string>((onResolve) => {\n\t\tlet newContent = \"\";\n\n\t\tconventionalChangelog(\n\t\t\t{\n\t\t\t\tpreset: {\n\t\t\t\t\tname: \"conventionalcommits\",\n\t\t\t\t\t...config.changelogPresetConfig,\n\t\t\t\t},\n\t\t\t\ttagPrefix: config.tagPrefix,\n\t\t\t\twarn: (...message: string[]) => logger.debug(\"[conventional-changelog] \", ...message),\n\t\t\t\tcwd: config.path,\n\t\t\t},\n\t\t\t{\n\t\t\t\tversion: nextVersion,\n\t\t\t},\n\t\t\t{\n\t\t\t\tmerges: null,\n\t\t\t\tpath: config.path,\n\t\t\t},\n\t\t)\n\t\t\t.on(\"error\", (error) => {\n\t\t\t\tlogger.error(\"[conventional-changelog] Unable to parse changes\");\n\t\t\t\tthrow error;\n\t\t\t})\n\t\t\t.on(\"data\", (chunk) => {\n\t\t\t\tnewContent += chunk.toString();\n\t\t\t})\n\t\t\t.on(\"end\", () => {\n\t\t\t\tonResolve(newContent);\n\t\t\t});\n\t});\n}\n\nexport async function updateChangelog(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tnextVersion: string,\n): Promise<void> {\n\tif (config.skipChangelog) {\n\t\tlogger.log(\"Skip changelog update\");\n\t\treturn;\n\t}\n\n\tif (config.header.search(RELEASE_PATTERN) !== -1) {\n\t\t// Need to ensure the header doesn't contain the release pattern\n\t\tthrow new Error(\"Header cannot contain release pattern\");\n\t}\n\n\t// Create the changelog file if it doesn't exist\n\tconst changelogPath = resolve(config.path, config.changelog);\n\tif (!config.dryRun && !fileExists(changelogPath)) {\n\t\tlogger.log(`Creating Changelog file: ${changelogPath}`);\n\t\twriteFileSync(changelogPath, \"\\n\", \"utf8\");\n\t}\n\n\tconst oldContent = getOldReleaseContent(changelogPath, fileExists(changelogPath));\n\tconst newContent = await getNewReleaseContent(config, logger, nextVersion);\n\n\tlogger.log(`Updating Changelog: ${changelogPath}`);\n\tif (!config.dryRun && newContent) {\n\t\twriteFileSync(\n\t\t\tchangelogPath,\n\t\t\t`${config.header}\n${newContent}\n${oldContent}\n`.trim(),\n\t\t\t\"utf8\",\n\t\t);\n\t}\n}\n","import { lstatSync } from \"fs\";\n\n/**\n * Determine if a file exists.\n * @example\n * ```ts\n * fileExists(\"~/.bashrc\"); // true\n * fileExists(\"~/missing-file.txt\"); // false\n * ```\n */\nexport function fileExists(filePath: string): boolean {\n\ttry {\n\t\treturn lstatSync(filePath).isFile();\n\t} catch (e) {\n\t\treturn false;\n\t}\n}\n","import { resolve } from \"node:path\";\nimport { formatCommitMessage } from \"../utils/format-commit-message\";\nimport { fileExists } from \"../utils/file-state\";\nimport type { ForkConfig } from \"../config/schema\";\nimport type { FileState } from \"../strategies/file-manager\";\nimport type { Logger } from \"../utils/logger\";\nimport type { Git } from \"../utils/git\";\n\nexport async function commitChanges(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tgit: Git,\n\tfiles: FileState[],\n\tnextVersion: string,\n): Promise<void> {\n\tif (config.skipCommit) {\n\t\tlogger.log(\"Skip commit\");\n\t\treturn;\n\t}\n\n\tlogger.log(\"Committing changes\");\n\n\tconst filesToCommit: string[] = [];\n\tif (fileExists(resolve(config.path, config.changelog))) {\n\t\tfilesToCommit.push(resolve(config.path, config.changelog));\n\t}\n\tfor (const file of files) {\n\t\tfilesToCommit.push(file.path);\n\t}\n\n\t// If there are no files to commit don't continue.\n\tif (filesToCommit.length === 0) {\n\t\treturn;\n\t}\n\n\tif (config.commitAll) {\n\t\tawait git.add(\"--all\");\n\t} else {\n\t\tawait git.add(...filesToCommit);\n\t}\n\n\tconst shouldVerify = config.verify ? undefined : \"--no-verify\";\n\tconst shouldSign = config.sign ? \"--gpg-sign\" : undefined;\n\n\tawait git.commit(\n\t\tshouldVerify,\n\t\tshouldSign,\n\t\t\"--message\",\n\t\tformatCommitMessage(config.changelogPresetConfig?.releaseCommitMessageFormat, nextVersion),\n\t);\n}\n","/**\n * Formats the commit message by replacing the `{{currentTag}}` placeholder\n * globally with the new version.\n *\n * Falls back to `chore(release): {{currentTag}}` if message is argument is falsy.\n */\nexport function formatCommitMessage(message: string | undefined, version: string): string {\n\tif (!message) {\n\t\tmessage = \"chore(release): {{currentTag}}\";\n\t}\n\n\treturn message.replace(new RegExp(\"{{currentTag}}\", \"g\"), version);\n}\n","import { formatCommitMessage } from \"../utils/format-commit-message\";\nimport type { ForkConfig } from \"../config/schema\";\nimport type { Logger } from \"../utils/logger\";\nimport type { Git } from \"../utils/git\";\n\nexport async function tagChanges(\n\tconfig: ForkConfig,\n\tlogger: Logger,\n\tgit: Git,\n\tnextVersion: string,\n): Promise<void> {\n\tif (config.skipTag) {\n\t\tlogger.log(\"Skip tag creation\");\n\t\treturn;\n\t}\n\n\t/** @example \"v1.2.3\" or \"version/1.2.3\" */\n\tconst tag = `${config.tagPrefix}${nextVersion}`;\n\n\tlogger.log(`Creating Tag: ${tag}`);\n\n\tawait git.tag(\n\t\tconfig.sign ? \"--sign\" : \"--annotate\",\n\t\ttag,\n\t\t\"--message\",\n\t\tformatCommitMessage(config.changelogPresetConfig?.releaseCommitMessageFormat, nextVersion),\n\t);\n}\n","import { resolve } from \"node:path\";\nimport { readFileSync, writeFileSync } from \"node:fs\";\nimport detectIndent from \"detect-indent\";\nimport { detectNewline } from \"detect-newline\";\n\nimport { stringifyPackage } from \"../libs/stringify-package\";\nimport { fileExists } from \"../utils/file-state\";\nimport type { ForkConfig } from \"../config/schema\";\nimport type { Logger } from \"../utils/logger\";\nimport type { FileState, IFileManager } from \"./file-manager\";\n\n/**\n * A json package file should have a version property, like what can be seen\n * in the package.json file in the root of this project.\n *\n * @example\n * ```json\n * {\n * \"name\": \"fork-version\",\n * \"version\": \"1.2.3\",\n * \"private\": true,\n * }\n * ```\n */\nexport class JSONPackage implements IFileManager {\n\tconstructor(\n\t\tprivate config: ForkConfig,\n\t\tprivate logger: Logger,\n\t) {}\n\n\tpublic read(fileName: string): FileState | undefined {\n\t\tconst filePath = resolve(this.config.path, fileName);\n\n\t\tif (fileExists(filePath)) {\n\t\t\tconst fileContents = readFileSync(filePath, \"utf8\");\n\t\t\tconst parsedJson = JSON.parse(fileContents);\n\n\t\t\tif (parsedJson.version) {\n\t\t\t\treturn {\n\t\t\t\t\tname: fileName,\n\t\t\t\t\tpath: filePath,\n\t\t\t\t\tversion: parsedJson.version,\n\n\t\t\t\t\tisPrivate: typeof parsedJson?.private === \"boolean\" ? parsedJson.private : true,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tthis.logger.warn(`[File Manager] Unable to determine json package: ${fileName}`);\n\t\t}\n\t}\n\n\tpublic write(fileState: FileState, newVersion: string) {\n\t\tconst fileContents = readFileSync(fileState.path, \"utf8\");\n\t\tconst parsedJson = JSON.parse(fileContents);\n\n\t\tparsedJson.version = newVersion;\n\t\tif (parsedJson.packages?.[\"\"]) {\n\t\t\tparsedJson.packages[\"\"].version = newVersion; // package-lock v2 stores version here too.\n\t\t}\n\n\t\twriteFileSync(\n\t\t\tfileState.path,\n\t\t\tstringifyPackage(parsedJson, detectIndent(fileContents).indent, detectNewline(fileContents)),\n\t\t\t\"utf8\",\n\t\t);\n\t}\n\n\tpublic isSupportedFile(fileName: string): boolean {\n\t\treturn fileName.endsWith(\".json\");\n\t}\n}\n","// https://github.com/npm/stringify-package/blob/main/LICENSE\n// Extracted from npm/stringify-package\n//\n// Copyright npm, Inc\n//\n// Permission to use, copy, modify, and/or distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\nconst DEFAULT_INDENT = 2;\nconst CRLF = \"\\r\\n\";\nconst LF = \"\\n\";\n\n/**\n * @param data The object to stringify\n * @param indent `2, 4, \" \", \"\\t\"` Number of spaces a string of spaces or tab character, defaults to 2\n * @param newline `\"\\r\\n\", \"\\n\"` Windows or Unix line endings, defaults to Unix\n */\nexport function stringifyPackage(\n\tdata: object,\n\tindent?: string | number,\n\tnewline?: typeof CRLF | typeof LF,\n): string {\n\tconst stringified = JSON.stringify(data, null, indent ?? DEFAULT_INDENT);\n\n\tif (newline === CRLF) {\n\t\treturn stringified.replace(new RegExp(LF, \"g\"), CRLF);\n\t}\n\n\treturn stringified;\n}\n","import { resolve } from \"node:path\";\nimport { readFileSync, writeFileSync } from \"node:fs\";\n\nimport { fileExists } from \"../utils/file-state\";\nimport type { ForkConfig } from \"../config/schema\";\nimport type { Logger } from \"../utils/logger\";\nimport type { FileState, IFileManager } from \"./file-manager\";\n\n/**\n * A plain text file will have just the version as the content.\n *\n * @example\n * ```txt\n * 1.2.3\n * ```\n */\nexport class PlainText implements IFileManager {\n\tconstructor(\n\t\tprivate config: ForkConfig,\n\t\tprivate logger: Logger,\n\t) {}\n\n\tpublic read(fileName: string): FileState | undefined {\n\t\tconst filePath = resolve(this.config.path, fileName);\n\n\t\tif (fileExists(filePath)) {\n\t\t\tconst fileContents = readFileSync(filePath, \"utf8\");\n\n\t\t\treturn {\n\t\t\t\tname: fileName,\n\t\t\t\tpath: filePath,\n\t\t\t\tversion: fileContents || \"\",\n\t\t\t};\n\t\t}\n\n\t\tthis.logger.warn(`[File Manager] Unable to determine plain text: ${fileName}`);\n\t}\n\n\tpublic write(fileState: FileState, newVersion: string) {\n\t\twriteFileSync(fileState.path, newVersion, \"utf8\");\n\t}\n\n\tpublic isSupportedFile(fileName: string): boolean {\n\t\treturn fileName.endsWith(\"version.txt\");\n\t}\n}\n","import { resolve } from \"node:path\";\nimport { readFileSync, writeFileSync } from \"node:fs\";\nimport * as cheerio from \"cheerio/lib/slim\";\n\nimport { fileExists } from \"../utils/file-state\";\nimport type { ForkConfig } from \"../config/schema\";\nimport type { Logger } from \"../utils/logger\";\nimport type { FileState, IFileManager } from \"./file-manager\";\n\n/**\n * A ms-build file is an xml file with a version property under the Project > PropertyGroup node.\n *\n * [Microsoft Learn - MSBuild Reference](https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild?view=vs-2022)\n *\n * @example\n * ```xml\n * <Project Sdk=\"Microsoft.NET.Sdk\">\n * <PropertyGroup>\n * <Version>1.2.3</Version>\n * </PropertyGroup>\n * </Project>\n * ```\n */\nexport class MSBuildProject implements IFileManager {\n\tconstructor(\n\t\tprivate config: ForkConfig,\n\t\tprivate logger: Logger,\n\t) {}\n\n\tpublic read(fileName: string): FileState | undefined {\n\t\tconst filePath = resolve(this.config.path, fileName);\n\n\t\tif (fileExists(filePath)) {\n\t\t\tconst fileContents = readFileSync(filePath, \"utf8\");\n\t\t\tconst $ = cheerio.load(fileContents, { xmlMode: true, decodeEntities: false });\n\n\t\t\tconst version = $(\"Project > PropertyGroup > Version\").text();\n\t\t\tif (version) {\n\t\t\t\treturn {\n\t\t\t\t\tname: fileName,\n\t\t\t\t\tpath: filePath,\n\t\t\t\t\tversion: version,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tthis.logger.warn(`[File Manager] Unable to determine ms-build package: ${fileName}`);\n\t\t}\n\t}\n\n\tpublic write(fileState: FileState, newVersion: string) {\n\t\tconst fileContents = readFileSync(fileState.path, \"utf8\");\n\t\tconst $ = cheerio.load(fileContents, { xmlMode: true, decodeEntities: false });\n\n\t\t$(\"Project > PropertyGroup > Version\").text(newVersion);\n\n\t\t// Cheerio doesn't handle self-closing tags well,\n\t\t// so we're manually adding a space before the closing tag.\n\t\tconst updatedContent = $.xml().replaceAll('\"/>', '\" />');\n\n\t\twriteFileSync(fileState.path, updatedContent, \"utf8\");\n\t}\n\n\tpublic isSupportedFile(fileName: string): boolean {\n\t\t// List of known ms-build project file extensions.\n\t\t// https://stackoverflow.com/questions/2007689/is-there-a-standard-file-extension-for-msbuild-files\n\t\treturn (\n\t\t\t[\".csproj\", \".dbproj\", \".esproj\", \".fsproj\", \".props\", \".vbproj\", \".vcxproj\"].findIndex(\n\t\t\t\t(ext) => fileName.endsWith(ext),\n\t\t\t) !== -1\n\t\t);\n\t}\n}\n","import { JSONPackage } from \"./json-package\";\nimport { PlainText } from \"./plain-text\";\nimport { MSBuildProject } from \"./ms-build-project\";\n\nimport type { ForkConfig } from \"../config/schema\";\nimport type { Logger } from \"../utils/logger\";\n\nexport interface FileState {\n\tname: string;\n\tpath: string;\n\tversion: string;\n\n\t[other: string]: unknown;\n}\n\nexport interface IFileManager {\n\tread(fileName: string): FileState | undefined;\n\twrite(fileState: FileState, newVersion: string): void;\n\tisSupportedFile(fileName: string): boolean;\n}\n\nexport class FileManager {\n\tprivate JSONPackage: JSONPackage;\n\tprivate PlainText: PlainText;\n\tprivate MSBuildProject: MSBuildProject;\n\n\tconstructor(\n\t\tprivate config: ForkConfig,\n\t\tprivate logger: Logger,\n\t) {\n\t\tthis.JSONPackage = new JSONPackage(config, logger);\n\t\tthis.PlainText = new PlainText(config, logger);\n\t\tthis.MSBuildProject = new MSBuildProject(config, logger);\n\t}\n\n\t/**\n\t * Get the state from the given file name.\n\t *\n\t * @example\n\t * ```ts\n\t * fileManager.read(\"package.json\");\n\t * ```\n\t *\n\t * @returns\n\t * ```json\n\t * { \"name\": \"package.json\", \"path\": \"/path/to/package.json\", \"version\": \"1.2.3\", \"isPrivate\": true }\n\t * ```\n\t */\n\tpublic read(fileName: string): FileState | undefined {\n\t\tconst _fileName = fileName.toLowerCase();\n\n\t\tif (this.JSONPackage.isSupportedFile(_fileName)) {\n\t\t\treturn this.JSONPackage.read(fileName);\n\t\t}\n\n\t\tif (this.PlainText.isSupportedFile(_fileName)) {\n\t\t\treturn this.PlainText.read(fileName);\n\t\t}\n\n\t\tif (this.MSBuildProject.isSupportedFile(_fileName)) {\n\t\t\treturn this.MSBuildProject.read(fileName);\n\t\t}\n\n\t\tthis.logger.error(`[File Manager] Unsupported file: ${fileName}`);\n\t}\n\n\t/**\n\t * Write the new version to the given file.\n\t *\n\t * @example\n\t * ```ts\n\t * fileManager.write(\n\t * { name: \"package.json\", path: \"/path/to/package.json\", version: \"1.2.2\" },\n\t * \"1.2.3\"\n\t * );\n\t * ```\n\t */\n\tpublic write(fileState: FileState, newVersion: string): void {\n\t\tif (this.config.dryRun) {\n\t\t\treturn;\n\t\t}\n\t\tconst _fileName = fileState.name.toLowerCase();\n\n\t\tif (this.JSONPackage.isSupportedFile(_fileName)) {\n\t\t\treturn this.JSONPackage.write(fileState, newVersion);\n\t\t}\n\n\t\tif (this.PlainText.isSupportedFile(_fileName)) {\n\t\t\treturn this.PlainText.write(fileState, newVersion);\n\t\t}\n\n\t\tif (this.MSBuildProject.isSupportedFile(_fileName)) {\n\t\t\treturn this.MSBuildProject.write(fileState, newVersion);\n\t\t}\n\n\t\tthis.logger.error(`[File Manager] Unsupported file: ${fileState.path}`);\n\t}\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { ForkConfig } from \"../config/schema\";\n\nexport class Logger {\n\tdisableLogs = false;\n\n\tconstructor(private config: Pick<ForkConfig, \"silent\" | \"debug\" | \"inspectVersion\">) {\n\t\tthis.log = this.log.bind(this);\n\t\tthis.warn = this.warn.bind(this);\n\t\tthis.error = this.error.bind(this);\n\t\tthis.debug = this.debug.bind(this);\n\n\t\t// Disable logs if silent or inspectVersion is set\n\t\tthis.disableLogs = this.config.silent || this.config.inspectVersion;\n\t}\n\n\tpublic log(...messages: any[]) {\n\t\tif (!this.disableLogs) {\n\t\t\tconsole.log(...messages);\n\t\t}\n\t}\n\n\tpublic warn(...messages: any[]) {\n\t\tif (!this.disableLogs) {\n\t\t\tconsole.warn(...messages);\n\t\t}\n\t}\n\n\tpublic error(...messages: any[]) {\n\t\tif (!this.disableLogs) {\n\t\t\tconsole.error(...messages);\n\t\t}\n\t}\n\n\tpublic debug(...messages: any[]) {\n\t\tif (this.config.debug && !this.disableLogs) {\n\t\t\tconsole.debug(...messages);\n\t\t}\n\t}\n}\n"]}