fix(build): handle EEXIST errors in cpSync during bundle and build on Node.js 25+

This commit is contained in:
Sri Pasumarthi
2026-03-24 12:59:09 -07:00
parent 46fd7b4864
commit fbe8bcf535
2 changed files with 19 additions and 3 deletions
+4 -1
View File
@@ -18,7 +18,7 @@
// limitations under the License.
import { execSync } from 'node:child_process';
import { writeFileSync, existsSync, cpSync } from 'node:fs';
import { writeFileSync, existsSync, cpSync, rmSync } from 'node:fs';
import { join, basename } from 'node:path';
if (!process.cwd().includes('packages')) {
@@ -48,6 +48,9 @@ if (packageName === 'core') {
const docsSource = join(process.cwd(), '..', '..', 'docs');
const docsTarget = join(process.cwd(), 'dist', 'docs');
if (existsSync(docsSource)) {
if (existsSync(docsTarget)) {
rmSync(docsTarget, { recursive: true, force: true });
}
cpSync(docsSource, docsTarget, { recursive: true, dereference: true });
console.log('Copied documentation to dist/docs');
}