@review-vir/common 1.0.0 → 1.0.2
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.js +1 -0
- package/dist/parse-primary-reviewers.d.ts +13 -0
- package/{src/parse-primary-reviewers.ts → dist/parse-primary-reviewers.js} +4 -11
- package/package.json +4 -6
- package/configs/typedoc.config.ts +0 -15
- package/configs/web-test-runner.config.mjs +0 -23
- package/src/parse-primary-reviewers.test.ts +0 -36
- package/tsconfig.json +0 -16
- /package/{src/index.ts → dist/index.d.ts} +0 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './parse-primary-reviewers.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
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[];
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {removePrefix, safeMatch} from '@augment-vir/common';
|
|
2
|
-
|
|
1
|
+
import { removePrefix, safeMatch } from '@augment-vir/common';
|
|
3
2
|
/**
|
|
4
3
|
* Accepts a pull request text body, expected to be in plain text format (not markdown) and parses
|
|
5
4
|
* out tagged primary reviewers from strings that look like:
|
|
@@ -10,17 +9,11 @@ import {removePrefix, safeMatch} from '@augment-vir/common';
|
|
|
10
9
|
*
|
|
11
10
|
* `['username', 'otherUsername']`
|
|
12
11
|
*/
|
|
13
|
-
export function parsePrimaryReviewers({
|
|
14
|
-
const [
|
|
15
|
-
,
|
|
16
|
-
match,
|
|
17
|
-
] = safeMatch(bodyText, /primary reviewers?((?:[^@]*@[\w\-_\d]+(?:[\s\n]|$))+)/i);
|
|
18
|
-
|
|
12
|
+
export function parsePrimaryReviewers({ bodyText }) {
|
|
13
|
+
const [, match,] = safeMatch(bodyText, /primary reviewers?((?:[^@]*@[\w\-_\d]+(?:[\s\n]|$))+)/i);
|
|
19
14
|
if (!match) {
|
|
20
15
|
return [];
|
|
21
16
|
}
|
|
22
|
-
|
|
23
17
|
const userTags = Array.from(match.matchAll(/@[\w\-\d]+/g));
|
|
24
|
-
|
|
25
|
-
return userTags.map((userTag) => removePrefix({value: userTag[0], prefix: '@'}));
|
|
18
|
+
return userTags.map((userTag) => removePrefix({ value: userTag[0], prefix: '@' }));
|
|
26
19
|
}
|
package/package.json
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@review-vir/common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"homepage": "https://github.com/review-vir/review-vir",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/review-vir/review-vir/issues"
|
|
7
7
|
},
|
|
8
|
-
"repository":
|
|
9
|
-
"type": "git",
|
|
10
|
-
"url": "https://github.com/review-vir/review-vir"
|
|
11
|
-
},
|
|
8
|
+
"repository": "git+https://github.com/review-vir/review-vir.git",
|
|
12
9
|
"license": "(MIT or CC0 1.0)",
|
|
13
10
|
"author": {
|
|
14
11
|
"name": "electrovir",
|
|
15
12
|
"url": "https://github.com/electrovir"
|
|
16
13
|
},
|
|
17
|
-
"
|
|
14
|
+
"type": "module",
|
|
15
|
+
"main": "dist/index.js",
|
|
18
16
|
"types": "dist/index.d.ts",
|
|
19
17
|
"scripts": {
|
|
20
18
|
"build": "npm run docs && mkdir -p ../../dist-pages/common && cp -r ./dist-pages/* ../../dist-pages/common/",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import {join, resolve} from 'path';
|
|
2
|
-
import type {TypeDocOptions} from 'typedoc';
|
|
3
|
-
import {baseTypedocConfig} from 'virmator/dist/compiled-base-configs/base-typedoc';
|
|
4
|
-
|
|
5
|
-
const repoRoot = resolve(__dirname, '..');
|
|
6
|
-
const indexTsFile = join(repoRoot, 'src', 'index.ts');
|
|
7
|
-
|
|
8
|
-
export const typeDocConfig: Partial<TypeDocOptions> = {
|
|
9
|
-
...baseTypedocConfig,
|
|
10
|
-
out: join(repoRoot, 'dist-pages'),
|
|
11
|
-
entryPoints: [
|
|
12
|
-
indexTsFile,
|
|
13
|
-
],
|
|
14
|
-
intentionallyNotExported: [],
|
|
15
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import {dirname} from 'path';
|
|
2
|
-
import {fileURLToPath, pathToFileURL} from 'url';
|
|
3
|
-
import {getWebTestRunnerConfigWithCoveragePercent} from 'virmator/base-configs/base-web-test-runner.mjs';
|
|
4
|
-
|
|
5
|
-
const baseConfig = getWebTestRunnerConfigWithCoveragePercent({
|
|
6
|
-
coveragePercent: 100,
|
|
7
|
-
packageRootDirPath: dirname(dirname(fileURLToPath(import.meta.url))),
|
|
8
|
-
extraScreenshotOptions: {},
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
/** @type {import('@web/test-runner').TestRunnerConfig} */
|
|
12
|
-
const webTestRunnerConfig = {
|
|
13
|
-
...baseConfig,
|
|
14
|
-
concurrency: 1,
|
|
15
|
-
port: 8001,
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export default webTestRunnerConfig;
|
|
19
|
-
|
|
20
|
-
// check if the current file is being run directly as a script
|
|
21
|
-
if (import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
22
|
-
console.info(JSON.stringify(webTestRunnerConfig, null, 4));
|
|
23
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import {itCases} from '@augment-vir/browser-testing';
|
|
2
|
-
import {parsePrimaryReviewers} from './parse-primary-reviewers';
|
|
3
|
-
|
|
4
|
-
describe(parsePrimaryReviewers.name, () => {
|
|
5
|
-
itCases(parsePrimaryReviewers, [
|
|
6
|
-
{
|
|
7
|
-
it: 'handles "reviewer"',
|
|
8
|
-
input: {bodyText: 'primary reviewer @my-name'},
|
|
9
|
-
expect: ['my-name'],
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
it: 'handles "reviewers"',
|
|
13
|
-
input: {bodyText: 'primary reviewers @my-name'},
|
|
14
|
-
expect: ['my-name'],
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
it: 'handles an actual pull request body',
|
|
18
|
-
input: {
|
|
19
|
-
bodyText:
|
|
20
|
-
'https://my-ticket-url.com/ticket-number\nPrimary reviewer:\n@my-name1\n@my-name2\nChanges\n\nadd primary reviewer support\n\nHow to test\nNothing to test.',
|
|
21
|
-
},
|
|
22
|
-
expect: [
|
|
23
|
-
'my-name1',
|
|
24
|
-
'my-name2',
|
|
25
|
-
],
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
it: 'handles no reviewers',
|
|
29
|
-
input: {
|
|
30
|
-
bodyText:
|
|
31
|
-
'https://my-ticket-url.com/ticket-number\nPrimary rev name1\n@my-name2\nChanges\n\nadd primary reviewer support\n\nHow to test\nNothing to test.',
|
|
32
|
-
},
|
|
33
|
-
expect: [],
|
|
34
|
-
},
|
|
35
|
-
]);
|
|
36
|
-
});
|
package/tsconfig.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"outDir": "dist/",
|
|
4
|
-
"rootDir": "src/"
|
|
5
|
-
},
|
|
6
|
-
"exclude": [
|
|
7
|
-
"./configs",
|
|
8
|
-
"./coverage",
|
|
9
|
-
"./dist",
|
|
10
|
-
"./dist-*",
|
|
11
|
-
"./node_modules",
|
|
12
|
-
"./test-files",
|
|
13
|
-
"./ts.out"
|
|
14
|
-
],
|
|
15
|
-
"extends": "../../configs/tsconfig.base.json"
|
|
16
|
-
}
|
|
File without changes
|