#!/usr/bin/env node
/**
 * Copies required vendor dist files from node_modules → static/vendor/
 * Run with: node scripts/copy-vendor.js
 */
const fs = require('fs');
const path = require('path');

const ROOT = path.resolve(__dirname, '..');
const VENDOR = path.join(ROOT, 'static', 'vendor');

function copy(src, dest) {
  const destDir = path.dirname(dest);
  fs.mkdirSync(destDir, { recursive: true });
  fs.copyFileSync(src, dest);
  console.log(`  ✓ ${path.relative(ROOT, dest)}`);
}

function nm(pkg) {
  return path.join(ROOT, 'node_modules', pkg);
}

function out(rel) {
  return path.join(VENDOR, rel);
}

console.log('Copying vendor assets to static/vendor/ ...');

// ---------- Alpine.js ----------
// Served via CDN

// ---------- Font Awesome 6 ----------
// Served via CDN

// ---------- jQuery ----------
// Served via CDN

// ---------- Select2 ----------
// Served via CDN

// ---------- Dropzone ----------
// Served via CDN (page-specific; removed from self-hosting)

// ---------- htmx ----------
copy(nm('htmx.org/dist/htmx.min.js'), out('htmx/htmx.min.js'));

// ---------- ECharts ----------
// Served via CDN (page-specific; removed from self-hosting)

// ---------- Chart.js ----------
// Served via CDN (page-specific; removed from self-hosting)

console.log('Done.\n');
