mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-03 22:47:59 +00:00
7e3aaa8c30
* style: consistent casing on menu * refactor: bundle demo from code * feat: allow uploading custom views
32 lines
1.0 KiB
TypeScript
32 lines
1.0 KiB
TypeScript
import path from 'path';
|
|
|
|
import { defaultCss } from '../src/bundle/bundledCss';
|
|
import { defaultDemoHtml } from '../src/bundle/bundledDemoHtml';
|
|
import { defaultTranslation } from '../src/bundle/bundledTranslations';
|
|
import { ensureDirectory, writeToFile } from '../src/utils/fileManagement';
|
|
|
|
const srcDir = path.resolve(process.cwd(), 'src');
|
|
|
|
const bundles = [
|
|
{ file: path.resolve(srcDir, 'user', 'styles', 'override.css'), content: defaultCss, label: 'CSS' },
|
|
{
|
|
file: path.resolve(srcDir, 'user', 'translations', 'translations.json'),
|
|
content: defaultTranslation,
|
|
label: 'Translation',
|
|
},
|
|
{ file: path.resolve(srcDir, 'external', 'demo', 'index.html'), content: defaultDemoHtml, label: 'Demo HTML' },
|
|
];
|
|
|
|
async function bundleDefaults() {
|
|
for (const { file, content, label } of bundles) {
|
|
try {
|
|
ensureDirectory(path.dirname(file));
|
|
await writeToFile(file, content, { encoding: 'utf8' });
|
|
} catch (error) {
|
|
console.error(`Failed writing ${label} file: `, error);
|
|
}
|
|
}
|
|
}
|
|
|
|
bundleDefaults();
|