feat: ✨ support gitea 1.23
This commit is contained in:
@ -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));
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { join } from 'path';
|
||||
import { existsSync } from 'fs';
|
||||
import { copyFolderRecursiveSync } from '../utils/funcs.js';
|
||||
import { Logger } from '../utils/logger.js';
|
||||
|
||||
@ -11,6 +12,12 @@ export async function buildTemplates(srcHome, distHome) {
|
||||
const tmplSrcPath = join(srcHome, tmplSrc);
|
||||
const tmplDestPath = join(distHome, tmplDest);
|
||||
|
||||
// if src/templates folder doesn't exist, just return
|
||||
if (!existsSync(tmplSrcPath)) {
|
||||
logger.info(`No templates found in ${tmplSrcPath}. Skipping templates build`);
|
||||
return;
|
||||
}
|
||||
|
||||
// just copy the entire tmplSrcPath to tmplDestPath
|
||||
copyFolderRecursiveSync(tmplSrcPath, tmplDestPath);
|
||||
logger.info('Templates build has finished');
|
||||
|
Reference in New Issue
Block a user