license-check-and-add
Version:
A tool to enable the checking, inserting and removal of licenses
18 lines (14 loc) • 648 B
text/typescript
import * as fs from 'fs-extra';
import * as path from 'path';
export function directoriesMatch (original, goal): boolean {
return fs.readdirSync(original).every((fileOrDir) => {
const fullPath = path.resolve(original, fileOrDir);
const goalPath = path.resolve(goal, fileOrDir);
if (fs.lstatSync(fullPath).isDirectory()) {
return directoriesMatch(fullPath, goalPath);
} else if (fullPath.endsWith('.ignorefile')) {
return true; // skip the ignore file we had to copy over
}
return fs.readFileSync(fullPath).toString() === fs.readFileSync(goalPath).toString();
});
}