Skip to content

Commit abfc18f

Browse files
refactor: unconditionally cleanup.
1 parent 8999fa8 commit abfc18f

1 file changed

Lines changed: 2 additions & 14 deletions

File tree

packages/playwright/scripts/link-css-dist.js

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
browser-entrypoint.html needs a URL the server can see, so we expose
66
packages/css/dist at /dist-css without copying or bundling.
77
*/
8-
import { lstat, symlink, unlink } from 'node:fs/promises'
8+
import { rm, symlink } from 'node:fs/promises'
99
import path from 'node:path'
1010
import { fileURLToPath } from 'node:url'
1111

@@ -15,18 +15,6 @@ const __dirname = path.dirname(__filename)
1515
const targetPath = path.resolve(__dirname, '../../css/dist')
1616
const linkPath = path.resolve(__dirname, '../dist-css')
1717

18-
try {
19-
const stat = await lstat(linkPath)
20-
if (stat.isSymbolicLink() || stat.isDirectory()) {
21-
await unlink(linkPath)
22-
}
23-
} catch (error) {
24-
if (error && typeof error === 'object' && 'code' in error) {
25-
const code = error.code
26-
if (code !== 'ENOENT') {
27-
throw error
28-
}
29-
}
30-
}
18+
await rm(linkPath, { recursive: true, force: true })
3119

3220
await symlink(targetPath, linkPath, 'junction')

0 commit comments

Comments
 (0)