feat: support gitea 1.23

This commit is contained in:
Lucas Colombo
2025-01-20 04:12:47 -03:00
parent ffec5c6916
commit 44a25e5c29
61 changed files with 1942 additions and 1939 deletions

View File

@@ -1,4 +1,4 @@
import { copyFileSync, mkdirSync } from 'fs';
import { copyFileSync, mkdirSync, existsSync } from 'fs';
import { join } from 'path';
import { readFiles } from '../utils/funcs.js';
import { Logger } from '../utils/logger.js';
@@ -12,7 +12,11 @@ export async function buildFonts(srcHome, distHome) {
const fontsSrcPath = join(srcHome, imgSrc);
const fontsDestPath = join(distHome, imgDest);
mkdirSync(fontsDestPath, { recursive: true });
// if fontsSrcPath does not exist, return
if (!existsSync(fontsSrcPath)) {
logger.warn(`No fonts found in ${fontsSrcPath} (there's not even a folder there)`);
return;
}
const files = readFiles(fontsSrcPath, [
'.woff',
@@ -23,6 +27,14 @@ export async function buildFonts(srcHome, distHome) {
'.otf',
]);
// if there are no files, return
if (!files.length) {
logger.warn(`No fonts found in ${fontsSrcPath}`);
return;
}
mkdirSync(fontsDestPath, { recursive: true });
for (const file of files) {
// just copy the file
copyFileSync(join(fontsSrcPath, file), join(fontsDestPath, file));