(src: string, dst: string)
| 94 | } |
| 95 | |
| 96 | async function copy(src: string, dst: string): Promise<void> { |
| 97 | const realDst = realPathIfAny(dst) |
| 98 | |
| 99 | if (!realDst) { |
| 100 | WARN(`[x] Destination path ${dst} does not exist. Skipping copy.`) |
| 101 | return |
| 102 | } |
| 103 | |
| 104 | if (realDst && realDst === src) { |
| 105 | WARN( |
| 106 | `[x] Source and destination paths are the same: ${src}. Skipping copy.` |
| 107 | ) |
| 108 | return |
| 109 | } |
| 110 | |
| 111 | if (!fs.existsSync(src)) { |
| 112 | WARN(`[x] Source path ${src} does not exist. Skipping copy.`) |
| 113 | return |
| 114 | } |
| 115 | |
| 116 | const files = await packageFiles(src) |
| 117 | DEBUG(`[x] Found ${files.length} files to copy from ${src}`) |
| 118 | |
| 119 | for (const file of files) { |
| 120 | const srcFile = path.join(src, file) |
| 121 | const dstFile = path.join(realDst, file) |
| 122 | |
| 123 | DEBUG(`Copying ${srcFile} to ${dstFile}`) |
| 124 | fs.cpSync(srcFile, dstFile, { |
| 125 | recursive: true, |
| 126 | }) |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | // --- Main execution --- |
| 131 | async function main(): Promise<void> { |
no test coverage detected