feat: Add npm dependencies and update vendor paths

- Add package.json dependencies: jquery, jquery-ui, moment, daterangepicker, wavesurfer.js, air-datepicker
- Create scripts/setup-vendor.js to copy npm packages to public/assets/vendor
- Update view templates to use vendor paths instead of old /js/ or CDN URLs
- Clean up legacy commented-out scripts in master layout
This commit is contained in:
Mischa Spelt
2026-08-25 16:17:01 +02:00
parent e070c9f374
commit 7b9674110e
8454 changed files with 11623 additions and 27 deletions
+54
View File
@@ -0,0 +1,54 @@
#!/usr/bin/env node
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
// Map of npm package names to vendor folder names and their dist paths
const packages = {
'jquery': { folder: 'jquery', subdir: 'dist' },
'jquery-ui': { folder: 'jquery-ui', subdir: 'dist' },
'moment': { folder: 'moment', subdir: '.' },
'daterangepicker': { folder: 'daterangepicker', subdir: '' },
'wavesurfer.js': { folder: 'wavesurfer', subdir: 'dist' },
'air-datepicker': { folder: 'air-datepicker', subdir: 'dist' },
};
const vendorDir = path.join(__dirname, '..', 'public', 'assets', 'vendor');
// Create vendor directory if it doesn't exist
if (!fs.existsSync(vendorDir)) {
fs.mkdirSync(vendorDir, { recursive: true });
}
// Copy each package
Object.entries(packages).forEach(([npmPkg, config]) => {
const { folder, subdir } = config;
const nodeModulesPkg = path.join(__dirname, '..', 'node_modules', npmPkg);
const vendorPkg = path.join(vendorDir, folder);
if (!fs.existsSync(nodeModulesPkg)) {
console.warn(`Warning: ${npmPkg} not found in node_modules`);
return;
}
// Remove existing vendor directory for this package
if (fs.existsSync(vendorPkg)) {
fs.rmSync(vendorPkg, { recursive: true });
}
// Copy the appropriate files
const source = subdir ? path.join(nodeModulesPkg, subdir) : nodeModulesPkg;
if (!fs.existsSync(source)) {
console.warn(`Warning: Source directory ${source} not found for ${npmPkg}`);
return;
}
fs.cpSync(source, vendorPkg, { recursive: true });
console.log(`✓ Copied ${npmPkg}${folder}`);
});
console.log(`✓ Vendor setup complete`);