Fix license header file enumeration

This commit is contained in:
Evan Hahn 2021-10-01 16:52:36 -05:00 committed by GitHub
parent c99066de9b
commit b239502813
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 51 additions and 13 deletions

View file

@ -14,7 +14,7 @@ import pMap from 'p-map';
const exec = promisify(childProcess.exec);
const rootPath = path.join(__dirname, '..', '..');
const rootPath = path.join(__dirname, '..', '..', '..');
const EXTENSIONS_TO_CHECK = new Set([
'.eslintignore',
@ -34,15 +34,27 @@ const EXTENSIONS_TO_CHECK = new Set([
'.md',
'.plist',
]);
const FILES_TO_IGNORE = new Set([
'ISSUE_TEMPLATE.md',
'Mp3LameEncoder.min.js',
'PULL_REQUEST_TEMPLATE.md',
'WebAudioRecorderMp3.js',
]);
const FILES_TO_IGNORE = new Set(
[
'.github/ISSUE_TEMPLATE/bug_report.md',
'.github/PULL_REQUEST_TEMPLATE.md',
'components/indexeddb-backbonejs-adapter/backbone-indexeddb.js',
'components/mp3lameencoder/lib/Mp3LameEncoder.js',
'components/qrcode/qrcode.js',
'components/recorderjs/recorder.js',
'components/recorderjs/recorderWorker.js',
'components/webaudiorecorder/lib/WebAudioRecorder.js',
'components/webaudiorecorder/lib/WebAudioRecorderMp3.js',
'js/Mp3LameEncoder.min.js',
'js/WebAudioRecorderMp3.js',
].map(
// This makes sure the files are correct on Windows.
path.normalize
)
);
// This is not technically the real extension.
function getExtension(file: string): string {
export function getExtension(file: string): string {
if (file.startsWith('.')) {
return getExtension(`x.${file}`);
}
@ -63,7 +75,8 @@ export async function forEachRelevantFile(
await pMap(
gitFiles,
async (file: string) => {
if (FILES_TO_IGNORE.has(path.basename(file))) {
const repoPath = path.relative(rootPath, file);
if (FILES_TO_IGNORE.has(repoPath)) {
return;
}