import a from"node:path";import{cpSync as c,existsSync as t,mkdirSync as m}from"node:fs";import{logger as i}from"../../tools/notifiers/logger.js";import{fromCurrentDir as d}from"../../utils/index.js";import{PACKAGE_NAME as f}from"../../../config/product-gates.js";const l=["@redocly/realm","@redocly/reef","@redocly/redoc-reef","@redocly/revel-reef"],A=r=>{if(!l.includes(f))return;const o="sqlite-db",e=d(import.meta.url,`./databases/${o}/migrations`),s=a.join(r.serverOutDir,"migrations",o);if(!t(e)){i.warn(`Migrations folder not found at ${e}`);return}t(r.serverOutDir)||m(r.serverOutDir,{recursive:!0});try{c(e,s,{recursive:!0})}catch(n){i.error("Failed to copy migrations folder: %s",n)}};export{A as copyMigrationsFolder};
