package-versioner 0.8.6 → 0.9.1

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/README.md CHANGED
@@ -130,7 +130,7 @@ Customize behaviour by creating a `version.config.json` file in your project roo
130
130
  "updateChangelog": true,
131
131
  "changelogFormat": "keep-a-changelog",
132
132
  "strictReachable": false,
133
- "synced": true,
133
+ "sync": true,
134
134
  "skip": [
135
135
  "docs",
136
136
  "e2e"
@@ -160,7 +160,7 @@ Customize behaviour by creating a `version.config.json` file in your project roo
160
160
  - `paths`: Directories to search for Cargo.toml files (optional)
161
161
 
162
162
  #### Monorepo-Specific Options
163
- - `synced`: Whether all packages should be versioned together (default: true)
163
+ - `sync`: Whether all packages should be versioned together (default: true)
164
164
  - `skip`: Array of package names or patterns to exclude from versioning. Supports exact names, scope wildcards, path patterns, and global wildcards (e.g., ["@scope/package-a", "@scope/*", "packages/**/*"])
165
165
  - `packages`: Array of package names or patterns to target for versioning. Supports exact names, scope wildcards, path patterns and global wildcards (e.g., ["@scope/package-a", "@scope/*", "*"])
166
166
  - `mainPackage`: Package name whose commit history should drive version determination
@@ -234,7 +234,7 @@ This option works in conjunction with `tagTemplate` to control tag formatting. T
234
234
 
235
235
  **Examples:**
236
236
 
237
- For single-package repositories or synced monorepos:
237
+ For single-package repositories or sync monorepos:
238
238
  ```json
239
239
  {
240
240
  "packageSpecificTags": true,
@@ -253,8 +253,8 @@ For global versioning:
253
253
  Creates tags like `v1.2.3`
254
254
 
255
255
  **Important Notes:**
256
- - In **synced mode** with a single package, `packageSpecificTags: true` will use the package name even though all packages are versioned together
257
- - In **synced mode** with multiple packages, package names are not used regardless of the setting
256
+ - In **sync mode** with a single package, `packageSpecificTags: true` will use the package name even though all packages are versioned together
257
+ - In **sync mode** with multiple packages, package names are not used regardless of the setting
258
258
  - In **async mode**, each package gets its own tag when `packageSpecificTags` is enabled
259
259
 
260
260
  With package-specific tagging enabled, the tool will:
@@ -269,7 +269,7 @@ With package-specific tagging enabled, the tool will:
269
269
  1. **Conventional Commits:** Analyzes commit messages (like `feat:`, `fix:`, `BREAKING CHANGE:`) since the last tag.
270
270
  2. **Branch Pattern:** Determines the bump based on the current or recently merged branch name matching predefined patterns.
271
271
 
272
- For a detailed explanation of these concepts and monorepo modes (Synced vs. Async), see [Versioning Strategies and Concepts](./docs/versioning.md).
272
+ For a detailed explanation of these concepts and monorepo modes (Sync vs. Async), see [Versioning Strategies and Concepts](./docs/versioning.md).
273
273
 
274
274
  ## Documentation
275
275
 
package/dist/index.cjs CHANGED
@@ -1012,7 +1012,7 @@ function formatVersionPrefix(prefix) {
1012
1012
  function formatTag(version, prefix, packageName, template, packageSpecificTags) {
1013
1013
  if ((template == null ? void 0 : template.includes("${packageName}")) && !packageName) {
1014
1014
  log(
1015
- 'Warning: Your tagTemplate contains ${packageName} but no package name is available.\nThis will result in an empty package name in the tag (e.g., "@v1.0.0" instead of "my-package@v1.0.0").\n\nTo fix this:\n\u2022 If using synced mode: Set "packageSpecificTags": true in your config to enable package names in tags\n\u2022 If you want global tags: Remove ${packageName} from your tagTemplate (e.g., use "${prefix}${version}")\n\u2022 If using single/async mode: Ensure your package.json has a valid "name" field',
1015
+ 'Warning: Your tagTemplate contains ${packageName} but no package name is available.\nThis will result in an empty package name in the tag (e.g., "@v1.0.0" instead of "my-package@v1.0.0").\n\nTo fix this:\n\u2022 If using sync mode: Set "packageSpecificTags": true in your config to enable package names in tags\n\u2022 If you want global tags: Remove ${packageName} from your tagTemplate (e.g., use "${prefix}${version}")\n\u2022 If using single/async mode: Ensure your package.json has a valid "name" field',
1016
1016
  "warning"
1017
1017
  );
1018
1018
  }
@@ -1027,7 +1027,7 @@ function formatTag(version, prefix, packageName, template, packageSpecificTags)
1027
1027
  function formatCommitMessage(template, version, packageName, additionalContext) {
1028
1028
  if (template.includes("${packageName}") && !packageName) {
1029
1029
  log(
1030
- 'Warning: Your commitMessage template contains ${packageName} but no package name is available.\nThis will result in an empty package name in the commit message (e.g., "Release @v1.0.0").\n\nTo fix this:\n\u2022 If using synced mode: Set "packageSpecificTags": true to enable package names in commits\n\u2022 If you want generic commit messages: Remove ${packageName} from your commitMessage template\n\u2022 If using single/async mode: Ensure your package.json has a valid "name" field',
1030
+ 'Warning: Your commitMessage template contains ${packageName} but no package name is available.\nThis will result in an empty package name in the commit message (e.g., "Release @v1.0.0").\n\nTo fix this:\n\u2022 If using sync mode: Set "packageSpecificTags": true to enable package names in commits\n\u2022 If you want generic commit messages: Remove ${packageName} from your commitMessage template\n\u2022 If using single/async mode: Ensure your package.json has a valid "name" field',
1031
1031
  "warning"
1032
1032
  );
1033
1033
  }
@@ -1997,7 +1997,7 @@ function shouldProcessPackage2(pkg, config) {
1997
1997
  const pkgName = pkg.packageJson.name;
1998
1998
  return shouldProcessPackage(pkgName, config.skip);
1999
1999
  }
2000
- function createSyncedStrategy(config) {
2000
+ function createSyncStrategy(config) {
2001
2001
  return async (packages) => {
2002
2002
  try {
2003
2003
  const {
@@ -2334,14 +2334,14 @@ function createAsyncStrategy(config) {
2334
2334
  };
2335
2335
  }
2336
2336
  function createStrategy(config) {
2337
- if (config.synced) {
2338
- return createSyncedStrategy(config);
2337
+ if (config.sync) {
2338
+ return createSyncStrategy(config);
2339
2339
  }
2340
2340
  return createAsyncStrategy(config);
2341
2341
  }
2342
2342
  function createStrategyMap(config) {
2343
2343
  return {
2344
- synced: createSyncedStrategy(config),
2344
+ sync: createSyncStrategy(config),
2345
2345
  single: createSingleStrategy(config),
2346
2346
  async: createAsyncStrategy(config)
2347
2347
  };
@@ -2442,7 +2442,7 @@ var VersionEngine = class {
2442
2442
  }
2443
2443
  /**
2444
2444
  * Change the current strategy
2445
- * @param strategyType The strategy type to use: 'synced', 'single', or 'async'
2445
+ * @param strategyType The strategy type to use: 'sync', 'single', or 'async'
2446
2446
  */
2447
2447
  setStrategy(strategyType) {
2448
2448
  this.currentStrategy = this.strategies[strategyType];
@@ -2477,7 +2477,7 @@ async function run() {
2477
2477
  program.command("version", { isDefault: true }).description("Version a package or packages based on configuration").option(
2478
2478
  "-c, --config <path>",
2479
2479
  "Path to config file (defaults to version.config.json in current directory)"
2480
- ).option("-d, --dry-run", "Dry run (no changes made)", false).option("-b, --bump <type>", "Specify bump type (patch|minor|major)").option("-p, --prerelease [identifier]", "Create prerelease version").option("-s, --synced", "Use synchronized versioning across all packages").option("-j, --json", "Output results as JSON", false).option("-t, --target <packages>", "Comma-delimited list of package names to target").option("--project-dir <path>", "Project directory to run commands in", process.cwd()).action(async (options) => {
2480
+ ).option("-d, --dry-run", "Dry run (no changes made)", false).option("-b, --bump <type>", "Specify bump type (patch|minor|major)").option("-p, --prerelease [identifier]", "Create prerelease version").option("-s, --sync", "Use synchronized versioning across all packages").option("-j, --json", "Output results as JSON", false).option("-t, --target <packages>", "Comma-delimited list of package names to target").option("--project-dir <path>", "Project directory to run commands in", process.cwd()).action(async (options) => {
2481
2481
  if (options.json) {
2482
2482
  enableJsonOutput(options.dryRun);
2483
2483
  }
@@ -2496,7 +2496,7 @@ async function run() {
2496
2496
  const config = await loadConfig(options.config);
2497
2497
  log(`Loaded configuration from ${options.config || "version.config.json"}`, "info");
2498
2498
  if (options.dryRun) config.dryRun = true;
2499
- if (options.synced) config.synced = true;
2499
+ if (options.sync) config.sync = true;
2500
2500
  if (options.bump) config.type = options.bump;
2501
2501
  if (options.prerelease) {
2502
2502
  config.prereleaseIdentifier = options.prerelease === true ? "next" : options.prerelease;
@@ -2508,10 +2508,10 @@ async function run() {
2508
2508
  const resolvedCount = pkgsResult.packages.length;
2509
2509
  log(`Resolved ${resolvedCount} packages from workspace`, "debug");
2510
2510
  log(`Config packages: ${JSON.stringify(config.packages)}`, "debug");
2511
- log(`Config synced: ${config.synced}`, "debug");
2512
- if (config.synced) {
2513
- log("Using synced versioning strategy.", "info");
2514
- engine.setStrategy("synced");
2511
+ log(`Config sync: ${config.sync}`, "debug");
2512
+ if (config.sync) {
2513
+ log("Using sync versioning strategy.", "info");
2514
+ engine.setStrategy("sync");
2515
2515
  await engine.run(pkgsResult);
2516
2516
  } else if (resolvedCount === 1) {
2517
2517
  log("Using single package versioning strategy.", "info");
package/dist/index.js CHANGED
@@ -979,7 +979,7 @@ function formatVersionPrefix(prefix) {
979
979
  function formatTag(version, prefix, packageName, template, packageSpecificTags) {
980
980
  if ((template == null ? void 0 : template.includes("${packageName}")) && !packageName) {
981
981
  log(
982
- 'Warning: Your tagTemplate contains ${packageName} but no package name is available.\nThis will result in an empty package name in the tag (e.g., "@v1.0.0" instead of "my-package@v1.0.0").\n\nTo fix this:\n\u2022 If using synced mode: Set "packageSpecificTags": true in your config to enable package names in tags\n\u2022 If you want global tags: Remove ${packageName} from your tagTemplate (e.g., use "${prefix}${version}")\n\u2022 If using single/async mode: Ensure your package.json has a valid "name" field',
982
+ 'Warning: Your tagTemplate contains ${packageName} but no package name is available.\nThis will result in an empty package name in the tag (e.g., "@v1.0.0" instead of "my-package@v1.0.0").\n\nTo fix this:\n\u2022 If using sync mode: Set "packageSpecificTags": true in your config to enable package names in tags\n\u2022 If you want global tags: Remove ${packageName} from your tagTemplate (e.g., use "${prefix}${version}")\n\u2022 If using single/async mode: Ensure your package.json has a valid "name" field',
983
983
  "warning"
984
984
  );
985
985
  }
@@ -994,7 +994,7 @@ function formatTag(version, prefix, packageName, template, packageSpecificTags)
994
994
  function formatCommitMessage(template, version, packageName, additionalContext) {
995
995
  if (template.includes("${packageName}") && !packageName) {
996
996
  log(
997
- 'Warning: Your commitMessage template contains ${packageName} but no package name is available.\nThis will result in an empty package name in the commit message (e.g., "Release @v1.0.0").\n\nTo fix this:\n\u2022 If using synced mode: Set "packageSpecificTags": true to enable package names in commits\n\u2022 If you want generic commit messages: Remove ${packageName} from your commitMessage template\n\u2022 If using single/async mode: Ensure your package.json has a valid "name" field',
997
+ 'Warning: Your commitMessage template contains ${packageName} but no package name is available.\nThis will result in an empty package name in the commit message (e.g., "Release @v1.0.0").\n\nTo fix this:\n\u2022 If using sync mode: Set "packageSpecificTags": true to enable package names in commits\n\u2022 If you want generic commit messages: Remove ${packageName} from your commitMessage template\n\u2022 If using single/async mode: Ensure your package.json has a valid "name" field',
998
998
  "warning"
999
999
  );
1000
1000
  }
@@ -1964,7 +1964,7 @@ function shouldProcessPackage2(pkg, config) {
1964
1964
  const pkgName = pkg.packageJson.name;
1965
1965
  return shouldProcessPackage(pkgName, config.skip);
1966
1966
  }
1967
- function createSyncedStrategy(config) {
1967
+ function createSyncStrategy(config) {
1968
1968
  return async (packages) => {
1969
1969
  try {
1970
1970
  const {
@@ -2301,14 +2301,14 @@ function createAsyncStrategy(config) {
2301
2301
  };
2302
2302
  }
2303
2303
  function createStrategy(config) {
2304
- if (config.synced) {
2305
- return createSyncedStrategy(config);
2304
+ if (config.sync) {
2305
+ return createSyncStrategy(config);
2306
2306
  }
2307
2307
  return createAsyncStrategy(config);
2308
2308
  }
2309
2309
  function createStrategyMap(config) {
2310
2310
  return {
2311
- synced: createSyncedStrategy(config),
2311
+ sync: createSyncStrategy(config),
2312
2312
  single: createSingleStrategy(config),
2313
2313
  async: createAsyncStrategy(config)
2314
2314
  };
@@ -2409,7 +2409,7 @@ var VersionEngine = class {
2409
2409
  }
2410
2410
  /**
2411
2411
  * Change the current strategy
2412
- * @param strategyType The strategy type to use: 'synced', 'single', or 'async'
2412
+ * @param strategyType The strategy type to use: 'sync', 'single', or 'async'
2413
2413
  */
2414
2414
  setStrategy(strategyType) {
2415
2415
  this.currentStrategy = this.strategies[strategyType];
@@ -2443,7 +2443,7 @@ async function run() {
2443
2443
  program.command("version", { isDefault: true }).description("Version a package or packages based on configuration").option(
2444
2444
  "-c, --config <path>",
2445
2445
  "Path to config file (defaults to version.config.json in current directory)"
2446
- ).option("-d, --dry-run", "Dry run (no changes made)", false).option("-b, --bump <type>", "Specify bump type (patch|minor|major)").option("-p, --prerelease [identifier]", "Create prerelease version").option("-s, --synced", "Use synchronized versioning across all packages").option("-j, --json", "Output results as JSON", false).option("-t, --target <packages>", "Comma-delimited list of package names to target").option("--project-dir <path>", "Project directory to run commands in", process.cwd()).action(async (options) => {
2446
+ ).option("-d, --dry-run", "Dry run (no changes made)", false).option("-b, --bump <type>", "Specify bump type (patch|minor|major)").option("-p, --prerelease [identifier]", "Create prerelease version").option("-s, --sync", "Use synchronized versioning across all packages").option("-j, --json", "Output results as JSON", false).option("-t, --target <packages>", "Comma-delimited list of package names to target").option("--project-dir <path>", "Project directory to run commands in", process.cwd()).action(async (options) => {
2447
2447
  if (options.json) {
2448
2448
  enableJsonOutput(options.dryRun);
2449
2449
  }
@@ -2462,7 +2462,7 @@ async function run() {
2462
2462
  const config = await loadConfig(options.config);
2463
2463
  log(`Loaded configuration from ${options.config || "version.config.json"}`, "info");
2464
2464
  if (options.dryRun) config.dryRun = true;
2465
- if (options.synced) config.synced = true;
2465
+ if (options.sync) config.sync = true;
2466
2466
  if (options.bump) config.type = options.bump;
2467
2467
  if (options.prerelease) {
2468
2468
  config.prereleaseIdentifier = options.prerelease === true ? "next" : options.prerelease;
@@ -2474,10 +2474,10 @@ async function run() {
2474
2474
  const resolvedCount = pkgsResult.packages.length;
2475
2475
  log(`Resolved ${resolvedCount} packages from workspace`, "debug");
2476
2476
  log(`Config packages: ${JSON.stringify(config.packages)}`, "debug");
2477
- log(`Config synced: ${config.synced}`, "debug");
2478
- if (config.synced) {
2479
- log("Using synced versioning strategy.", "info");
2480
- engine.setStrategy("synced");
2477
+ log(`Config sync: ${config.sync}`, "debug");
2478
+ if (config.sync) {
2479
+ log("Using sync versioning strategy.", "info");
2480
+ engine.setStrategy("sync");
2481
2481
  await engine.run(pkgsResult);
2482
2482
  } else if (resolvedCount === 1) {
2483
2483
  log("Using single package versioning strategy.", "info");
@@ -334,7 +334,7 @@ Warning: Your tagTemplate contains ${packageName} but no package name is availab
334
334
  This will result in an empty package name in the tag (e.g., "@v1.0.0" instead of "my-package@v1.0.0").
335
335
 
336
336
  To fix this:
337
- • If using synced mode: Set "packageSpecificTags": true in your config to enable package names in tags
337
+ • If using sync mode: Set "packageSpecificTags": true in your config to enable package names in tags
338
338
  • If you want global tags: Remove ${packageName} from your tagTemplate (e.g., use "${prefix}${version}")
339
339
  • If using single/async mode: Ensure your package.json has a valid "name" field
340
340
  ```
@@ -344,7 +344,7 @@ To fix this:
344
344
  1. **For Synced Mode with Package Names**: Enable package-specific tags
345
345
  ```json
346
346
  {
347
- "synced": true,
347
+ "sync": true,
348
348
  "packageSpecificTags": true,
349
349
  "tagTemplate": "${packageName}@${prefix}${version}"
350
350
  }
@@ -397,11 +397,11 @@ For global commit messages, use templates without `${packageName}`:
397
397
 
398
398
  ## Monorepo Versioning Modes
399
399
 
400
- While primarily used for single packages now, `package-versioner` retains options for monorepo workflows, controlled mainly by the `synced` flag in `version.config.json`.
400
+ While primarily used for single packages now, `package-versioner` retains options for monorepo workflows, controlled mainly by the `sync` flag in `version.config.json`.
401
401
 
402
- ### Synced Mode (`synced: true`)
402
+ ### Sync Mode (`sync: true`)
403
403
 
404
- This is the default if the `synced` flag is present and true.
404
+ This is the default if the `sync` flag is present and true.
405
405
 
406
406
  - **Behaviour:** The tool calculates **one** version bump based on the overall history (or branch pattern). This single new version is applied to **all** packages within the repository (or just the root `package.json` if not a structured monorepo). A single Git tag is created.
407
407
  - **Tag Behaviour:**
@@ -409,7 +409,7 @@ This is the default if the `synced` flag is present and true.
409
409
  - In **single-package repositories**: Respects the `packageSpecificTags` setting - can create either `v1.2.3` or `package-name@v1.2.3`
410
410
  - **Use Case:** Suitable for monorepos where all packages are tightly coupled and released together with the same version number. Also the effective mode for single-package repositories.
411
411
 
412
- ### Async Mode (`synced: false`)
412
+ ### Async Mode (`sync: false`)
413
413
 
414
414
  *(Note: This mode relies heavily on monorepo tooling and structure, like `pnpm workspaces` and correctly configured package dependencies.)*
415
415
 
@@ -41,7 +41,7 @@
41
41
  "description": "The main branch for versioning",
42
42
  "default": "main"
43
43
  },
44
- "synced": {
44
+ "sync": {
45
45
  "type": "boolean",
46
46
  "default": false,
47
47
  "description": "Whether packages should be versioned together"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "package-versioner",
3
3
  "description": "A lightweight yet powerful CLI tool for automated semantic versioning based on Git history and conventional commits.",
4
- "version": "0.8.6",
4
+ "version": "0.9.1",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",