Skip to content

Commit

Permalink
Update to support contributors
Browse files Browse the repository at this point in the history
Related to unifiedjs/rfcs#2.
Closes GH-2.
  • Loading branch information
wooorm authored Aug 28, 2019
1 parent cef3ff1 commit 78011c8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
4 changes: 2 additions & 2 deletions config/npm-organizations.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# npm org config.
packages: :org/*
member: :orgTeam/!emeritus
admin: core/!emeritus
member: :orgTeam/maintainer
admin: core/maintainer
owner: :orgTeam/lead
orgs:
- github: unifiedjs
Expand Down
26 changes: 21 additions & 5 deletions lib/util/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,37 @@ function find(ctx, expression) {
throw new Error('Could not find team `' + name + '`')
}

const {humans} = team

if (role.charAt(0) === '!') {
modify = negate
role = role.slice(1)
}

const {humans} = team

return Object.keys(humans).filter(
member =>
role === '*' ||
modify(humans[member] === role) ||
(role === 'lead' && team.lead === member)
(role === 'lead' && modify(team.lead === member)) ||
(role !== 'lead' && modify(expand(role).includes(humans[member])))
)
}

function expand(role) {
switch (role) {
case 'contributor':
return [role, 'member']
case 'merger':
return [role, 'maintainer', 'member']
case 'releaser':
return [role, 'maintainer', 'member']
case 'maintainer':
return ['merger', 'releaser', role, 'member']
case 'member':
return ['contributor', 'merger', 'releaser', 'maintainer', role]
default:
throw new Error('Unknown role `' + role + '`')
}
}

function identity(x) {
return x
}
Expand Down

0 comments on commit 78011c8

Please sign in to comment.