@repository-settings/app 3.1.1 → 4.0.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.
- package/index.js +3 -2
- package/lib/mergeArrayByName.js +2 -4
- package/lib/plugins/branches.js +1 -1
- package/lib/plugins/collaborators.js +2 -2
- package/lib/plugins/diffable.js +1 -1
- package/lib/plugins/environments.js +2 -2
- package/lib/plugins/labels.js +2 -2
- package/lib/plugins/milestones.js +2 -2
- package/lib/plugins/repository.js +1 -1
- package/lib/plugins/teams.js +2 -2
- package/lib/settings.js +16 -10
- package/package.json +7 -5
package/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import mergeArrayByName from './lib/mergeArrayByName.js'
|
|
2
|
+
import SettingsApp from './lib/settings.js'
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* @param {import('probot').Probot} robot
|
|
5
6
|
*/
|
|
6
|
-
|
|
7
|
+
export default (robot, _, Settings = SettingsApp) => {
|
|
7
8
|
async function syncSettings (context, repo = context.repo()) {
|
|
8
9
|
const config = await context.config('settings.yml', {}, { arrayMerge: mergeArrayByName })
|
|
9
10
|
return Settings.sync(context.octokit, repo, config)
|
package/lib/mergeArrayByName.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// https://github.com/KyleAMathews/deepmerge#arraymerge
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import merge from 'deepmerge'
|
|
4
4
|
|
|
5
5
|
function findMatchingIndex (sourceItem, target) {
|
|
6
6
|
if (Object.prototype.hasOwnProperty.call(sourceItem, 'name')) {
|
|
@@ -10,7 +10,7 @@ function findMatchingIndex (sourceItem, target) {
|
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
function mergeByName (target, source, options) {
|
|
13
|
+
export default function mergeByName (target, source, options) {
|
|
14
14
|
const destination = target.slice()
|
|
15
15
|
|
|
16
16
|
source.forEach(sourceItem => {
|
|
@@ -24,5 +24,3 @@ function mergeByName (target, source, options) {
|
|
|
24
24
|
|
|
25
25
|
return destination
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
module.exports = mergeByName
|
package/lib/plugins/branches.js
CHANGED
|
@@ -3,7 +3,7 @@ const previewHeaders = {
|
|
|
3
3
|
'application/vnd.github.hellcat-preview+json,application/vnd.github.luke-cage-preview+json,application/vnd.github.zzzax-preview+json'
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
export default class Branches {
|
|
7
7
|
constructor (github, repo, settings) {
|
|
8
8
|
this.github = github
|
|
9
9
|
this.repo = repo
|
package/lib/plugins/diffable.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import Diffable from './diffable.js'
|
|
2
2
|
|
|
3
3
|
const environmentRepoEndpoint = '/repos/:org/:repo/environments/:environment_name'
|
|
4
4
|
|
|
@@ -60,7 +60,7 @@ function deploymentBranchPolicyHasChanged (existing, attrs) {
|
|
|
60
60
|
)
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
export default class Environments extends Diffable {
|
|
64
64
|
constructor (...args) {
|
|
65
65
|
super(...args)
|
|
66
66
|
|
package/lib/plugins/labels.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import Diffable from './diffable.js'
|
|
2
2
|
const previewHeaders = { accept: 'application/vnd.github.symmetra-preview+json' }
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
export default class Labels extends Diffable {
|
|
5
5
|
constructor (...args) {
|
|
6
6
|
super(...args)
|
|
7
7
|
|
|
@@ -32,7 +32,7 @@ const enableVulnerabilityAlerts = ({ github, settings, enabled }) => {
|
|
|
32
32
|
return github.repos[methodName](args)
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
export default class Repository {
|
|
36
36
|
constructor (github, repo, settings) {
|
|
37
37
|
this.github = github
|
|
38
38
|
this.settings = Object.assign({ mediaType: { previews: ['baptiste'] } }, settings, repo)
|
package/lib/plugins/teams.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import Diffable from './diffable.js'
|
|
2
2
|
|
|
3
3
|
// it is necessary to use this endpoint until GitHub Enterprise supports
|
|
4
4
|
// the modern version under /orgs
|
|
5
5
|
const teamRepoEndpoint = '/teams/:team_id/repos/:owner/:repo'
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
export default class Teams extends Diffable {
|
|
8
8
|
find () {
|
|
9
9
|
return this.github.repos.listTeams(this.repo).then(res => res.data)
|
|
10
10
|
}
|
package/lib/settings.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import Repository from './plugins/repository.js'
|
|
2
|
+
import Labels from './plugins/labels.js'
|
|
3
|
+
import Collaborators from './plugins/collaborators.js'
|
|
4
|
+
import Teams from './plugins/teams.js'
|
|
5
|
+
import Milestones from './plugins/milestones.js'
|
|
6
|
+
import Branches from './plugins/branches.js'
|
|
7
|
+
import Environments from './plugins/environments.js'
|
|
8
|
+
|
|
9
|
+
export default class Settings {
|
|
2
10
|
static sync (github, repo, config) {
|
|
3
11
|
return new Settings(github, repo, config).update()
|
|
4
12
|
}
|
|
@@ -35,13 +43,11 @@ class Settings {
|
|
|
35
43
|
Settings.FILE_NAME = '.github/settings.yml'
|
|
36
44
|
|
|
37
45
|
Settings.PLUGINS = {
|
|
38
|
-
repository:
|
|
39
|
-
labels:
|
|
40
|
-
collaborators:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
repository: Repository,
|
|
47
|
+
labels: Labels,
|
|
48
|
+
collaborators: Collaborators,
|
|
49
|
+
teams: Teams,
|
|
50
|
+
milestones: Milestones,
|
|
51
|
+
branches: Branches,
|
|
52
|
+
environments: Environments
|
|
45
53
|
}
|
|
46
|
-
|
|
47
|
-
module.exports = Settings
|
package/package.json
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@repository-settings/app",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "Pull Requests for GitHub repository settings",
|
|
5
5
|
"repository": "github:repository-settings/app",
|
|
6
|
-
"
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./index.js",
|
|
8
|
+
"exports": "./index.js",
|
|
7
9
|
"scripts": {
|
|
8
10
|
"dev": "nodemon",
|
|
9
11
|
"start": "probot run ./index.js",
|
|
@@ -14,7 +16,7 @@
|
|
|
14
16
|
"lint:engines": "ls-engines",
|
|
15
17
|
"lint:peer": "npm ls >/dev/null",
|
|
16
18
|
"lint:publish": "publint --strict",
|
|
17
|
-
"test:unit": "jest 'test/unit/'",
|
|
19
|
+
"test:unit": "NODE_OPTIONS=--experimental-vm-modules NODE_NO_WARNINGS=1 jest 'test/unit/'",
|
|
18
20
|
"test:unit:watch": "npm run test:unit -- --watch",
|
|
19
21
|
"test:integration": "run-s 'test:integration:base -- --profile noWip'",
|
|
20
22
|
"test:integration:base": "NODE_OPTIONS=--enable-source-maps DEBUG=any cucumber-js test/integration",
|
|
@@ -40,11 +42,11 @@
|
|
|
40
42
|
"jest-when": "3.6.0",
|
|
41
43
|
"lockfile-lint": "4.14.0",
|
|
42
44
|
"ls-engines": "0.9.2",
|
|
43
|
-
"msw": "2.3.
|
|
45
|
+
"msw": "2.3.2",
|
|
44
46
|
"nodemon": "3.1.4",
|
|
45
47
|
"npm-run-all2": "6.2.2",
|
|
46
48
|
"prettier-standard": "16.4.1",
|
|
47
|
-
"publint": "0.2.
|
|
49
|
+
"publint": "0.2.9",
|
|
48
50
|
"smee-client": "2.0.1",
|
|
49
51
|
"standard": "17.1.0"
|
|
50
52
|
},
|