1- import { isRegExp , isString } from ' lodash-es' ;
2- import AggregateError from ' aggregate-error' ;
3- import pEachSeries from ' p-each-series' ;
4- import * as DEFINITIONS from ' ../definitions/branches.js' ;
5- import getError from ' ../get-error.js' ;
6- import { fetch , fetchNotes , verifyBranchName } from ' ../git.js' ;
7- import expand from ' ./expand.js' ;
8- import getTags from ' ./get-tags.js' ;
9- import * as normalize from ' ./normalize.js' ;
1+ import { isRegExp , isString } from " lodash-es" ;
2+ import AggregateError from " aggregate-error" ;
3+ import pEachSeries from " p-each-series" ;
4+ import * as DEFINITIONS from " ../definitions/branches.js" ;
5+ import getError from " ../get-error.js" ;
6+ import { fetch , fetchNotes , verifyBranchName } from " ../git.js" ;
7+ import expand from " ./expand.js" ;
8+ import getTags from " ./get-tags.js" ;
9+ import * as normalize from " ./normalize.js" ;
1010
1111export default async ( repositoryUrl , ciBranch , context ) => {
12- const { cwd, env} = context ;
12+ const { cwd, env } = context ;
1313
1414 const remoteBranches = await expand (
1515 repositoryUrl ,
1616 context ,
17- context . options . branches . map ( ( branch ) => ( isString ( branch ) || isRegExp ( branch ) ? { name : branch } : branch ) )
17+ context . options . branches . map ( ( branch ) => ( isString ( branch ) || isRegExp ( branch ) ? { name : branch } : branch ) )
1818 ) ;
1919
20- await pEachSeries ( remoteBranches , async ( { name} ) => {
21- await fetch ( repositoryUrl , name , ciBranch , { cwd, env} ) ;
20+ await pEachSeries ( remoteBranches , async ( { name } ) => {
21+ await fetch ( repositoryUrl , name , ciBranch , { cwd, env } ) ;
2222 } ) ;
2323
24- await fetchNotes ( repositoryUrl , { cwd, env} ) ;
24+ await fetchNotes ( repositoryUrl , { cwd, env } ) ;
2525
2626 const branches = await getTags ( context , remoteBranches ) ;
2727
2828 const errors = [ ] ;
2929 const branchesByType = Object . entries ( DEFINITIONS ) . reduce (
3030 // eslint-disable-next-line unicorn/no-fn-reference-in-iterator
31- ( branchesByType , [ type , { filter} ] ) => ( { [ type ] : branches . filter ( filter ) , ...branchesByType } ) ,
31+ ( branchesByType , [ type , { filter } ] ) => ( { [ type ] : branches . filter ( filter ) , ...branchesByType } ) ,
3232 { }
3333 ) ;
3434
35- const result = Object . entries ( DEFINITIONS ) . reduce ( ( result , [ type , { branchesValidator, branchValidator} ] ) => {
35+ const result = Object . entries ( DEFINITIONS ) . reduce ( ( result , [ type , { branchesValidator, branchValidator } ] ) => {
3636 branchesByType [ type ] . forEach ( ( branch ) => {
3737 if ( branchValidator && ! branchValidator ( branch ) ) {
38- errors . push ( getError ( `E${ type . toUpperCase ( ) } BRANCH` , { branch} ) ) ;
38+ errors . push ( getError ( `E${ type . toUpperCase ( ) } BRANCH` , { branch } ) ) ;
3939 }
4040 } ) ;
4141
4242 const branchesOfType = normalize [ type ] ( branchesByType ) ;
4343
4444 if ( ! branchesValidator ( branchesOfType ) ) {
45- errors . push ( getError ( `E${ type . toUpperCase ( ) } BRANCHES` , { branches : branchesOfType } ) ) ;
45+ errors . push ( getError ( `E${ type . toUpperCase ( ) } BRANCHES` , { branches : branchesOfType } ) ) ;
4646 }
4747
48- return { ...result , [ type ] : branchesOfType } ;
48+ return { ...result , [ type ] : branchesOfType } ;
4949 } , { } ) ;
5050
5151 const duplicates = [ ...branches ]
@@ -54,12 +54,12 @@ export default async (repositoryUrl, ciBranch, context) => {
5454 . filter ( ( _ , idx , array ) => array [ idx ] === array [ idx + 1 ] && array [ idx ] !== array [ idx - 1 ] ) ;
5555
5656 if ( duplicates . length > 0 ) {
57- errors . push ( getError ( ' EDUPLICATEBRANCHES' , { duplicates} ) ) ;
57+ errors . push ( getError ( " EDUPLICATEBRANCHES" , { duplicates } ) ) ;
5858 }
5959
6060 await pEachSeries ( branches , async ( branch ) => {
6161 if ( ! ( await verifyBranchName ( branch . name ) ) ) {
62- errors . push ( getError ( ' EINVALIDBRANCHNAME' , branch ) ) ;
62+ errors . push ( getError ( " EINVALIDBRANCHNAME" , branch ) ) ;
6363 }
6464 } ) ;
6565
@@ -68,4 +68,4 @@ export default async (repositoryUrl, ciBranch, context) => {
6868 }
6969
7070 return [ ...result . maintenance , ...result . release , ...result . prerelease ] ;
71- }
71+ } ;
0 commit comments