0.56.18 • Published 10 months ago

@pvm/cowners v0.56.18

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
10 months ago

@pvm/cowners

A library for working with CODEOWNERS file.

Usage

const { readCodeOwners } = require('@pvm/cowners')

async function main() {
  const codeOwners = await readCodeOwners()
}

Interfaces

OwnersEntry

Structure which holds each valid line with pattern and owners in CODEWNERS file. Here is typescript definition:

interface OwnersGroup {
  attrs: Record<string, string | number | boolean | null>,
  pattern: string,
  owners: string[],
  match(path: string): boolean,
}

Where attrs are being parsed from shebang comments. Example shebang comment with all available cases:

#! int=4 str='cat\'s ball' new=false old=true greet="hello world!" vs=null
* @owners

Api

getGroups(): OwnersGroup[]

Returns all OwnersGroups which has been parsed.

affectedGroups(paths: string[]): IterableIterator<OwnersGroup>

Returns OwnersGroups which related to given paths.

getOwners(paths: string[]): string[]

Get all owners for given paths.

getMajority(paths: string[], opts: GetMajorityOpts = {}): string[]

Get majority of owners required for review merge request. For each mask majority is Math.ceil(owners_for_mask / 2).

GetMajorityOpts.initial

List if initial reviewers.

GetMajorityOpts.exclude

List of reviewers which should be excluded from result.

groupOwnersByMask(paths: string[]): Record<string, string[]>

Get all owners for given paths and group by filename patterns.

1.0.0-beta.2

10 months ago

1.0.0-beta.3

10 months ago

0.56.18

11 months ago

0.56.16-beta.2

11 months ago

1.0.0-beta.0

11 months ago

1.0.0-beta.1

11 months ago

0.56.17

1 year ago

0.56.13

2 years ago

0.56.12

2 years ago

0.56.15

1 year ago

0.56.14

1 year ago

0.56.16

1 year ago

0.56.11

2 years ago

0.56.10

2 years ago

0.56.5

2 years ago

0.56.6

2 years ago

0.56.3

2 years ago

0.56.4

2 years ago

0.56.1

2 years ago

0.56.2

2 years ago

0.56.0

2 years ago

0.56.16-beta.1

1 year ago

0.56.9

2 years ago

0.56.16-beta.0

1 year ago

0.56.7

2 years ago

0.56.8

2 years ago

0.55.24

2 years ago

0.55.25

2 years ago

0.55.22

2 years ago

0.55.23

2 years ago

0.55.26

2 years ago

0.55.27

2 years ago

0.55.21

2 years ago

0.55.20

2 years ago

0.55.13

2 years ago

0.55.14

2 years ago

0.55.17

2 years ago

0.55.18

2 years ago

0.55.15

2 years ago

0.55.19

2 years ago

0.55.12

2 years ago

0.55.11

2 years ago

0.55.10

2 years ago

0.55.9

2 years ago

0.55.8

2 years ago

0.55.7

2 years ago

0.55.6

2 years ago

0.55.5

2 years ago

0.55.4

2 years ago

0.55.3

2 years ago

0.55.2

2 years ago

0.55.1

2 years ago

0.55.0

2 years ago

0.54.8

2 years ago

0.54.7

2 years ago

0.54.6

2 years ago

0.54.5

2 years ago

0.54.4

2 years ago