From 507ee08241bf8936439f724c90880c41489fad94 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Sun, 16 Nov 2025 00:24:47 +0000 Subject: [PATCH] Copy API directory to root for Vercel deployment (ES module version) cgen-19633c3bf30e48e5aae3d9b627fd0029 --- copy-api.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/copy-api.js b/copy-api.js index c8ac0f4d..8812de93 100644 --- a/copy-api.js +++ b/copy-api.js @@ -1,6 +1,9 @@ #!/usr/bin/env node -const fs = require("fs"); -const path = require("path"); +import fs from 'fs'; +import path from 'path'; +import { fileURLToPath } from 'url'; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); function copyDir(src, dest) { if (!fs.existsSync(src)) { @@ -30,7 +33,7 @@ function copyDir(src, dest) { console.log(`Copied ${src} to ${dest}`); } -const srcApi = path.resolve(__dirname, "api"); -const destApi = path.resolve(__dirname, "..", "api"); +const srcApi = path.resolve(__dirname, 'api'); +const destApi = path.resolve(__dirname, '..', 'api'); copyDir(srcApi, destApi);