Skip to content

Commit

Permalink
removing promise.all
Browse files Browse the repository at this point in the history
  • Loading branch information
mayaraman19 committed Feb 1, 2024
1 parent efdf5ab commit 4be413b
Showing 1 changed file with 30 additions and 33 deletions.
63 changes: 30 additions & 33 deletions src/commands/src/helpers/dependency-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,47 +49,44 @@ export async function downloadBuildDependencies(
directory?: string
) {
const commands: string[] = [];
await Promise.all(
buildDependencies.map(async (dependencyInfo) => {
const repoDir = getRepoDir(repoName, directory);
const targetDir = dependencyInfo.targetDir ?? repoDir;
let options = {};
if (targetDir != repoDir) {
options = { cwd: repoDir };
}
// await Promise.all(
buildDependencies.map(async (dependencyInfo) => {
const repoDir = getRepoDir(repoName, directory);
const targetDir = dependencyInfo.targetDir ?? repoDir;
let options = {};
if (targetDir != repoDir) {
options = { cwd: repoDir };
}
try {
await executeCliCommand({
command: 'mkdir',
args: ['-p', targetDir],
options: options,
});
} catch (error) {
console.error(`ERROR! Could not create target directory ${targetDir}. Dependency information: `, dependencyInfo);
throw error;
}
commands.push(`mkdir -p ${targetDir}`);
// await Promise.all(
dependencyInfo.dependencies.map(async (dep) => {
commands.push(`curl -SfL ${dep.url} -o ${targetDir}/${dep.filename}`);
try {
await executeCliCommand({
command: 'mkdir',
args: ['-p', targetDir],
return await executeCliCommand({
command: 'curl',
args: ['--max-time', '10', '-SfL', dep.url, '-o', `${targetDir}/${dep.filename}`],
options: options,
});
} catch (error) {
console.error(
`ERROR! Could not create target directory ${targetDir}. Dependency information: `,
`ERROR! Could not curl ${dep.url} into ${targetDir}/${dep.filename}. Dependency information: `,
dependencyInfo
);
throw error;
}
commands.push(`mkdir -p ${targetDir}`);
await Promise.all(
dependencyInfo.dependencies.map(async (dep) => {
commands.push(`curl -SfL ${dep.url} -o ${targetDir}/${dep.filename}`);
try {
return await executeCliCommand({
command: 'curl',
args: ['--max-time', '10', '-SfL', dep.url, '-o', `${targetDir}/${dep.filename}`],
options: options,
});
} catch (error) {
console.error(
`ERROR! Could not curl ${dep.url} into ${targetDir}/${dep.filename}. Dependency information: `,
dependencyInfo
);
}
})
);
})
);
});
// );
});
// );
return commands;
}

Expand Down

0 comments on commit 4be413b

Please sign in to comment.