@review-vir/common 3.1.0 → 3.1.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.
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines the Markdown that identifies a code owners block in a pull request description.
|
|
3
|
+
*
|
|
4
|
+
* @category Main
|
|
5
|
+
*/
|
|
6
|
+
export declare const codeOwnersMarkdown: Readonly<{
|
|
7
|
+
blockEnd: "<!-- code owners end -->";
|
|
8
|
+
blockStart: "<!-- code owners start -->";
|
|
9
|
+
heading: "## Code Owners";
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* Formats the code owners content that pull-request-vir writes into a pull request description.
|
|
13
|
+
*
|
|
14
|
+
* @category Main
|
|
15
|
+
*/
|
|
16
|
+
export declare function createCodeOwnersMarkdownBlock(content: string): string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines the Markdown that identifies a code owners block in a pull request description.
|
|
3
|
+
*
|
|
4
|
+
* @category Main
|
|
5
|
+
*/
|
|
6
|
+
export const codeOwnersMarkdown = Object.freeze({
|
|
7
|
+
blockEnd: '<!-- code owners end -->',
|
|
8
|
+
blockStart: '<!-- code owners start -->',
|
|
9
|
+
heading: '## Code Owners',
|
|
10
|
+
});
|
|
11
|
+
/**
|
|
12
|
+
* Formats the code owners content that pull-request-vir writes into a pull request description.
|
|
13
|
+
*
|
|
14
|
+
* @category Main
|
|
15
|
+
*/
|
|
16
|
+
export function createCodeOwnersMarkdownBlock(content) {
|
|
17
|
+
return [
|
|
18
|
+
codeOwnersMarkdown.blockStart,
|
|
19
|
+
codeOwnersMarkdown.heading,
|
|
20
|
+
content,
|
|
21
|
+
codeOwnersMarkdown.blockEnd,
|
|
22
|
+
].join('\n');
|
|
23
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { removeDuplicates, removePrefix, safeMatch } from '@augment-vir/common';
|
|
2
|
-
|
|
2
|
+
import { codeOwnersMarkdown } from './code-owners-markdown.js';
|
|
3
|
+
const insertedCodeOwnersRegExp = new RegExp(String.raw `${codeOwnersMarkdown.blockStart}([\S\s]*?)${codeOwnersMarkdown.blockEnd}`, 'i');
|
|
3
4
|
const fileLinkLineRegExp = /^\s*-\s/;
|
|
4
5
|
const userTagRegExp = /@[\w-]+/g;
|
|
5
6
|
/**
|
|
@@ -9,7 +10,7 @@ const userTagRegExp = /@[\w-]+/g;
|
|
|
9
10
|
* line followed by a collapsible list of their owned files:
|
|
10
11
|
*
|
|
11
12
|
* <!-- code owners start -->
|
|
12
|
-
*
|
|
13
|
+
* ## Code Owners
|
|
13
14
|
* (at)username1
|
|
14
15
|
* <details>
|
|
15
16
|
* <summary>Owned files</summary>
|