virtual-code-owners 3.0.1 → 4.0.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
@@ -21,9 +21,9 @@ or, if you want to be verbose
21
21
 
22
22
  ```
23
23
  npx virtual-code-owners \
24
- --virtual-code-owners .github/VIRTUAL-CODEOWNERS.txt \
25
- --virtual-teams .github/virtual-teams.yml \
26
- --code-owners .github/CODEOWNERS
24
+ --virtualCodeOwners .github/VIRTUAL-CODEOWNERS.txt \
25
+ --virtualTeams .github/virtual-teams.yml \
26
+ --codeOwners .github/CODEOWNERS
27
27
  ```
28
28
 
29
29
  ## Why?
package/dist/cli.js CHANGED
@@ -1,22 +1,69 @@
1
1
  #!/usr/bin/env node
2
- import { program } from "commander";
3
2
  import { VERSION } from "./version.js";
4
3
  import { readAndConvert } from "./read-and-convert.js";
5
4
  import { writeFileSync } from "node:fs";
6
5
  import { EOL } from "node:os";
7
- program
8
- .description("Merges a VIRTUAL-CODEOWNERS.txt and a virtual-teams.yml into CODEOWNERS")
9
- .version(VERSION)
10
- .option("-v, --virtual-code-owners [file-name]", "A CODEOWNERS file with team names in them that are defined in a virtual teams file", ".github/VIRTUAL-CODEOWNERS.txt")
11
- .option("-t, --virtual-teams [file-name]", "A YAML file listing teams and their members", ".github/virtual-teams.yml")
12
- .option("-c, --code-owners [file-name]", "The location of the CODEOWNERS file", ".github/CODEOWNERS")
13
- .parse(process.argv);
6
+ import { parseArgs } from "node:util";
7
+ let lOptions;
14
8
  try {
15
- const lCodeOwnersContent = readAndConvert(program.opts().virtualCodeOwners, program.opts().virtualTeams);
16
- writeFileSync(program.opts().codeOwners, lCodeOwnersContent, {
9
+ let lParsedArgs = parseArgs({
10
+ args: process.argv.slice(2),
11
+ options: {
12
+ virtualCodeOwners: {
13
+ type: "string",
14
+ short: "v",
15
+ default: ".github/VIRTUAL-CODEOWNERS.txt",
16
+ },
17
+ virtualTeams: {
18
+ type: "string",
19
+ short: "t",
20
+ default: ".github/virtual-teams.yml",
21
+ },
22
+ codeOwners: { type: "string", short: "c", default: ".github/CODEOWNERS" },
23
+ help: { type: "boolean", short: "h", default: false },
24
+ version: { type: "boolean", short: "V", default: false },
25
+ },
26
+ strict: true,
27
+ allowPositionals: true,
28
+ tokens: false,
29
+ });
30
+ lOptions = lParsedArgs.values;
31
+ if (lOptions.help) {
32
+ showHelp();
33
+ process.exit(0);
34
+ }
35
+ if (lOptions.version) {
36
+ console.log(VERSION);
37
+ process.exit(0);
38
+ }
39
+ }
40
+ catch (pError) {
41
+ console.error(`${EOL}ERROR: ${pError.message}${EOL}`);
42
+ process.exit(1);
43
+ }
44
+ function showHelp() {
45
+ console.log(`Usage: virtual-code-owners [options]
46
+
47
+ Merges a VIRTUAL-CODEOWNERS.txt and a virtual-teams.yml into CODEOWNERS
48
+
49
+ Options:
50
+ -V, --version output the version number
51
+ -v, --virtualCodeOwners [file-name] A CODEOWNERS file with team names in them
52
+ that are defined in a virtual teams file
53
+ (default: ".github/VIRTUAL-CODEOWNERS.txt")
54
+ -t, --virtualTeams [file-name] A YAML file listing teams and their
55
+ members
56
+ (default: ".github/virtual-teams.yml")
57
+ -c, --codeOwners [file-name] The location of the CODEOWNERS file
58
+ (default: ".github/CODEOWNERS")
59
+ -h, --help display help for command`);
60
+ }
61
+ try {
62
+ const lCodeOwnersContent = readAndConvert(lOptions.virtualCodeOwners, lOptions.virtualTeams);
63
+ writeFileSync(lOptions.codeOwners, lCodeOwnersContent, {
17
64
  encoding: "utf-8",
18
65
  });
19
- console.error(`${EOL}Wrote ${program.opts().codeOwners}${EOL}`);
66
+ console.error(`${EOL}Wrote ${lOptions.codeOwners}${EOL}`);
20
67
  }
21
68
  catch (pError) {
22
69
  console.error(`ERROR: ${pError.message}`);
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "3.0.1";
1
+ export const VERSION = "4.0.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "virtual-code-owners",
3
- "version": "3.0.1",
3
+ "version": "4.0.0",
4
4
  "description": "Merges a VIRTUAL-CODEOWNERS.txt and a virtual-teams.yml into CODEOWNERS",
5
5
  "type": "module",
6
6
  "exports": {
@@ -54,9 +54,9 @@
54
54
  "devDependencies": {
55
55
  "@types/js-yaml": "4.0.5",
56
56
  "@types/mocha": "10.0.1",
57
- "@types/node": "20.1.4",
57
+ "@types/node": "20.2.1",
58
58
  "c8": "7.13.0",
59
- "dependency-cruiser": "13.0.0",
59
+ "dependency-cruiser": "13.0.1",
60
60
  "husky": "8.0.3",
61
61
  "lint-staged": "13.2.2",
62
62
  "mocha": "10.2.0",
@@ -67,10 +67,9 @@
67
67
  "watskeburt": "0.11.2"
68
68
  },
69
69
  "dependencies": {
70
- "commander": "10.0.1",
71
70
  "js-yaml": "4.1.0"
72
71
  },
73
72
  "engines": {
74
- "node": "^16.14||>=18"
73
+ "node": "^16.19.0||^18.11.0||>=20.0.0"
75
74
  }
76
75
  }