Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Has been cancelled
CI/CD Pipeline / Security Scanning (push) Has been cancelled
CI/CD Pipeline / Lint and Format (push) Has been cancelled
CI/CD Pipeline / Terraform Validation (push) Has been cancelled
CI/CD Pipeline / Kubernetes Validation (push) Has been cancelled
Validation / validate-genesis (push) Successful in 32s
Validation / validate-terraform (push) Failing after 31s
Validation / validate-kubernetes (push) Failing after 13s
Validation / validate-smart-contracts (push) Failing after 14s
Validation / validate-security (push) Has started running
Validation / validate-documentation (push) Has been cancelled
Co-authored-by: Cursor <cursoragent@cursor.com>
74 lines
2.0 KiB
JavaScript
74 lines
2.0 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Copy OMNL operator console static assets into frontend-dapp/public for Vite + portal-serve.
|
|
*/
|
|
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
const frontendRoot = path.resolve(__dirname, '..');
|
|
const srcPublic = path.resolve(frontendRoot, '../services/token-aggregation/public');
|
|
const destRoot = path.join(frontendRoot, 'public', 'omnl');
|
|
|
|
const staticFiles = [
|
|
'omnl-api-base.js',
|
|
'omnl-compliance-console.css',
|
|
'omnl-compliance-console.js',
|
|
'omnl-settlement-terminal.css',
|
|
'omnl-settlement-terminal.js',
|
|
];
|
|
|
|
const pageMap = [
|
|
{ src: 'omnl-compliance-console.html', dest: 'compliance/index.html' },
|
|
{ src: 'omnl-dashboard.html', dest: 'dashboard/index.html' },
|
|
{ src: 'omnl-settlement-terminal.html', dest: 'terminal/index.html' },
|
|
];
|
|
|
|
function rmrf(dir) {
|
|
if (!fs.existsSync(dir)) return;
|
|
for (const ent of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
const p = path.join(dir, ent.name);
|
|
if (ent.isDirectory()) rmrf(p);
|
|
else fs.unlinkSync(p);
|
|
}
|
|
fs.rmdirSync(dir);
|
|
}
|
|
|
|
function ensureDir(dir) {
|
|
fs.mkdirSync(dir, { recursive: true });
|
|
}
|
|
|
|
function copyFile(src, dest) {
|
|
ensureDir(path.dirname(dest));
|
|
fs.copyFileSync(src, dest);
|
|
}
|
|
|
|
if (!fs.existsSync(srcPublic)) {
|
|
console.warn('[sync-omnl-consoles] token-aggregation public missing — skip');
|
|
process.exit(0);
|
|
}
|
|
|
|
if (fs.existsSync(destRoot)) rmrf(destRoot);
|
|
ensureDir(path.join(destRoot, 'static'));
|
|
|
|
for (const name of staticFiles) {
|
|
const src = path.join(srcPublic, name);
|
|
if (!fs.existsSync(src)) {
|
|
console.warn(`[sync-omnl-consoles] missing ${name}`);
|
|
continue;
|
|
}
|
|
copyFile(src, path.join(destRoot, 'static', name));
|
|
}
|
|
|
|
for (const { src, dest } of pageMap) {
|
|
const from = path.join(srcPublic, src);
|
|
if (!fs.existsSync(from)) {
|
|
console.warn(`[sync-omnl-consoles] missing ${src}`);
|
|
continue;
|
|
}
|
|
copyFile(from, path.join(destRoot, dest));
|
|
}
|
|
|
|
console.log('[sync-omnl-consoles] synced operator consoles → public/omnl/');
|