Skip to content

Commit

Permalink
ci: clear build cache directory before writing new cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel910 committed May 22, 2023
1 parent c59b9cc commit 5c435f4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions scripts/buildPackages/src/buildSinglePackage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ export const buildPackageInNewProcess = async (pkg: Package, buildOverrides = "{
const cacheFolderPath = path.join(CACHE_FOLDER_PATH, pkg.packageJson.name);

const buildFolder = getBuildOutputFolder(pkg);
fs.copySync(buildFolder, cacheFolderPath);
// Delete previous cache!
await fs.emptyDir(cacheFolderPath);
await fs.copy(buildFolder, cacheFolderPath);
};

export const buildPackageInSameProcess = async (pkg: Package, buildOverrides = "{}") => {
Expand All @@ -32,5 +34,8 @@ export const buildPackageInSameProcess = async (pkg: Package, buildOverrides = "
const cacheFolderPath = path.join(CACHE_FOLDER_PATH, pkg.packageJson.name);

const buildFolder = getBuildOutputFolder(pkg);
fs.copySync(buildFolder, cacheFolderPath);

// Delete previous cache!
await fs.emptyDir(cacheFolderPath);
await fs.copy(buildFolder, cacheFolderPath);
};

0 comments on commit 5c435f4

Please sign in to comment.