diff --git a/src/cli.ts b/src/cli.ts index 8432a35b..4427899f 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -13,6 +13,7 @@ * this program. If not, see . */ import chalk from 'chalk'; +import {execSync} from 'child_process'; import * as commander from 'commander'; import {copyFileSync, existsSync, readFileSync, writeFileSync} from 'fs'; import {resolve, sep} from 'path'; @@ -168,6 +169,27 @@ Object.keys(SCRIPTS).forEach((scriptName) => { } }); +const execBuffer = execSync('git log --format=\'%aN\' | sort -u'); +for (let author of execBuffer.toString().split('\n')) { + author = author.trim(); + + if (author === '') { + continue; + } + + let authorIsAttributed = false; + + authorIsAttributed = authorIsAttributed + || (typeof packageJson.author === 'string' && packageJson.author.indexOf(author) >= 0) + || (Array.isArray(packageJson.contributors) && packageJson.contributors.find((contributor: string) => { + return contributor.indexOf(author) >= 0; + })); + + if (!authorIsAttributed) { + consoleInfo(`'${author}' should be attributed as author or contributor.`); + } +} + // check CI config if it exists const pathToCiConfig = resolve(path, '.gitlab-ci.yml'); if (existsSync(pathToCiConfig)) {