From f5ddb991053fdeebb30a45712f01dd0e581ef330 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Tue, 7 Apr 2020 10:06:00 +0200 Subject: [PATCH] packages/cli: remove output dir before building with cache --- packages/cli/src/commands/build-cache/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/cli/src/commands/build-cache/index.ts b/packages/cli/src/commands/build-cache/index.ts index fafc945907..a8a1a27e9d 100644 --- a/packages/cli/src/commands/build-cache/index.ts +++ b/packages/cli/src/commands/build-cache/index.ts @@ -14,6 +14,7 @@ * limitations under the License. */ +import fs from 'fs-extra'; import { Command } from 'commander'; import { run } from 'helpers/run'; import { Cache } from './cache'; @@ -31,6 +32,7 @@ export async function withCache( const key = await Cache.readInputKey(options.inputs); if (!key) { print('input directory is dirty, skipping cache'); + await fs.remove(options.output); await buildFunc(); return; } @@ -49,6 +51,7 @@ export async function withCache( } print('cache miss, need to build'); + await fs.remove(options.output); await buildFunc(); await cacheResult.archive(options.output, options.maxCacheEntries);