Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private async getFilesAndSizesAndHashesForGlobPattern(buildDir: string): Promise {
const contents = await readdirp(buildDir, { filter: item => !/(css|js)\.map$/.test(item.path) });
const stats = await map(contents, async (f): Promise<[string, fs.Stats]> => [f, await stat(f)]);
const files = stats.filter(([ , s ]) => !s.isDirectory());
const items = await Promise.all(files.map(([f, s]) => this.getFileAndSizeAndHashForFile(buildDir, f, s)));
return items.filter(item => item.href !== 'pro-manifest.json');
}
export async function findAllSDKPackages(sdk: SDK): Promise {
const debug = Debug(`${modulePrefix}:${findAllSDKPackages.name}`);
if (sdk.packages) {
return sdk.packages;
}
const sourcesRe = /^sources\/android-\d+\/.+\/.+/;
debug('Walking %s to discover SDK packages', sdk.root);
const contents = await readdirp(sdk.root, {
filter: item => pathlib.basename(item.path) === 'package.xml',
onError: err => debug('Error while walking SDK: %O', err),
walkerOptions: {
pathFilter: p => {
if ([
'bin',
'bin64',
'lib',
'lib64',
'include',
'clang-include',
'skins',
'data',
'examples',
'resources',
'systrace',
async run(inputs: CommandLineInputs, options: CommandLineOptions) {
const community = options['community'] ? true : false;
const redundantFiles: string[] = [];
for (const ionicType of IONIC_TYPE_DIRECTORIES) {
const baseDir = path.resolve(REPO_DIRECTORY, ionicType, 'base');
const starterDirs = await getStarterDirectories(ionicType, { community });
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`));