Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
for (const starterDir of starterDirs) {
const [ , starterType ] = getStarterInfoFromPath(starterDir);
const id = buildStarterId(ionicType, starterType, starterDir);
const contents = (await readdirp(starterDir)).map(p => p.substring(starterDir.length + 1));
for (const file of contents) {
const filePath = path.resolve(starterDir, file);
const baseFilePath = path.resolve(baseDir, file);
try {
const [ fileStat, baseFileStat ] = await Promise.all([stat(filePath), stat(baseFilePath)]);
if (!fileStat.isDirectory() && !baseFileStat.isDirectory()) {
const [ fileChecksum, baseFileChecksum ] = await Promise.all([getFileChecksum(filePath), getFileChecksum(baseFilePath)]);
if (fileChecksum === baseFileChecksum) {
log(id, chalk.red(`${chalk.bold(file)}: same file in base files`));
redundantFiles.push(filePath);
} else {
log(id, chalk.gray(`${chalk.bold(file)}: found in base files, but checksum differs`));
}
}
} catch (e) {
// ignore
}
}
}
}
if (redundantFiles.length > 0) {