Files
nodecg-venue-gfx/scripts/build.mjs
T
dvdrw 4bb64a8ca3 init: initial commit
- ticker / QR ad overlay / break slide graphics (1920×1080) with all
  geometry derived from one shared module (src/shared/obs-geometry.mjs)
- OBS scene-collection generator (scripts/generate-obs-scenes.mjs) and a
  read-only in-dashboard setup verifier, both driven by the same module
- en/sr dashboard i18n selected via bundle config; configschema.json with
  neutral first-run defaults seeded from optional branding config
- install.sh / systemd user service / update.sh for venue deployment
- reference OBS scene collection + profile from a real venue as fixtures
2026-07-15 19:30:32 +02:00

124 lines
2.8 KiB
JavaScript

/**
* Parcel build script
* See https://parceljs.org/features/parcel-api/ for more info
*/
// Native
import { fileURLToPath } from 'url';
import { argv } from 'process';
// Packages
import { glob } from 'glob';
import { Parcel } from '@parcel/core';
// Ours
import pjson from '../package.json' with { type: 'json' };
const buildAll = argv.includes('--all');
const buildExtension = argv.includes('--extension') || buildAll;
const buildDashboard = argv.includes('--dashboard') || buildAll;
const buildGraphics = argv.includes('--graphics') || buildAll;
const bundlers = new Set();
const commonBrowserTargetProps = {
engines: {
browsers: ['last 5 Chrome versions'],
},
context: 'browser',
};
if (buildDashboard) {
bundlers.add(
new Parcel({
entries: glob.sync('src/dashboard/**/*.html'),
targets: {
default: {
...commonBrowserTargetProps,
distDir: 'dashboard',
publicUrl: `/bundles/${pjson.name}/dashboard`,
},
},
defaultConfig: '@parcel/config-default',
additionalReporters: [
{
packageName: '@parcel/reporter-cli',
resolveFrom: fileURLToPath(import.meta.url),
},
],
}),
);
}
if (buildGraphics) {
bundlers.add(
new Parcel({
entries: glob.sync('src/graphics/**/*.html'),
targets: {
default: {
...commonBrowserTargetProps,
distDir: 'graphics',
publicUrl: `/bundles/${pjson.name}/graphics`,
},
},
defaultConfig: '@parcel/config-default',
additionalReporters: [
{
packageName: '@parcel/reporter-cli',
resolveFrom: fileURLToPath(import.meta.url),
},
],
}),
);
}
if (buildExtension) {
bundlers.add(
new Parcel({
entries: 'src/extension/index.ts',
targets: {
default: {
context: 'node',
distDir: 'extension',
},
},
defaultConfig: '@parcel/config-default',
additionalReporters: [
{
packageName: '@parcel/reporter-cli',
resolveFrom: fileURLToPath(import.meta.url),
},
],
}),
);
}
try {
if (argv.includes('--watch')) {
const watchPromises = [];
for (const bundler of bundlers.values()) {
watchPromises.push(
bundler.watch((err) => {
if (err) {
// fatal error
throw err;
}
}),
);
}
await Promise.all(watchPromises);
} else {
const buildPromises = [];
for (const bundler of bundlers.values()) {
buildPromises.push(bundler.run());
}
await Promise.all(buildPromises);
}
console.log('Bundle build completed successfully');
} catch (_) {
// the reporter-cli package will handle printing errors to the user
process.exit(1);
}