import r from"node:path";import{copyFileSync as p,existsSync as s,mkdirSync as v}from"node:fs";import{readEnvVariable as l}from"../../server/utils/envs/read-env-variable.js";import{logger as u}from"../../server/tools/notifiers/logger.js";const b=e=>{const n=a();s(e.serverOutDir)||v(e.serverOutDir,{recursive:!0});const i=[];for(const o of n){const t=r.join(e.contentDir,o);if(!s(t))continue;const c=r.join(e.serverOutDir,o);p(t,c),i.push(o)}i.length>0&&u.info(`Env files included in bundle: ${i.map(()=>"%rp").join(", ")}`,...i)},a=()=>{const e=l("REDOCLY_ENV"),n=[".env"];switch(e){case"production":n.push(".env.production");break;case"preview":n.push(".env.preview");break;case"development":default:n.push(".env.development");break}return n};export{b as copyEnvFiles};
