UNPKG

nvexeca

Version:
54 lines (30 loc) 832 B
import{platform}from"node:process"; import{listSrcPaths}from"./list.js"; import{getDistBinDir}from"./output.js"; import{addToPath,getPath}from"./path.js"; import{writeBinaries}from"./write.js"; export const copyBinaries=async(execaOptions)=>{ if(platform!=="win32"){ return execaOptions } const{pathName,pathValue}=getPath(execaOptions); if(pathValue===undefined){ return execaOptions } const srcPaths=await listSrcPaths(pathValue); if(srcPaths.length===0){ return execaOptions } return applyCopy({execaOptions,pathName,pathValue,srcPaths}) }; const applyCopy=async({execaOptions,pathName,pathValue,srcPaths})=>{ const distBinDir=await getDistBinDir(srcPaths); await writeBinaries(srcPaths,distBinDir); const execaOptionsA=addToPath({ execaOptions, pathName, pathValue, distBinDir }); return execaOptionsA };