mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-16 12:53:32 +00:00
refactor: simplify setup of asset paths
This commit is contained in:
committed by
Carlos Valente
parent
e46948772e
commit
5950551da2
@@ -1,20 +1,16 @@
|
||||
import { copyFile } from 'fs/promises';
|
||||
import { pathToStartDemo, resolveDemoDirectory, resolveDemoPath } from './index.js';
|
||||
import { ensureDirectory } from '../utils/fileManagement.js';
|
||||
import { copyDirectory, ensureDirectory } from '../utils/fileManagement.js';
|
||||
|
||||
import { publicDir, srcDir } from './index.js';
|
||||
|
||||
/**
|
||||
* @description ensures directories exist and populates demo folder
|
||||
*/
|
||||
export const populateDemo = () => {
|
||||
ensureDirectory(resolveDemoDirectory);
|
||||
ensureDirectory(publicDir.demoDir);
|
||||
|
||||
// even if demo exist we want to use startup demo
|
||||
try {
|
||||
Promise.all(
|
||||
resolveDemoPath.map((to, index) => {
|
||||
const from = pathToStartDemo[index];
|
||||
return copyFile(from, to);
|
||||
}),
|
||||
);
|
||||
copyDirectory(srcDir.demoDir, publicDir.demoDir);
|
||||
} catch (_) {
|
||||
/* we do not handle this */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user