minor refactor

This commit is contained in:
Joseph Garrone 2024-02-11 19:25:52 +01:00
parent 839ba6a964
commit 6d4a948dd8

View File

@ -30,7 +30,8 @@ export async function downloadAndUnzip(params: {
}) {
const { url, destDirPath, specificDirsToExtract, preCacheTransform, buildOptions } = params;
const zipFileBasename = generateFileNameFromURL({
const { extractDirPath, zipFilePath } = (() => {
const zipFileBasenameWithoutExt = generateFileNameFromURL({
url,
"preCacheTransform":
preCacheTransform === undefined
@ -41,8 +42,11 @@ export async function downloadAndUnzip(params: {
}
});
const zipFilePath = pathJoin(buildOptions.cacheDirPath, `${zipFileBasename}.zip`);
const extractDirPath = pathJoin(buildOptions.cacheDirPath, `tmp_unzip_${zipFileBasename}`);
const zipFilePath = pathJoin(buildOptions.cacheDirPath, `${zipFileBasenameWithoutExt}.zip`);
const extractDirPath = pathJoin(buildOptions.cacheDirPath, `tmp_unzip_${zipFileBasenameWithoutExt}`);
return { zipFilePath, extractDirPath };
})();
download_zip_and_transform: {
if (await existsAsync(zipFilePath)) {