Copy only handler files, exclude utilities
cgen-167a3de9d2f34d8ea8b56c9250422d37
This commit is contained in:
parent
09885388fc
commit
abb4bbe81e
1 changed files with 14 additions and 6 deletions
20
build-api.js
20
build-api.js
|
|
@ -10,7 +10,15 @@ console.log("Preparing API files for Vercel...");
|
||||||
const srcApi = path.resolve(__dirname, "api");
|
const srcApi = path.resolve(__dirname, "api");
|
||||||
const destApi = path.resolve(__dirname, "..", "api");
|
const destApi = path.resolve(__dirname, "..", "api");
|
||||||
|
|
||||||
// Copy entire API directory
|
// Files to exclude from API directory (utilities that shouldn't be handlers)
|
||||||
|
const excludeFiles = new Set([
|
||||||
|
"_supabase.ts",
|
||||||
|
"_cors.ts",
|
||||||
|
"_notifications.ts",
|
||||||
|
"opportunities.ts",
|
||||||
|
"applications.ts",
|
||||||
|
]);
|
||||||
|
|
||||||
function copyDir(src, dest) {
|
function copyDir(src, dest) {
|
||||||
if (fs.existsSync(dest)) {
|
if (fs.existsSync(dest)) {
|
||||||
fs.rmSync(dest, { recursive: true, force: true });
|
fs.rmSync(dest, { recursive: true, force: true });
|
||||||
|
|
@ -24,15 +32,15 @@ function copyDir(src, dest) {
|
||||||
|
|
||||||
if (entry.isDirectory()) {
|
if (entry.isDirectory()) {
|
||||||
copyDir(srcPath, destPath);
|
copyDir(srcPath, destPath);
|
||||||
} else if (!entry.name.startsWith(".")) {
|
} else if (!entry.name.startsWith(".") && !excludeFiles.has(entry.name)) {
|
||||||
fs.copyFileSync(srcPath, destPath);
|
fs.copyFileSync(srcPath, destPath);
|
||||||
|
console.log(` Copied: ${entry.name}`);
|
||||||
|
} else if (excludeFiles.has(entry.name)) {
|
||||||
|
console.log(` Skipped (utility): ${entry.name}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`Copying API files from ${srcApi}...`);
|
console.log(`Copying API files from ${srcApi}...`);
|
||||||
copyDir(srcApi, destApi);
|
copyDir(srcApi, destApi);
|
||||||
console.log(`✓ Copied to ${destApi}`);
|
console.log(`✓ API files prepared for Vercel`);
|
||||||
|
|
||||||
// Vercel will auto-compile TypeScript files
|
|
||||||
console.log("Vercel will compile TypeScript files automatically.");
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue