virtual-code-owners 2.0.0 → 2.1.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.
@@ -25,13 +25,22 @@ function convertLine(pTeamMap) {
25
25
  }
26
26
  };
27
27
  }
28
- function isNotIgnorable(pLine) {
28
+ function deduplicateUserNames(pLine) {
29
+ const lTrimmedLine = pLine.trim();
30
+ const lSplitLine = lTrimmedLine.match(/^(?<filesPattern>[^\s]+)(?<theRest>.*)$/);
31
+ if (lTrimmedLine.startsWith("#") || !lSplitLine?.groups) {
32
+ return pLine;
33
+ }
34
+ return `${lSplitLine.groups.filesPattern} ${Array.from(new Set(lSplitLine.groups.theRest.trim().split(/\s+/))).join(" ")}`;
35
+ }
36
+ function shouldAppearInResult(pLine) {
29
37
  return !pLine.trimStart().startsWith("#!");
30
38
  }
31
39
  export function convert(pCodeOwnersFileAsString, pTeamMap, pGeneratedWarning = DEFAULT_GENERATED_WARNING) {
32
40
  return `${pGeneratedWarning}${pCodeOwnersFileAsString
33
41
  .split(EOL)
34
- .filter(isNotIgnorable)
42
+ .filter(shouldAppearInResult)
35
43
  .map(convertLine(pTeamMap))
44
+ .map(deduplicateUserNames)
36
45
  .join(EOL)}`;
37
46
  }
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "2.0.0";
1
+ export const VERSION = "2.1.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "virtual-code-owners",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Merges a VIRTUAL-CODEOWNERS.txt and a virtual-teams.yml into CODEOWNERS",
5
5
  "type": "module",
6
6
  "exports": {
@@ -16,7 +16,8 @@
16
16
  "files": [
17
17
  "dist",
18
18
  "package.json",
19
- "README.md"
19
+ "README.md",
20
+ "LICENSE"
20
21
  ],
21
22
  "scripts": {
22
23
  "build": "rm -rf dist && ts-node --esm tools/get-version.ts > src/version.ts && tsc",