@commitlint/config-workspace-scopes 19.8.0 → 19.8.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/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
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
+ ## [19.8.1](https://github.com/conventional-changelog/commitlint/compare/v19.8.0...v19.8.1) (2025-05-08)
7
+
8
+ **Note:** Version bump only for package @commitlint/config-workspace-scopes
9
+
10
+
11
+
12
+
13
+
6
14
  # [19.8.0](https://github.com/conventional-changelog/commitlint/compare/v19.7.1...v19.8.0) (2025-03-07)
7
15
 
8
16
 
package/index.js CHANGED
@@ -1,15 +1,15 @@
1
- import {createRequire} from 'node:module';
2
- import Path from 'node:path';
1
+ import { createRequire } from "node:module";
2
+ import Path from "node:path";
3
3
 
4
- import {globSync} from 'glob';
4
+ import { globSync } from "glob";
5
5
 
6
6
  const require = createRequire(import.meta.url);
7
7
 
8
8
  export default {
9
- utils: {getPackages},
9
+ utils: { getPackages },
10
10
  rules: {
11
- 'scope-enum': (ctx) =>
12
- getPackages(ctx).then((packages) => [2, 'always', packages]),
11
+ "scope-enum": (ctx) =>
12
+ getPackages(ctx).then((packages) => [2, "always", packages]),
13
13
  },
14
14
  };
15
15
 
@@ -19,15 +19,15 @@ function getPackages(context) {
19
19
  const ctx = context || {};
20
20
  const cwd = ctx.cwd || process.cwd();
21
21
 
22
- const {workspaces} = require(Path.join(cwd, 'package.json'));
22
+ const { workspaces } = require(Path.join(cwd, "package.json"));
23
23
  if (!Array.isArray(workspaces)) {
24
24
  // no workspaces configured, skipping
25
25
  return [];
26
26
  }
27
27
 
28
28
  const wsGlobs = workspaces.flatMap((ws) => {
29
- const path = Path.posix.join(ws, 'package.json');
30
- return globSync(path, {cwd, ignore: ['**/node_modules/**']});
29
+ const path = Path.posix.join(ws, "package.json");
30
+ return globSync(path, { cwd, ignore: ["**/node_modules/**"] });
31
31
  });
32
32
 
33
33
  return wsGlobs.sort().map((pJson) => require(Path.join(cwd, pJson)));
@@ -36,6 +36,6 @@ function getPackages(context) {
36
36
  return packages
37
37
  .map((pkg) => pkg.name)
38
38
  .filter(Boolean)
39
- .map((name) => (name.charAt(0) === '@' ? name.split('/')[1] : name));
39
+ .map((name) => (name.charAt(0) === "@" ? name.split("/")[1] : name));
40
40
  });
41
41
  }
package/index.test.js CHANGED
@@ -1,86 +1,86 @@
1
- import {test, expect} from 'vitest';
2
- import path from 'node:path';
3
- import {fileURLToPath} from 'node:url';
1
+ import { test, expect } from "vitest";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
4
 
5
- import {npm} from '@commitlint/test';
5
+ import { npm } from "@commitlint/test";
6
6
 
7
- import config from './index.js';
7
+ import config from "./index.js";
8
8
 
9
- const __dirname = path.resolve(fileURLToPath(import.meta.url), '..');
9
+ const __dirname = path.resolve(fileURLToPath(import.meta.url), "..");
10
10
 
11
- test('exports rules key', () => {
12
- expect(config).toHaveProperty('rules');
11
+ test("exports rules key", () => {
12
+ expect(config).toHaveProperty("rules");
13
13
  });
14
14
 
15
- test('rules hold object', () => {
15
+ test("rules hold object", () => {
16
16
  expect(config).toMatchObject({
17
17
  rules: expect.any(Object),
18
18
  });
19
19
  });
20
20
 
21
- test('rules contain scope-enum', () => {
21
+ test("rules contain scope-enum", () => {
22
22
  expect(config).toMatchObject({
23
23
  rules: {
24
- 'scope-enum': expect.anything(),
24
+ "scope-enum": expect.anything(),
25
25
  },
26
26
  });
27
27
  });
28
28
 
29
- test('scope-enum is function', () => {
29
+ test("scope-enum is function", () => {
30
30
  expect(config).toMatchObject({
31
31
  rules: {
32
- 'scope-enum': expect.any(Function),
32
+ "scope-enum": expect.any(Function),
33
33
  },
34
34
  });
35
35
  });
36
36
 
37
- test('scope-enum does not throw for missing context', async () => {
38
- const {'scope-enum': fn} = config.rules;
37
+ test("scope-enum does not throw for missing context", async () => {
38
+ const { "scope-enum": fn } = config.rules;
39
39
  await expect(fn()).resolves.toBeTruthy();
40
40
  });
41
41
 
42
- test('scope-enum has expected severity', async () => {
43
- const {'scope-enum': fn} = config.rules;
42
+ test("scope-enum has expected severity", async () => {
43
+ const { "scope-enum": fn } = config.rules;
44
44
  const [severity] = await fn();
45
45
  expect(severity).toBe(2);
46
46
  });
47
47
 
48
- test('scope-enum has expected modifier', async () => {
49
- const {'scope-enum': fn} = config.rules;
48
+ test("scope-enum has expected modifier", async () => {
49
+ const { "scope-enum": fn } = config.rules;
50
50
  const [, modifier] = await fn();
51
- expect(modifier).toBe('always');
51
+ expect(modifier).toBe("always");
52
52
  });
53
53
 
54
- test('returns empty value for empty workspaces', async () => {
55
- const {'scope-enum': fn} = config.rules;
56
- const cwd = await npm.bootstrap('fixtures/empty', __dirname);
57
- const [, , value] = await fn({cwd});
54
+ test("returns empty value for empty workspaces", async () => {
55
+ const { "scope-enum": fn } = config.rules;
56
+ const cwd = await npm.bootstrap("fixtures/empty", __dirname);
57
+ const [, , value] = await fn({ cwd });
58
58
  expect(value).toEqual([]);
59
59
  });
60
60
 
61
- test('returns expected value for basic workspaces', async () => {
62
- const {'scope-enum': fn} = config.rules;
63
- const cwd = await npm.bootstrap('fixtures/basic', __dirname);
61
+ test("returns expected value for basic workspaces", async () => {
62
+ const { "scope-enum": fn } = config.rules;
63
+ const cwd = await npm.bootstrap("fixtures/basic", __dirname);
64
64
 
65
- const [, , value] = await fn({cwd});
66
- expect(value).toEqual(['a', 'b']);
65
+ const [, , value] = await fn({ cwd });
66
+ expect(value).toEqual(["a", "b"]);
67
67
  });
68
68
 
69
- test('returns expected value for scoped workspaces', async () => {
70
- const {'scope-enum': fn} = config.rules;
71
- const cwd = await npm.bootstrap('fixtures/scoped', __dirname);
69
+ test("returns expected value for scoped workspaces", async () => {
70
+ const { "scope-enum": fn } = config.rules;
71
+ const cwd = await npm.bootstrap("fixtures/scoped", __dirname);
72
72
 
73
- const [, , value] = await fn({cwd});
74
- expect(value).toEqual(['a', 'b']);
73
+ const [, , value] = await fn({ cwd });
74
+ expect(value).toEqual(["a", "b"]);
75
75
  });
76
76
 
77
- test('returns expected value for workspaces has nested packages', async () => {
78
- const {'scope-enum': fn} = config.rules;
79
- const cwd = await npm.bootstrap('fixtures/nested-workspaces', __dirname);
77
+ test("returns expected value for workspaces has nested packages", async () => {
78
+ const { "scope-enum": fn } = config.rules;
79
+ const cwd = await npm.bootstrap("fixtures/nested-workspaces", __dirname);
80
80
 
81
- const [, , value] = await fn({cwd});
82
- expect(value).toEqual(expect.arrayContaining(['nested-a', 'nested-b']));
81
+ const [, , value] = await fn({ cwd });
82
+ expect(value).toEqual(expect.arrayContaining(["nested-a", "nested-b"]));
83
83
  expect(value).toEqual(
84
- expect.not.arrayContaining(['dependency-a', 'dependency-b'])
84
+ expect.not.arrayContaining(["dependency-a", "dependency-b"]),
85
85
  );
86
86
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@commitlint/config-workspace-scopes",
3
3
  "type": "module",
4
- "version": "19.8.0",
4
+ "version": "19.8.1",
5
5
  "description": "Shareable commitlint config enforcing workspace names as scopes",
6
6
  "main": "index.js",
7
7
  "scripts": {
@@ -33,9 +33,9 @@
33
33
  "glob": "^10.3.10"
34
34
  },
35
35
  "devDependencies": {
36
- "@commitlint/test": "^19.8.0",
37
- "@commitlint/utils": "^19.8.0",
36
+ "@commitlint/test": "^19.8.1",
37
+ "@commitlint/utils": "^19.8.1",
38
38
  "@types/glob": "^8.1.0"
39
39
  },
40
- "gitHead": "e82f05a737626bb69979d14564f5ff601997f679"
40
+ "gitHead": "3c302008cabeb0b08cd246b2417a51a9d745a918"
41
41
  }
package/readme.md CHANGED
@@ -1,4 +1,4 @@
1
- # @commitlint/config-workspaces-scopes
1
+ # @commitlint/config-workspace-scopes
2
2
 
3
3
  Shareable `commitlint` config enforcing workspace names as scopes.
4
4
  Use with [@commitlint/cli](../cli) and [@commitlint/prompt-cli](../prompt-cli).