import { glob } from 'glob'; import { BuildState } from './state'; import { promises as fs } from 'fs'; import { map_input_file_to_output_file } from './helpers'; export async function copy_raw_files(state: BuildState) { const promises: Promise[] = [ ]; const files = await glob(state.conf.input.raw, { absolute: true, cwd: state.conf.input.root, }); for (const in_file of files) { if (state.seen_files.has(in_file)) { continue; } state.seen_files.add(in_file); const out_file = map_input_file_to_output_file(state, in_file); // todo: check hashes to see if we can skip promises.push( fs.copyFile(in_file, await out_file) ); } await Promise.all(promises); // todo: update metadata }