work on splitting up extras css; start handling build metadata; start building sitemaps
This commit is contained in:
32
src/build-files/raw.ts
Normal file
32
src/build-files/raw.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
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<any>[] = [ ];
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user