volunteer-contributions-fetch 1.0.1 → 2.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
@@ -12,7 +12,7 @@ Currently the following sources are supported. Feel free to contribute a PR if y
12
12
  * Issues
13
13
  * PRs
14
14
  * PR Reviews
15
- * Wiki
15
+ * MediaWiki
16
16
  * Page edited
17
17
  * Discourse
18
18
  * Topic created
@@ -83,7 +83,7 @@ This section documents all the possible configuration values. For examples see t
83
83
  | `communityPortal` | Object | No | - | Community Portal configuration options (see below) |
84
84
  | `discourse` | Object | No | - | Discourse configuration options (see below) |
85
85
  | `github` | Object | No | - | GitHub configuration options (see below) |
86
- | `wiki` | Object | No | - | Wiki configuration options (see below) |
86
+ | `mediaWiki` | Object | No | - | MediaWiki configuration options (see below) |
87
87
 
88
88
  #### Community Portal
89
89
 
@@ -101,7 +101,7 @@ This section documents all the possible configuration values. For examples see t
101
101
  |---------------------|-----------|----------|---------|----------------------------------------------------------------------------------------------------------------------------|
102
102
  | `enabled` | boolean | Yes | - | Indicates whether this data source is enabled. Alternatively you can also leave off the `discourse` object entirely. |
103
103
  | `baseUrl` | string | Yes | - | API base url without trailing slash |
104
- | `username` | string | Yes | - | Username on Discoruse |
104
+ | `username` | string | Yes | - | Username on Discourse |
105
105
  | `topicType` | string | Yes | - | Label for entries related to having created a new topic. |
106
106
  | `postType` | string | Yes | - | Label for entries related to having posted on an existing topic. |
107
107
 
@@ -123,6 +123,16 @@ This section documents all the possible configuration values. For examples see t
123
123
  | `types.changesRequestedPR` | string | Yes | - | Label for entries related to requesting changes on a GitHub PR |
124
124
  | `types.reviewedPR` | string | Yes | - | Label for entries related to reviewing a GitHub PR (fallback) |
125
125
 
126
+ #### MediaWiki
127
+
128
+ | Field | Data Type | Required | Default | Description |
129
+ |---------------------|-----------|----------|---------|----------------------------------------------------------------------------------------------------------------------------|
130
+ | `enabled` | boolean | Yes | - | Indicates whether this data source is enabled. Alternatively you can also leave off the `mediaWiki` object entirely. |
131
+ | `baseUrl` | string | Yes | - | API base url without trailing slash |
132
+ | `username` | string | Yes | - | Username on MediaWiki |
133
+ | `editType` | string | Yes | - | Label for entries related to having edited an article. |
134
+ | `stopDate` | string | Yes | - | `new Date()` parseable string containing a date of possibly earliest contribution to track |
135
+
126
136
  ### Sample configuration
127
137
 
128
138
  ```js
@@ -142,7 +152,7 @@ const config = {
142
152
  topicType: 'Created Discourse Topic',
143
153
  postType: 'Posted on Discourse Topic',
144
154
  },
145
- wiki: {
155
+ mediaWiki: {
146
156
  enabled: true,
147
157
  baseUrl: 'https://wiki.mozilla.org/api.php?action=feedcontributions',
148
158
  username: 'michaelkohler',
package/lib/fetch.js CHANGED
@@ -11,7 +11,7 @@ async function fetchAll(config) {
11
11
  validateConfig(config);
12
12
 
13
13
  debug('fetching...');
14
- const existingContributions = JSON.parse(await fs.readFile(config.outputFile, 'utf-8'));
14
+ const existingContributions = JSON.parse(await fs.readFile(config.outputFile));
15
15
 
16
16
  const githubResult = await github.gather(config, existingContributions);
17
17
  const wikiResult = await wiki.gather(config);
package/lib/validator.js CHANGED
@@ -21,6 +21,6 @@ function validateConfig(config) {
21
21
 
22
22
  validateCommunityPortal(config.communityPortal);
23
23
  validateDiscourse(config.discourse);
24
- validateWiki(config.wiki);
24
+ validateWiki(config.mediaWiki);
25
25
  validateGithub(config.github);
26
26
  }
package/lib/wiki.js CHANGED
@@ -21,24 +21,24 @@ function validate(config) {
21
21
  }
22
22
 
23
23
  if (config && config.enabled && !config.baseUrl) {
24
- throw new Error('Wiki: baseUrl is required');
24
+ throw new Error('MediaWiki: baseUrl is required');
25
25
  }
26
26
 
27
27
  if (config && config.enabled && !config.username) {
28
- throw new Error('Wiki: username is required');
28
+ throw new Error('MediaWiki: username is required');
29
29
  }
30
30
 
31
31
  if (config && config.enabled && !config.editType) {
32
- throw new Error('Wiki: editType is required');
32
+ throw new Error('MediaWiki: editType is required');
33
33
  }
34
34
 
35
35
  if (config && config.enabled && !config.stopDate) {
36
- throw new Error('Wiki: stopDate is required');
36
+ throw new Error('MediaWiki: stopDate is required');
37
37
  }
38
38
  }
39
39
 
40
- async function gather({ wiki }) {
41
- const edits = await processEdits(wiki);
40
+ async function gather({ mediaWiki }) {
41
+ const edits = await processEdits(mediaWiki);
42
42
 
43
43
  debug('Finished gathering contributions');
44
44
  return edits;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "volunteer-contributions-fetch",
3
- "version": "1.0.1",
3
+ "version": "2.0.0",
4
4
  "description": "Library to fetch volunteer contributions from several sources such as GitHub",
5
5
  "author": "Michael Kohler",
6
6
  "license": "MIT",