Skip to content

Commit cafaee1

Browse files
committed
Fix rmdir options: use force instead of recursive
The @shopify/cli-kit rmdir function uses the 'del' library which handles recursion automatically. The RmDirOptions interface only supports 'force', not 'recursive'.
1 parent 8b744d1 commit cafaee1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/app/src/cli/services/build/extension.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ describe('buildFunctionExtension', () => {
314314

315315
// Then
316316
expect(lockfile.check).toHaveBeenCalled()
317-
expect(rmdir).toHaveBeenCalledWith(expect.stringContaining('.build-lock'), {recursive: true})
317+
expect(rmdir).toHaveBeenCalledWith(expect.stringContaining('.build-lock'), {force: true})
318318
expect(lockfile.lock).toHaveBeenCalled()
319319
expect(releaseLock).toHaveBeenCalled()
320320
})
@@ -362,7 +362,7 @@ describe('buildFunctionExtension', () => {
362362

363363
// Then
364364
expect(lockfile.check).toHaveBeenCalled()
365-
expect(rmdir).toHaveBeenCalledWith(expect.stringContaining('.build-lock'), {recursive: true})
365+
expect(rmdir).toHaveBeenCalledWith(expect.stringContaining('.build-lock'), {force: true})
366366
expect(lockfile.lock).toHaveBeenCalled()
367367
expect(releaseLock).toHaveBeenCalled()
368368
})

packages/app/src/cli/services/build/extension.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,13 @@ async function cleanupStaleLock(lockfilePath: string): Promise<void> {
178178
if (!isLocked) {
179179
// Lock exists but is stale - remove it
180180
outputDebug(`Removing stale build lock: ${lockfilePath}`)
181-
await rmdir(lockfilePath, {recursive: true})
181+
await rmdir(lockfilePath, {force: true})
182182
}
183183
} catch (error) {
184184
// If check fails, try to remove the lock anyway - it's likely corrupted
185185
outputDebug(`Failed to check lock status, attempting cleanup: ${lockfilePath}`)
186186
try {
187-
await rmdir(lockfilePath, {recursive: true})
187+
await rmdir(lockfilePath, {force: true})
188188
} catch {
189189
// Ignore cleanup errors - the lock acquisition will fail with a clear message if needed
190190
}

0 commit comments

Comments
 (0)