@review-vir/common 2.0.0 → 3.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/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './parse-
|
|
1
|
+
export * from './parse-description-users.js';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './parse-
|
|
1
|
+
export * from './parse-description-users.js';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Accepts a pull request text body, expected to be in plain text format (not markdown) and parses
|
|
3
|
+
* out tagged primary reviewers from strings that look like:
|
|
4
|
+
*
|
|
5
|
+
* `primary reviewer: @username, @otherUsername`
|
|
6
|
+
*
|
|
7
|
+
* Which will return the following output:
|
|
8
|
+
*
|
|
9
|
+
* `['username', 'otherUsername']`
|
|
10
|
+
*/
|
|
11
|
+
export declare function parseDescriptionUsers({ triggerText, bodyText, }: {
|
|
12
|
+
/**
|
|
13
|
+
* The start of the line for which usernames need to be parsed out of. An `'s'` is automatically
|
|
14
|
+
* allowed at the end of this text. Case insensitive.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
*
|
|
18
|
+
* - `'primary reviewer'`
|
|
19
|
+
* - `'code owner'`
|
|
20
|
+
*/
|
|
21
|
+
triggerText: string;
|
|
22
|
+
bodyText: string;
|
|
23
|
+
}): string[];
|
|
@@ -9,11 +9,12 @@ import { removePrefix, safeMatch } from '@augment-vir/common';
|
|
|
9
9
|
*
|
|
10
10
|
* `['username', 'otherUsername']`
|
|
11
11
|
*/
|
|
12
|
-
export function
|
|
13
|
-
const [, match,] = safeMatch(bodyText,
|
|
12
|
+
export function parseDescriptionUsers({ triggerText, bodyText, }) {
|
|
13
|
+
const [, match,] = safeMatch(bodyText, new RegExp(`${triggerText}s?\\W+((?:@[^@]+)+)(?:\n\n|$|\n#)`, 'i'));
|
|
14
14
|
if (!match) {
|
|
15
15
|
return [];
|
|
16
16
|
}
|
|
17
|
-
const
|
|
17
|
+
const [, restrictedMatch,] = safeMatch(match, /((?:@[\w-]+[^\w@]*)+)/);
|
|
18
|
+
const userTags = Array.from(restrictedMatch?.matchAll(/@[\w-]+/g) || []);
|
|
18
19
|
return userTags.map((userTag) => removePrefix({ value: userTag[0], prefix: '@' }));
|
|
19
20
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@review-vir/common",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "Common functionality that review-vir primary uses but other external packages need as well.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"review-vir",
|
|
7
|
+
"primary reviewers",
|
|
8
|
+
"vir",
|
|
9
|
+
"code owners"
|
|
10
|
+
],
|
|
5
11
|
"homepage": "https://github.com/review-vir/review-vir",
|
|
6
12
|
"bugs": {
|
|
7
13
|
"url": "https://github.com/review-vir/review-vir/issues"
|
|
@@ -29,20 +35,20 @@
|
|
|
29
35
|
"test:docs": "virmator docs check"
|
|
30
36
|
},
|
|
31
37
|
"dependencies": {
|
|
32
|
-
"@augment-vir/assert": "^
|
|
33
|
-
"@augment-vir/common": "^
|
|
38
|
+
"@augment-vir/assert": "^31.1.1",
|
|
39
|
+
"@augment-vir/common": "^31.1.1"
|
|
34
40
|
},
|
|
35
41
|
"devDependencies": {
|
|
36
|
-
"@augment-vir/test": "^
|
|
37
|
-
"@web/dev-server-esbuild": "^1.0.
|
|
42
|
+
"@augment-vir/test": "^31.1.1",
|
|
43
|
+
"@web/dev-server-esbuild": "^1.0.3",
|
|
38
44
|
"@web/test-runner": "^0.19.0",
|
|
39
45
|
"@web/test-runner-commands": "^0.9.0",
|
|
40
46
|
"@web/test-runner-playwright": "^0.11.0",
|
|
41
47
|
"@web/test-runner-visual-regression": "^0.10.0",
|
|
42
48
|
"istanbul-smart-text-reporter": "^1.1.5",
|
|
43
|
-
"markdown-code-example-inserter": "^3.0.
|
|
44
|
-
"typedoc": "^0.
|
|
45
|
-
"typescript": "
|
|
49
|
+
"markdown-code-example-inserter": "^3.0.3",
|
|
50
|
+
"typedoc": "^0.27.4",
|
|
51
|
+
"typescript": "~5.6.3"
|
|
46
52
|
},
|
|
47
53
|
"engines": {
|
|
48
54
|
"node": ">=22"
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Accepts a pull request text body, expected to be in plain text format (not markdown) and parses
|
|
3
|
-
* out tagged primary reviewers from strings that look like:
|
|
4
|
-
*
|
|
5
|
-
* `primary reviewer: @username, @otherUsername`
|
|
6
|
-
*
|
|
7
|
-
* Which will return the following output:
|
|
8
|
-
*
|
|
9
|
-
* `['username', 'otherUsername']`
|
|
10
|
-
*/
|
|
11
|
-
export declare function parsePrimaryReviewers({ bodyText }: {
|
|
12
|
-
bodyText: string;
|
|
13
|
-
}): string[];
|