-
-
Save aduth/8981b2ff1eb7db1e41b9a15f4843cbe5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable no-console */ | |
const { readFileSync, statSync } = require( 'fs' ); | |
const glob = require( 'glob' ); | |
const entries = readFileSync( './CODEOWNERS', 'utf-8' ) | |
.split( '\n' ) | |
.filter( ( line ) => line && ! line.startsWith( '#' ) ) | |
.map( ( entry ) => entry.split( ' ' )[ 0 ] ) | |
.filter( ( entry ) => entry !== '*' ); | |
const packages = glob.sync( './packages/*' ) | |
.filter( ( path ) => statSync( path ).isDirectory() ) | |
.map( ( path ) => path.replace( /^\./, '' ) ); | |
let hasCoverage = true; | |
packages.forEach( ( path ) => { | |
if ( ! entries.includes( path ) ) { | |
console.log( `Missing coverage for ${ path }` ); | |
hasCoverage = false; | |
} | |
} ); | |
if ( hasCoverage ) { | |
console.log( 'All packages covered!' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment