Files
ontime/apps/server/src/setup/loadStyles.ts
T
Carlos Valente 5b01329c37 refactor: migrate project upload (#796)
* refactor: migrate project upload
2024-03-01 22:59:00 +01:00

19 lines
593 B
TypeScript

import { copyFileSync, existsSync } from 'fs';
import { pathToStartStyles, resolveStylesDirectory, resolveStylesPath } from './index.js';
import { ensureDirectory } from '../utils/fileManagement.js';
/**
* @description ensures directories exist and populates stylesheet
*/
export const populateStyles = () => {
ensureDirectory(resolveStylesDirectory);
// if styles doesn't exist we want to use startup stylesheet
if (!existsSync(resolveStylesPath)) {
try {
copyFileSync(pathToStartStyles, resolveStylesPath);
} catch (_) {
/* we do not handle this */
}
}
};