virtual-code-owners 6.1.1 → 6.2.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.
@@ -22,7 +22,10 @@ function generateLine(pCSTLine, pTeamMap) {
22
22
  const lUserNames = uniq(pCSTLine.users.flatMap((pUser) => expandTeamToUserNames(pUser, pTeamMap)))
23
23
  .sort(compareUserNames)
24
24
  .join(" ");
25
- return pCSTLine.filesPattern + pCSTLine.spaces + lUserNames;
25
+ return (pCSTLine.filesPattern +
26
+ pCSTLine.spaces +
27
+ lUserNames +
28
+ (pCSTLine.inlineComment ? ` #${pCSTLine.inlineComment}` : ""));
26
29
  }
27
30
  return pCSTLine.raw;
28
31
  }
@@ -23,8 +23,7 @@ export default function generateLabelerYml(pCodeOwners, pTeamMap, pGeneratedWarn
23
23
  function getPatternsForTeam(pCodeOwners, pTeamName) {
24
24
  return (pCodeOwners
25
25
  .filter((pLine) => {
26
- const isARule = pLine.type === "rule";
27
- return (isARule &&
26
+ return (pLine.type === "rule" &&
28
27
  lineContainsTeamName(pLine, pTeamName));
29
28
  })
30
29
  .map((pLine) => pLine.filesPattern));
package/dist/main.js CHANGED
@@ -28,7 +28,7 @@ Options:
28
28
  --dryRun Just validate inputs, don't generate
29
29
  outputs (default: false)
30
30
  -h, --help display help for command`;
31
- export function cli(pArguments = process.argv.slice(2), pOutStream = process.stdout, pErrorStream = process.stderr) {
31
+ export function cli(pArguments = process.argv.slice(2), pOutStream = process.stdout, pErrorStream = process.stderr, pErrorExitCode = 1) {
32
32
  try {
33
33
  const lOptions = getOptions(pArguments);
34
34
  if (lOptions.help) {
@@ -43,7 +43,7 @@ export function cli(pArguments = process.argv.slice(2), pOutStream = process.std
43
43
  }
44
44
  catch (pError) {
45
45
  pErrorStream.write(`${EOL}ERROR: ${pError.message}${EOL}${EOL}`);
46
- process.exitCode = 1;
46
+ process.exitCode = pErrorExitCode;
47
47
  }
48
48
  }
49
49
  function getOptions(pArguments) {
@@ -38,14 +38,15 @@ function orderAnomaly(pLeft, pRight) {
38
38
  }
39
39
  function parseLine(pUntreatedLine, pTeamMap, pLineNo) {
40
40
  const lTrimmedLine = pUntreatedLine.trim();
41
- const lSplitLine = lTrimmedLine.match(/^(?<filesPattern>[^\s]+)(?<spaces>\s+)(?<userNames>.*)$/);
41
+ const lCommentSplitLine = lTrimmedLine.split(/\s*#/);
42
+ const lRule = lCommentSplitLine[0].match(/^(?<filesPattern>[^\s]+)(?<spaces>\s+)(?<userNames>.*)$/);
42
43
  if (lTrimmedLine.startsWith("#!")) {
43
44
  return { type: "ignorable-comment", line: pLineNo, raw: pUntreatedLine };
44
45
  }
45
46
  if (lTrimmedLine.startsWith("#")) {
46
47
  return { type: "comment", line: pLineNo, raw: pUntreatedLine };
47
48
  }
48
- if (!lSplitLine?.groups) {
49
+ if (!lRule?.groups) {
49
50
  if (lTrimmedLine === "") {
50
51
  return { type: "empty", line: pLineNo, raw: pUntreatedLine };
51
52
  }
@@ -54,9 +55,10 @@ function parseLine(pUntreatedLine, pTeamMap, pLineNo) {
54
55
  return {
55
56
  type: "rule",
56
57
  line: pLineNo,
57
- filesPattern: lSplitLine.groups.filesPattern,
58
- spaces: lSplitLine.groups.spaces,
59
- users: parseUsers(lSplitLine.groups.userNames, pTeamMap),
58
+ filesPattern: lRule.groups.filesPattern,
59
+ spaces: lRule.groups.spaces,
60
+ users: parseUsers(lRule.groups.userNames, pTeamMap),
61
+ inlineComment: lCommentSplitLine[1] ?? "",
60
62
  raw: pUntreatedLine,
61
63
  };
62
64
  }
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "6.1.1";
1
+ export const VERSION = "6.2.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "virtual-code-owners",
3
- "version": "6.1.1",
3
+ "version": "6.2.0",
4
4
  "description": "Makes your CODEOWNERS file liveable again",
5
5
  "type": "module",
6
6
  "exports": {
@@ -48,7 +48,7 @@
48
48
  "format": "prettier --log-level warn --write \"**/*.{md,ts,json,yml}\"",
49
49
  "prepare": "husky install",
50
50
  "scm:stage": "git add .",
51
- "test": "NODE_OPTIONS=--no-warnings c8 mocha",
51
+ "test": "c8 node --no-warnings --loader 'ts-node/esm' --test-reporter ./tools/dot-with-summary.reporter.js --test src/*.test.ts",
52
52
  "update-dependencies": "npm run upem:update && npm run upem:install && npm run check",
53
53
  "upem-outdated": "npm outdated --json --long | upem --dry-run",
54
54
  "upem:install": "npm install",
@@ -69,22 +69,20 @@
69
69
  "url": "https://github.com/sverweij/virtual-code-owners/issues"
70
70
  },
71
71
  "devDependencies": {
72
- "@types/mocha": "10.0.1",
73
- "@types/node": "20.4.1",
74
- "c8": "8.0.0",
75
- "dependency-cruiser": "13.1.0",
72
+ "@types/node": "20.5.8",
73
+ "c8": "8.0.1",
74
+ "dependency-cruiser": "13.1.5",
76
75
  "husky": "8.0.3",
77
- "lint-staged": "13.2.3",
78
- "mocha": "10.2.0",
79
- "prettier": "3.0.0",
76
+ "lint-staged": "14.0.1",
77
+ "prettier": "3.0.3",
80
78
  "ts-node": "10.9.1",
81
- "typescript": "5.1.6",
79
+ "typescript": "5.2.2",
82
80
  "upem": "8.0.0",
83
- "watskeburt": "0.11.6"
81
+ "watskeburt": "1.0.1"
84
82
  },
85
83
  "dependencies": {
86
84
  "ajv": "8.12.0",
87
- "yaml": "2.3.1"
85
+ "yaml": "2.3.2"
88
86
  },
89
87
  "engines": {
90
88
  "node": "^16.19.0||^18.11.0||>=20.0.0"
package/types/types.d.ts CHANGED
@@ -15,6 +15,7 @@ export interface IInterestingCSTLine {
15
15
  filesPattern: string;
16
16
  spaces: string;
17
17
  users: IUser[];
18
+ inlineComment: string;
18
19
  raw: string;
19
20
  }
20
21
  export type UserType =