@commitlint/config-workspace-scopes 21.2.0 → 21.3.0

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
@@ -3,6 +3,13 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [21.3.0](https://github.com/conventional-changelog/commitlint/compare/v21.2.4...v21.3.0) (2026-11-28)
7
+
8
+ ### Bug Fixes
9
+
10
+ * **config-workspace-scopes:** read package patterns from workspace objects ([#5143](https://github.com/conventional-changelog/commitlint/issues/5143)) ([e487c9a](https://github.com/conventional-changelog/commitlint/commit/e487c9a7b8714beb9c0f1df726fc938f423acbad))
11
+
12
+
6
13
  # [21.2.0](https://github.com/conventional-changelog/commitlint/compare/v21.1.0...v21.2.0) (2026-06-30)
7
14
 
8
15
  **Note:** Version bump only for package @commitlint/config-workspace-scopes
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "@packages/a",
3
+ "version": "1.0.0"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "@packages/b",
3
+ "version": "1.0.0"
4
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "yarn",
3
+ "version": "1.0.0",
4
+ "workspaces": {
5
+ "packages": [
6
+ "@packages/*"
7
+ ]
8
+ }
9
+ }
package/index.js CHANGED
@@ -19,12 +19,13 @@ function getPackages(context) {
19
19
  const cwd = ctx.cwd || process.cwd();
20
20
 
21
21
  const { workspaces } = require(Path.join(cwd, "package.json"));
22
- if (!Array.isArray(workspaces)) {
22
+ const patterns = Array.isArray(workspaces) ? workspaces : workspaces?.packages;
23
+ if (!Array.isArray(patterns)) {
23
24
  // no workspaces configured, skipping
24
25
  return [];
25
26
  }
26
27
 
27
- const wsGlobs = workspaces.flatMap((ws) => {
28
+ const wsGlobs = patterns.flatMap((ws) => {
28
29
  const path = Path.posix.join(ws, "package.json");
29
30
  return globSync(path, {
30
31
  cwd,
package/index.test.js CHANGED
@@ -74,6 +74,13 @@ test("returns expected value for scoped workspaces", async () => {
74
74
  expect(value).toEqual(["a", "b"]);
75
75
  });
76
76
 
77
+ test("reads package patterns from a workspace object", async () => {
78
+ const cwd = await npm.bootstrap("fixtures/workspace-object", __dirname);
79
+
80
+ const [, , scopes] = await config.rules["scope-enum"]({ cwd });
81
+ expect(scopes).toEqual(["a", "b"]);
82
+ });
83
+
77
84
  test("returns expected value for workspaces has nested packages", async () => {
78
85
  const { "scope-enum": fn } = config.rules;
79
86
  const cwd = await npm.bootstrap("fixtures/nested-workspaces", __dirname);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@commitlint/config-workspace-scopes",
3
- "version": "21.2.0",
4
- "gitHead": "1b4e5bc0e095294ad421b3ac83f6b66665429e60",
3
+ "version": "21.3.0",
4
+ "gitHead": "c0bce295b8c1fbc4f692ec05fb760c8b157fb708",
5
5
  "description": "Shareable commitlint config enforcing workspace names as scopes",
6
6
  "keywords": [
7
7
  "commitlint",