virtual-code-owners 4.0.1 → 4.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.
package/README.md CHANGED
@@ -62,6 +62,7 @@ libs/ubc-sales/ @abraham-ableton-ch @boris-bubbleblower-ch @charlotte-ch
62
62
  libs/ubc-after-sales/ @daisy-duck @donald-duck @john-doe-ch @pete-peterson-ch @william-the-fourth-ch
63
63
  libs/ubc-pre-sales/ @averel-dalton-ch @jean-claude-ch @john-galt-ch @valerie-valerton-ch
64
64
  libs/ubc-refund/ @abraham-ableton-ch @boris-bubbleblower-ch @charlotte-charleston-ch @dagny-taggert-ch @daisy-duck @donald-duck @gregory-gregson-ch @jane-doe-ch @john-doe-ch @karl-marx-ch @pete-peterson-ch @william-the-fourth-ch
65
+ libs/ubc-baarden/ jan@example.com korneel@example.com pier@example.com tjorus@example.com
65
66
  ```
66
67
 
67
68
  This is where `virtual-code-owners` comes in.
@@ -104,6 +105,7 @@ libs/ubc-sales/ @ch/sales
104
105
  libs/ubc-after-sales/ @ch/after-sales
105
106
  libs/ubc-pre-sales/ @ch/pre-sales
106
107
  libs/ubc-refund/ @ch/sales @ch/after-sales
108
+ libs/ubc-baarden/ @ch/mannen-met-baarden
107
109
  ```
108
110
 
109
111
  ### virtual-teams.yml
@@ -167,8 +169,9 @@ team name and _virtual-code-owners_ will leave the real name alone.
167
169
 
168
170
  ### Any limitations I should know of?
169
171
 
170
- - Currently only works for _usernames_ to identify team members - not for e-mail
171
- addresses.
172
+ - ~~Currently only works for _user names_ to identify team members - not for e-mail
173
+ addresses.~~
174
+ Works with both user names and e-mail addresses
172
175
  - _virtual-code-owners_ assumes the VIRTUAL-CODEOWNERS.txt is a valid CODEOWNERS
173
176
  file and the virtual-teams.yml is a valid yaml file with teams names as keys
174
177
  and team members as arrays under these. It will likely throw errors when this
@@ -178,7 +181,7 @@ team name and _virtual-code-owners_ will leave the real name alone.
178
181
 
179
182
  Various editors assume an ALL_CAPS file name with `#` characters on various lines
180
183
  to be markdown, and will auto format them as such - making for either very ugly
181
- or in worst cases invalid CODOWNERS files. Usually such autoformatting is not
184
+ or in worst cases invalid CODEOWNERS files. Usually such autoformatting is not
182
185
  present on text files.
183
186
 
184
187
  Apparently these editors know about CODEOWNERS, though so this auto formatting
@@ -40,7 +40,16 @@ function replaceTeamNames(pUserNames, pTeamMap) {
40
40
  return lReturnValue;
41
41
  }
42
42
  function stringifyTeamMembers(pTeamMap, pTeamName) {
43
- return pTeamMap[pTeamName].map((pUserName) => `@${pUserName}`).join(" ");
43
+ return pTeamMap[pTeamName]
44
+ .map((pUserName) => userNameToCodeOwner(pUserName))
45
+ .join(" ");
46
+ }
47
+ function userNameToCodeOwner(pUserName) {
48
+ const lEmailIshUsernameRE = /^.+@.+$/;
49
+ if (pUserName.match(lEmailIshUsernameRE)) {
50
+ return pUserName;
51
+ }
52
+ return `@${pUserName}`;
44
53
  }
45
54
  function uniqAndSortUserNames(pUserNames) {
46
55
  return Array.from(new Set(pUserNames.split(/\s+/)))
@@ -1,6 +1,6 @@
1
1
  import { readFileSync } from "node:fs";
2
2
  import yaml from "js-yaml";
3
- import { convert } from "./convert-virtual-code-owners.js";
3
+ import { convert } from "./convert-to-codeowners.js";
4
4
  export function readAndConvert(pVirtualCodeOwnersFileName, pVirtualTeamsFileName) {
5
5
  const lVirtualCodeOwnersAsAString = readFileSync(pVirtualCodeOwnersFileName, {
6
6
  encoding: "utf-8",
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "4.0.1";
1
+ export const VERSION = "4.1.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "virtual-code-owners",
3
- "version": "4.0.1",
3
+ "version": "4.1.0",
4
4
  "description": "Merges a VIRTUAL-CODEOWNERS.txt and a virtual-teams.yml into CODEOWNERS",
5
5
  "type": "module",
6
6
  "exports": {
@@ -55,7 +55,7 @@
55
55
  "@types/js-yaml": "4.0.5",
56
56
  "@types/mocha": "10.0.1",
57
57
  "@types/node": "20.2.5",
58
- "c8": "7.13.0",
58
+ "c8": "7.14.0",
59
59
  "dependency-cruiser": "13.0.2",
60
60
  "husky": "8.0.3",
61
61
  "lint-staged": "13.2.2",
@@ -64,7 +64,7 @@
64
64
  "ts-node": "10.9.1",
65
65
  "typescript": "5.0.4",
66
66
  "upem": "7.3.2",
67
- "watskeburt": "0.11.2"
67
+ "watskeburt": "0.11.3"
68
68
  },
69
69
  "dependencies": {
70
70
  "js-yaml": "4.1.0"