Skip to content

Commit d555625

Browse files
committed
fix: copy Next static exports with fs.promises.cp
The sync variant's native directory copy fails (EACCES) on shared-mount filesystems (virtiofs, Docker Desktop mounts), breaking the workspace build there.
1 parent f92c2f8 commit d555625

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

‎examples/next-runtime-snapshot/scripts/build-spa.mjs‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
import { chmodSync, cpSync, mkdirSync, readdirSync, rmSync } from 'node:fs'
1+
import { chmodSync, mkdirSync, readdirSync, rmSync } from 'node:fs'
2+
import { cp } from 'node:fs/promises'
23
import { join } from 'node:path'
34

45
rmSync('dist/client', { recursive: true, force: true })
56
mkdirSync('dist', { recursive: true })
6-
cpSync('src/client/out', 'dist/client', { recursive: true })
7+
// `fs.promises.cp` rather than `cpSync`: the sync variant's native directory
8+
// copy fails (EACCES) on shared-mount filesystems (e.g. virtiofs, Docker
9+
// Desktop mounts).
10+
await cp('src/client/out', 'dist/client', { recursive: true })
711

812
// A built SPA must be readable to be served. Some filesystems (e.g. Docker
913
// Desktop's shared mounts) drop the read bits when copying, which yields

‎plugins/git/scripts/build-spa.mjs‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
import { cpSync, rmSync } from 'node:fs'
1+
import { cp, rm } from 'node:fs/promises'
22

33
// The Next.js static export is the plugin's iframe SPA; it ships in the
44
// lockstep `@devframes/plugin-git--assets` package, not the node package.
5-
rmSync('assets-pkg/dist', { recursive: true, force: true })
6-
cpSync('src/client/out', 'assets-pkg/dist', { recursive: true })
5+
// `fs.promises.cp` rather than `cpSync`: the sync variant's native directory
6+
// copy fails (EACCES) on shared-mount filesystems (e.g. virtiofs, Docker
7+
// Desktop mounts).
8+
await rm('assets-pkg/dist', { recursive: true, force: true })
9+
await cp('src/client/out', 'assets-pkg/dist', { recursive: true })

0 commit comments

Comments
 (0)