volunteer-contributions-fetch 3.1.2 → 3.1.3
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/.github/dependabot.yml +27 -0
- package/.github/workflows/release.yml +1 -1
- package/.github/workflows/test.yml +1 -1
- package/README.md +0 -2
- package/eslint.config.mjs +44 -0
- package/example/index.js +0 -1
- package/lib/bugzilla.js +0 -3
- package/lib/bugzilla.test.js +1 -1
- package/lib/community-portal.test.js +1 -1
- package/lib/discourse.js +2 -2
- package/lib/github-fetcher.js +0 -1
- package/lib/github.js +1 -1
- package/lib/github.test.js +14 -14
- package/lib/osm.js +0 -1
- package/lib/osm.test.js +1 -1
- package/lib/wiki.test.js +1 -1
- package/package.json +11 -10
- package/.eslintrc +0 -23
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: 'github-actions'
|
|
4
|
+
directory: '/'
|
|
5
|
+
schedule:
|
|
6
|
+
interval: 'daily'
|
|
7
|
+
- package-ecosystem: 'npm'
|
|
8
|
+
directory: '/'
|
|
9
|
+
schedule:
|
|
10
|
+
interval: 'weekly'
|
|
11
|
+
cooldown:
|
|
12
|
+
default-days: 7
|
|
13
|
+
semver-major-days: 14
|
|
14
|
+
semver-minor-days: 7
|
|
15
|
+
semver-patch-days: 7
|
|
16
|
+
groups:
|
|
17
|
+
production-dependencies:
|
|
18
|
+
dependency-type: 'production'
|
|
19
|
+
update-types:
|
|
20
|
+
- 'minor'
|
|
21
|
+
- 'patch'
|
|
22
|
+
development-dependencies:
|
|
23
|
+
dependency-type: 'development'
|
|
24
|
+
update-types:
|
|
25
|
+
- 'major'
|
|
26
|
+
- 'minor'
|
|
27
|
+
- 'patch'
|
package/README.md
CHANGED
|
@@ -264,8 +264,6 @@ You then can use `npm run example` which uses `fetchAll` if you would like to te
|
|
|
264
264
|
npm run eslint
|
|
265
265
|
```
|
|
266
266
|
|
|
267
|
-
Note that due to the AirBnB config we are still using ESLint 8.
|
|
268
|
-
|
|
269
267
|
### Deployments
|
|
270
268
|
|
|
271
269
|
Please use [Angular Commit Message Conventions](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-format) when contributing to this project, as depending on the commit message the GitHub Action will directly publish a new version of the package.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { defineConfig, globalIgnores } from 'eslint/config';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import js from '@eslint/js';
|
|
5
|
+
import { FlatCompat } from '@eslint/eslintrc';
|
|
6
|
+
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = path.dirname(__filename);
|
|
9
|
+
const compat = new FlatCompat({
|
|
10
|
+
baseDirectory: __dirname,
|
|
11
|
+
recommendedConfig: js.configs.recommended,
|
|
12
|
+
allConfig: js.configs.all,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export default defineConfig([
|
|
16
|
+
globalIgnores(['.nyc_output/**/*', 'coverage/**/*', 'node_modules']),
|
|
17
|
+
{
|
|
18
|
+
extends: compat.extends('plugin:prettier/recommended'),
|
|
19
|
+
|
|
20
|
+
languageOptions: {
|
|
21
|
+
ecmaVersion: 2022,
|
|
22
|
+
sourceType: 'module',
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
settings: {
|
|
26
|
+
'import/resolver': {
|
|
27
|
+
node: {
|
|
28
|
+
paths: ['lib'],
|
|
29
|
+
extensions: ['.js', '.d.ts'],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
rules: {
|
|
35
|
+
'arrow-body-style': 0,
|
|
36
|
+
'comma-dangle': 0,
|
|
37
|
+
'import/extensions': 0,
|
|
38
|
+
'import/prefer-default-export': 0,
|
|
39
|
+
'no-plusplus': 0,
|
|
40
|
+
'no-restricted-syntax': 0,
|
|
41
|
+
'no-use-before-define': 0,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
]);
|
package/example/index.js
CHANGED
package/lib/bugzilla.js
CHANGED
|
@@ -81,11 +81,9 @@ async function* bugPageGenerator(bugzilla, stopDate) {
|
|
|
81
81
|
const query = `quicksearch=ALL%20commenter:${bugzilla.username}&limit=${RESULTS_PER_PAGE}&offset=${offset}&last_change_time=${stop}`;
|
|
82
82
|
const bugsUrl = `${bugzilla.baseUrl}/rest/bug?${query}`;
|
|
83
83
|
debug(`Fetching from ${bugsUrl}`);
|
|
84
|
-
// eslint-disable-next-line no-await-in-loop
|
|
85
84
|
const response = await fetch(bugsUrl, {
|
|
86
85
|
signal: AbortSignal.timeout(FETCH_TIMEOUT),
|
|
87
86
|
});
|
|
88
|
-
// eslint-disable-next-line no-await-in-loop
|
|
89
87
|
const data = await response.json();
|
|
90
88
|
debug(`Got ${data.bugs.length} bugs results`);
|
|
91
89
|
// If we have less results than the max result, we're at the end
|
|
@@ -104,7 +102,6 @@ async function* getComments(bugzilla, bugs, titleMap) {
|
|
|
104
102
|
for await (const bug of bugs) {
|
|
105
103
|
const commentsUrl = `${bugzilla.baseUrl}/rest/bug/${bug.id}/comment`;
|
|
106
104
|
debug(`Fetching from ${commentsUrl}`);
|
|
107
|
-
// eslint-disable-next-line no-await-in-loop
|
|
108
105
|
const response = await fetch(commentsUrl, {
|
|
109
106
|
signal: AbortSignal.timeout(FETCH_TIMEOUT),
|
|
110
107
|
});
|
package/lib/bugzilla.test.js
CHANGED
package/lib/discourse.js
CHANGED
|
@@ -104,7 +104,7 @@ async function* topicPageGenerator(baseUrl, username) {
|
|
|
104
104
|
while (true) {
|
|
105
105
|
debug(`Getting page ${page}`);
|
|
106
106
|
const url = `${baseUrl}/topics/created-by/${username}.json?page=${page}`;
|
|
107
|
-
const results = await getDiscourseData(url);
|
|
107
|
+
const results = await getDiscourseData(url);
|
|
108
108
|
page++;
|
|
109
109
|
yield results;
|
|
110
110
|
}
|
|
@@ -116,7 +116,7 @@ async function* postPageGenerator(baseUrl, username) {
|
|
|
116
116
|
debug(`Getting page ${page}`);
|
|
117
117
|
const offset = page * RESULTS_PER_PAGE;
|
|
118
118
|
const url = `${baseUrl}/user_actions.json?username=${username}&filter=5&offset=${offset}`;
|
|
119
|
-
const results = await getDiscourseData(url);
|
|
119
|
+
const results = await getDiscourseData(url);
|
|
120
120
|
page++;
|
|
121
121
|
yield results;
|
|
122
122
|
}
|
package/lib/github-fetcher.js
CHANGED
package/lib/github.js
CHANGED
|
@@ -367,7 +367,7 @@ async function* pageGenerator(github, period, cb, { skipProcessing } = {}) {
|
|
|
367
367
|
let page = 1;
|
|
368
368
|
while (hasMoreToFetch) {
|
|
369
369
|
debug(`Getting data for period between ${period[1]} and ${period[0]}`);
|
|
370
|
-
const results = await cb(period, page);
|
|
370
|
+
const results = await cb(period, page);
|
|
371
371
|
|
|
372
372
|
if (!Array.isArray(results)) {
|
|
373
373
|
return;
|
package/lib/github.test.js
CHANGED
|
@@ -13,27 +13,27 @@ const config = {
|
|
|
13
13
|
},
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
+
vi.mock('./github-fetcher.js', async () => {
|
|
17
|
+
return {
|
|
18
|
+
PRIVATE_SCOPE_ERROR: 'PRIVATE_SCOPE',
|
|
19
|
+
RESULTS_PER_PAGE: 100,
|
|
20
|
+
searchCommits: vi.fn().mockResolvedValue([]),
|
|
21
|
+
searchIssues: vi.fn().mockResolvedValue([]),
|
|
22
|
+
listReviews: vi.fn().mockResolvedValue([]),
|
|
23
|
+
listComments: vi.fn().mockResolvedValue([]),
|
|
24
|
+
throwIfTokenHasPrivateRepoScope: vi.fn(),
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
|
|
16
28
|
beforeEach(() => {
|
|
17
29
|
vi.useFakeTimers();
|
|
18
30
|
vi.setSystemTime(new Date('2022-03-02'));
|
|
19
31
|
|
|
20
|
-
|
|
21
|
-
return {
|
|
22
|
-
PRIVATE_SCOPE_ERROR: 'PRIVATE_SCOPE',
|
|
23
|
-
RESULTS_PER_PAGE: 100,
|
|
24
|
-
searchCommits: vi.fn().mockResolvedValue([]),
|
|
25
|
-
searchIssues: vi.fn().mockResolvedValue([]),
|
|
26
|
-
listReviews: vi.fn().mockResolvedValue([]),
|
|
27
|
-
listComments: vi.fn().mockResolvedValue([]),
|
|
28
|
-
throwIfTokenHasPrivateRepoScope: vi.fn(),
|
|
29
|
-
};
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
vi.stubEnv('GITHUB_TOKEN', 'some_test_token');
|
|
32
|
+
process.env.GITHUB_TOKEN = 'some_test_token';
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
afterEach(() => {
|
|
36
|
-
vi.
|
|
36
|
+
vi.resetAllMocks();
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
test('should validate valid config', () => {
|
package/lib/osm.js
CHANGED
|
@@ -37,7 +37,6 @@ async function processEdits({ displayName, stopDate }) {
|
|
|
37
37
|
let createdBefore = new Date().toISOString();
|
|
38
38
|
|
|
39
39
|
while (hasMoreData) {
|
|
40
|
-
// eslint-disable-next-line no-await-in-loop
|
|
41
40
|
const edits = await getPage(displayName, stopDate, createdBefore);
|
|
42
41
|
debug(`Got ${edits.length} results to filter`);
|
|
43
42
|
const processed = processEntities(edits);
|
package/lib/osm.test.js
CHANGED
package/lib/wiki.test.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "volunteer-contributions-fetch",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.3",
|
|
4
4
|
"description": "Library to fetch volunteer contributions from several sources such as GitHub",
|
|
5
5
|
"author": "Michael Kohler",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,22 +13,23 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@octokit/rest": "^22.0.0",
|
|
15
15
|
"debug": "^4.4.3",
|
|
16
|
-
"jsdom": "^
|
|
16
|
+
"jsdom": "^29.0.0",
|
|
17
17
|
"xml2js": "^0.6.2",
|
|
18
18
|
"zod": "^4.1.12"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@commitlint/cli": "^20.
|
|
22
|
-
"@commitlint/config-angular": "^20.
|
|
23
|
-
"@
|
|
24
|
-
"eslint": "^
|
|
25
|
-
"
|
|
26
|
-
"eslint
|
|
21
|
+
"@commitlint/cli": "^20.5.0",
|
|
22
|
+
"@commitlint/config-angular": "^20.5.0",
|
|
23
|
+
"@eslint/eslintrc": "^3.3.5",
|
|
24
|
+
"@eslint/js": "^10.0.1",
|
|
25
|
+
"@vitest/coverage-v8": "^4.1.0",
|
|
26
|
+
"eslint": "^10.0.3",
|
|
27
|
+
"eslint-config-prettier": "^10.1.8",
|
|
27
28
|
"eslint-plugin-prettier": "^5.5.4",
|
|
28
29
|
"husky": "^9.1.7",
|
|
29
|
-
"prettier": "^3.
|
|
30
|
+
"prettier": "^3.7.4",
|
|
30
31
|
"semantic-release": "^25.0.1-beta.1",
|
|
31
|
-
"vitest": "^
|
|
32
|
+
"vitest": "^4.1.0"
|
|
32
33
|
},
|
|
33
34
|
"scripts": {
|
|
34
35
|
"prepare": "husky",
|
package/.eslintrc
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": ["airbnb-base", "plugin:prettier/recommended"],
|
|
3
|
-
"settings": {
|
|
4
|
-
"import/resolver": {
|
|
5
|
-
"node": {
|
|
6
|
-
"paths": ["lib"],
|
|
7
|
-
"extensions": [".js", ".ts", ".d.ts", ".tsx"]
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
},
|
|
11
|
-
"parserOptions": {
|
|
12
|
-
"ecmaVersion": 2022
|
|
13
|
-
},
|
|
14
|
-
"rules": {
|
|
15
|
-
"arrow-body-style": 0,
|
|
16
|
-
"comma-dangle": 0,
|
|
17
|
-
"import/extensions": 0,
|
|
18
|
-
"import/prefer-default-export": 0,
|
|
19
|
-
"no-plusplus": 0,
|
|
20
|
-
"no-restricted-syntax": 0,
|
|
21
|
-
"no-use-before-define": 0
|
|
22
|
-
}
|
|
23
|
-
}
|