@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 CHANGED
@@ -1,9 +1,10 @@
1
- const mergeArrayByName = require('./lib/mergeArrayByName')
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
- module.exports = (robot, _, Settings = require('./lib/settings')) => {
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)
@@ -1,6 +1,6 @@
1
1
  // https://github.com/KyleAMathews/deepmerge#arraymerge
2
2
 
3
- const merge = require('deepmerge')
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
@@ -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
- module.exports = class Branches {
6
+ export default class Branches {
7
7
  constructor (github, repo, settings) {
8
8
  this.github = github
9
9
  this.repo = repo
@@ -1,6 +1,6 @@
1
- const Diffable = require('./diffable')
1
+ import Diffable from './diffable.js'
2
2
 
3
- module.exports = class Collaborators extends Diffable {
3
+ export default class Collaborators extends Diffable {
4
4
  constructor (...args) {
5
5
  super(...args)
6
6
 
@@ -19,7 +19,7 @@
19
19
  // remove(existing) {
20
20
  // }
21
21
  // }
22
- module.exports = class Diffable {
22
+ export default class Diffable {
23
23
  constructor (github, repo, entries) {
24
24
  this.github = github
25
25
  this.repo = repo
@@ -1,4 +1,4 @@
1
- const Diffable = require('./diffable')
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
- module.exports = class Environments extends Diffable {
63
+ export default class Environments extends Diffable {
64
64
  constructor (...args) {
65
65
  super(...args)
66
66
 
@@ -1,7 +1,7 @@
1
- const Diffable = require('./diffable')
1
+ import Diffable from './diffable.js'
2
2
  const previewHeaders = { accept: 'application/vnd.github.symmetra-preview+json' }
3
3
 
4
- module.exports = class Labels extends Diffable {
4
+ export default class Labels extends Diffable {
5
5
  constructor (...args) {
6
6
  super(...args)
7
7
 
@@ -1,6 +1,6 @@
1
- const Diffable = require('./diffable')
1
+ import Diffable from './diffable.js'
2
2
 
3
- module.exports = class Milestones extends Diffable {
3
+ export default class Milestones extends Diffable {
4
4
  constructor (...args) {
5
5
  super(...args)
6
6
 
@@ -32,7 +32,7 @@ const enableVulnerabilityAlerts = ({ github, settings, enabled }) => {
32
32
  return github.repos[methodName](args)
33
33
  }
34
34
 
35
- module.exports = class Repository {
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)
@@ -1,10 +1,10 @@
1
- const Diffable = require('./diffable')
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
- module.exports = class Teams extends Diffable {
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
- class Settings {
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: require('./plugins/repository'),
39
- labels: require('./plugins/labels'),
40
- collaborators: require('./plugins/collaborators'),
41
- environments: require('./plugins/environments'),
42
- teams: require('./plugins/teams'),
43
- milestones: require('./plugins/milestones'),
44
- branches: require('./plugins/branches')
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.1.1",
3
+ "version": "4.0.1",
4
4
  "description": "Pull Requests for GitHub repository settings",
5
5
  "repository": "github:repository-settings/app",
6
- "main": "index.js",
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.1",
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.8",
49
+ "publint": "0.2.9",
48
50
  "smee-client": "2.0.1",
49
51
  "standard": "17.1.0"
50
52
  },