@commitlint/config-pnpm-scopes 19.5.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/index.js +17 -17
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import path from
|
|
1
|
+
import path from "node:path";
|
|
2
2
|
|
|
3
|
-
import fg from
|
|
4
|
-
import readYamlFile from
|
|
5
|
-
import {readExactProjectManifest} from
|
|
3
|
+
import fg from "fast-glob";
|
|
4
|
+
import readYamlFile from "read-yaml-file";
|
|
5
|
+
import { readExactProjectManifest } from "@pnpm/read-project-manifest";
|
|
6
6
|
|
|
7
7
|
export default {
|
|
8
|
-
utils: {getProjects},
|
|
8
|
+
utils: { getProjects },
|
|
9
9
|
rules: {
|
|
10
|
-
|
|
11
|
-
getProjects(ctx).then((packages) => [2,
|
|
10
|
+
"scope-enum": (ctx) =>
|
|
11
|
+
getProjects(ctx).then((packages) => [2, "always", packages]),
|
|
12
12
|
},
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
function requirePackagesManifest(dir) {
|
|
16
|
-
return readYamlFile(path.join(dir,
|
|
17
|
-
if (err.code ===
|
|
16
|
+
return readYamlFile(path.join(dir, "pnpm-workspace.yaml")).catch((err) => {
|
|
17
|
+
if (err.code === "ENOENT") {
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -25,9 +25,9 @@ function requirePackagesManifest(dir) {
|
|
|
25
25
|
function normalizePatterns(patterns) {
|
|
26
26
|
const normalizedPatterns = [];
|
|
27
27
|
for (const pattern of patterns) {
|
|
28
|
-
normalizedPatterns.push(pattern.replace(/\/?$/,
|
|
29
|
-
normalizedPatterns.push(pattern.replace(/\/?$/,
|
|
30
|
-
normalizedPatterns.push(pattern.replace(/\/?$/,
|
|
28
|
+
normalizedPatterns.push(pattern.replace(/\/?$/, "/package.json"));
|
|
29
|
+
normalizedPatterns.push(pattern.replace(/\/?$/, "/package.json5"));
|
|
30
|
+
normalizedPatterns.push(pattern.replace(/\/?$/, "/package.yaml"));
|
|
31
31
|
}
|
|
32
32
|
return normalizedPatterns;
|
|
33
33
|
}
|
|
@@ -36,22 +36,22 @@ function findWorkspacePackages(cwd) {
|
|
|
36
36
|
return requirePackagesManifest(cwd)
|
|
37
37
|
.then((manifest) => {
|
|
38
38
|
const patterns = normalizePatterns(
|
|
39
|
-
(manifest && manifest.packages) || [
|
|
39
|
+
(manifest && manifest.packages) || ["**"],
|
|
40
40
|
);
|
|
41
41
|
const opts = {
|
|
42
42
|
cwd,
|
|
43
|
-
ignore: [
|
|
43
|
+
ignore: ["**/node_modules/**", "**/bower_components/**"],
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
return fg(patterns, opts);
|
|
47
47
|
})
|
|
48
48
|
.then((entries) => {
|
|
49
49
|
const paths = Array.from(
|
|
50
|
-
new Set(entries.map((entry) => path.join(cwd, entry)))
|
|
50
|
+
new Set(entries.map((entry) => path.join(cwd, entry))),
|
|
51
51
|
);
|
|
52
52
|
|
|
53
53
|
return Promise.all(
|
|
54
|
-
paths.map((manifestPath) => readExactProjectManifest(manifestPath))
|
|
54
|
+
paths.map((manifestPath) => readExactProjectManifest(manifestPath)),
|
|
55
55
|
);
|
|
56
56
|
})
|
|
57
57
|
.then((manifests) => {
|
|
@@ -69,7 +69,7 @@ function getProjects(context) {
|
|
|
69
69
|
const name = project.name;
|
|
70
70
|
|
|
71
71
|
if (name) {
|
|
72
|
-
projects.push(name.charAt(0) ===
|
|
72
|
+
projects.push(name.charAt(0) === "@" ? name.split("/")[1] : name);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
return projects;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commitlint/config-pnpm-scopes",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "19.
|
|
4
|
+
"version": "19.8.1",
|
|
5
5
|
"description": "Shareable commitlint config enforcing pnpm workspaces names as scopes",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"files": [
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"read-yaml-file": "^2.1.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@commitlint/test": "^19.
|
|
41
|
-
"@commitlint/utils": "^19.
|
|
40
|
+
"@commitlint/test": "^19.8.1",
|
|
41
|
+
"@commitlint/utils": "^19.8.1"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "3c302008cabeb0b08cd246b2417a51a9d745a918"
|
|
44
44
|
}
|