INNER CODE UNIT · JavaScript
buildFiles
mylofi/webauthn-local-client · scripts/build-all.js:172
async function buildFiles(files,fromBasePath,toDir,processFileContents,skipPatterns) {
for (let fromPath of files) {
// should we skip copying this file?
if (matchesSkipPattern(fromPath,skipPatterns)) {
continue;
}
let relativePath = fromPath.slice(fromBasePath.length);
let outputPath = path.join(toDir,relativePath);
let outputDir = path.dirname(outputPath);
if (!(fs.existsSync(outputDir))) {
if (!(await safeMkdir(outputDir))) {
throw new Error(`While copying src/* to dist/, directory (${outputDir}) could not be created.`);
}
}
let contents = await fsp.readFile(fromPath,{ encoding: "utf8", });
({ contents, outputPath, } = await processFileContents(contents,outputPath));