Files
api/web/scripts/add-timestamp-standalone-manifest.js
T
Eli Bosley f7ad582436 refactor: streamline standalone app deployment and manifest generation
- Removed redundant modal div from `test-standalone.html`, simplifying the structure for Vue component mounting.
- Added a check in `add-timestamp-standalone-manifest.js` to ensure the existence of the standalone apps directory before manifest generation, improving error handling.
- Updated `deploy-dev.sh` to enhance the rsync command for standalone apps, ensuring proper synchronization and cleanup of old files during deployment.
2025-08-30 22:02:02 -04:00

36 lines
853 B
JavaScript

#!/usr/bin/env node
import fs from 'fs';
import path from 'path';
const distPath = '.nuxt/standalone-apps';
const manifestPath = path.join(distPath, 'standalone.manifest.json');
// Check if directory exists
if (!fs.existsSync(distPath)) {
console.warn(`Directory ${distPath} does not exist. Skipping manifest generation.`);
process.exit(0);
}
// Get all JS files in the dist directory
const files = fs.readdirSync(distPath);
const manifest = {};
files.forEach(file => {
if (file.endsWith('.js') || file.endsWith('.css')) {
const key = file.replace(/\.(js|css)$/, '.$1');
manifest[key] = {
file: file,
src: file,
};
}
});
// Add timestamp
manifest.ts = Date.now();
// Write manifest
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
console.log('Standalone apps manifest created:', manifestPath);