diff --git a/config/npm-organizations.yml b/config/npm-organizations.yml index 0c268aa..964edae 100644 --- a/config/npm-organizations.yml +++ b/config/npm-organizations.yml @@ -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 diff --git a/lib/util/find.js b/lib/util/find.js index e8e8de1..60c4e20 100644 --- a/lib/util/find.js +++ b/lib/util/find.js @@ -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 }