feat(build): allow to copy directories recursively

This commit is contained in:
2026-08-01 14:08:11 +02:00
committed by jakob.scheid
parent 0a9ed66f48
commit ca55e5d034
+7 -3
View File
@@ -15,7 +15,7 @@ limitations under the License.
*/ */
import { checkFileReadAccess, exists, isDirectory } from './fileAccess.js'; import { checkFileReadAccess, exists, isDirectory } from './fileAccess.js';
import { copyFile, mkdir, writeFile } from 'node:fs/promises'; import { cp, mkdir, writeFile } from 'node:fs/promises';
import { dirname, join } from 'node:path'; import { dirname, join } from 'node:path';
const validateArtifact = function validateArtifact (artifact) { const validateArtifact = function validateArtifact (artifact) {
@@ -71,9 +71,13 @@ export const processArtifact = async function processArtifact (artifact, { srcBa
console.log(`Wrote to ${distPath}`); console.log(`Wrote to ${distPath}`);
} else if (artifact.type === 'copy') { } else if (artifact.type === 'copy') {
const srcPath = join(srcBase, artifact.options.source); const srcPath = join(srcBase, artifact.options.source);
await copyFile( await cp(
srcPath, srcPath,
distPath distPath,
{
recursive: true,
force: true
}
); );
console.log(`Copied ${srcPath} -> ${distPath}`); console.log(`Copied ${srcPath} -> ${distPath}`);
} }