package-versioner 0.8.3 → 0.8.4

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
@@ -159,7 +159,7 @@ Customize behaviour by creating a `version.config.json` file in your project roo
159
159
  #### Monorepo-Specific Options
160
160
  - `synced`: Whether all packages should be versioned together (default: true)
161
161
  - `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/**/*"])
162
- - `packages`: Array of package names or patterns to target for versioning. Supports exact names, scope wildcards, and global wildcards (e.g., ["@scope/package-a", "@scope/*", "*"])
162
+ - `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/*", "*"])
163
163
  - `mainPackage`: Package name whose commit history should drive version determination
164
164
  - `packageSpecificTags`: Whether to enable package-specific tagging behaviour (default: false)
165
165
  - `updateInternalDependencies`: How to update internal dependencies ("patch", "minor", "major", or "inherit")
@@ -185,6 +185,15 @@ Target all packages within a specific scope:
185
185
  }
186
186
  ```
187
187
 
188
+ #### Path Patterns / Globs
189
+ Target all packages in a directory or matching a path pattern:
190
+ ```json
191
+ {
192
+ "packages": ["packages/**/*", "examples/**"]
193
+ }
194
+ ```
195
+ This will match all packages in nested directories under `packages/` or `examples/`.
196
+
188
197
  #### Global Wildcard
189
198
  Target all packages in the workspace:
190
199
  ```json
@@ -197,7 +206,7 @@ Target all packages in the workspace:
197
206
  Combine different pattern types:
198
207
  ```json
199
208
  {
200
- "packages": ["@mycompany/*", "@utils/logger", "legacy-package"]
209
+ "packages": ["@mycompany/*", "@utils/logger", "legacy-package", "packages/**/*"]
201
210
  }
202
211
  ```
203
212
 
package/dist/index.cjs CHANGED
@@ -1999,7 +1999,7 @@ function createSyncedStrategy(config) {
1999
1999
  mainPackage
2000
2000
  } = config;
2001
2001
  const formattedPrefix = formatVersionPrefix(versionPrefix || "v");
2002
- const latestTag = await getLatestTag();
2002
+ let latestTag = await getLatestTag();
2003
2003
  let mainPkgPath = packages.root;
2004
2004
  let mainPkgName;
2005
2005
  if (mainPackage) {
@@ -2022,6 +2022,21 @@ function createSyncedStrategy(config) {
2022
2022
  "warning"
2023
2023
  );
2024
2024
  }
2025
+ if (mainPkgName) {
2026
+ const packageSpecificTag = await getLatestTagForPackage(mainPkgName, formattedPrefix, {
2027
+ tagTemplate,
2028
+ packageSpecificTags: config.packageSpecificTags
2029
+ });
2030
+ if (packageSpecificTag) {
2031
+ latestTag = packageSpecificTag;
2032
+ log(`Using package-specific tag for ${mainPkgName}: ${latestTag}`, "debug");
2033
+ } else {
2034
+ log(
2035
+ `No package-specific tag found for ${mainPkgName}, using global tag: ${latestTag}`,
2036
+ "debug"
2037
+ );
2038
+ }
2039
+ }
2025
2040
  const nextVersion = await calculateVersion(config, {
2026
2041
  latestTag,
2027
2042
  versionPrefix: formattedPrefix,
package/dist/index.js CHANGED
@@ -1966,7 +1966,7 @@ function createSyncedStrategy(config) {
1966
1966
  mainPackage
1967
1967
  } = config;
1968
1968
  const formattedPrefix = formatVersionPrefix(versionPrefix || "v");
1969
- const latestTag = await getLatestTag();
1969
+ let latestTag = await getLatestTag();
1970
1970
  let mainPkgPath = packages.root;
1971
1971
  let mainPkgName;
1972
1972
  if (mainPackage) {
@@ -1989,6 +1989,21 @@ function createSyncedStrategy(config) {
1989
1989
  "warning"
1990
1990
  );
1991
1991
  }
1992
+ if (mainPkgName) {
1993
+ const packageSpecificTag = await getLatestTagForPackage(mainPkgName, formattedPrefix, {
1994
+ tagTemplate,
1995
+ packageSpecificTags: config.packageSpecificTags
1996
+ });
1997
+ if (packageSpecificTag) {
1998
+ latestTag = packageSpecificTag;
1999
+ log(`Using package-specific tag for ${mainPkgName}: ${latestTag}`, "debug");
2000
+ } else {
2001
+ log(
2002
+ `No package-specific tag found for ${mainPkgName}, using global tag: ${latestTag}`,
2003
+ "debug"
2004
+ );
2005
+ }
2006
+ }
1992
2007
  const nextVersion = await calculateVersion(config, {
1993
2008
  latestTag,
1994
2009
  versionPrefix: formattedPrefix,
@@ -53,7 +53,7 @@
53
53
  "minLength": 1
54
54
  },
55
55
  "default": [],
56
- "description": "Array of package names or patterns that determines which packages will be processed for versioning. When specified, only packages matching these patterns will be versioned. When empty or not specified, all workspace packages will be processed. Supports exact names (e.g., '@scope/package-a'), scope wildcards (e.g., '@scope/*'), and global wildcards (e.g., '*')"
56
+ "description": "Array of package names or patterns that determines which packages will be processed for versioning. When specified, only packages matching these patterns will be versioned. When empty or not specified, all workspace packages will be processed. Supports exact names (e.g., '@scope/package-a'), scope wildcards (e.g., '@scope/*'), path patterns (e.g., 'packages/**/*', 'examples/**'), and global wildcards (e.g., '*')."
57
57
  },
58
58
  "mainPackage": {
59
59
  "type": "string",
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.3",
4
+ "version": "0.8.4",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",