This commit is contained in:
2025-10-03 20:59:17 +02:00
parent 98b041e056
commit f091733d29
5 changed files with 34 additions and 8 deletions

View File

@@ -19,23 +19,24 @@ export class FileLoader implements IPluginBuilder {
const { menuManifest } = builderContext;
const { files } = this.options;
files.forEach((file) => {
const fileName =
file.nameOverride ?? file.path.split("/").pop() ?? file.path;
const filePath = file.path.split("/").pop() ?? file.path;
const fileName = file.nameOverride ?? filePath;
const isImage = fileName.match(/\.(png|jpe?g|gif|webp)$/);
if (isImage) {
console.log("Processing image", file.path);
ffmpeg(file.path)
.output(`${builderContext.outputDirectory}/${fileName}`)
.output(`${builderContext.outputDirectory}/${filePath}`)
.size(`${this.options.imageWidth ?? 200}x?`)
.run();
} else {
console.log("Copying file", file.path);
copyFile(file.path, `${builderContext.outputDirectory}/${fileName}`);
const destination = `${builderContext.outputDirectory}/${filePath}`;
console.log("Copying file", file.path, "to", destination);
copyFile(file.path, destination);
}
if (file.menuEntry) {
menuManifest.push({
name: fileName,
link: file.path,
link: filePath,
});
}
});