cberane_obsidian-material-s.../deploy.mjs
Cristoph Berane 75c6e4ea55
feat: update Material Symbols font and add automation scripts
- Updated Material Symbols to latest version with complete icon set
- Added `update-font.mjs` script for automated future font updates
- Added `deploy.mjs` script with proper error handling
- Fixed potential null pointer in font update logic
- Bumped version and restored repository URL
2026-02-26 20:55:54 +01:00

42 lines
1.4 KiB
JavaScript

#!/usr/bin/env node
import { execSync } from 'child_process';
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const deployDir = path.join(__dirname, 'deploy');
const files = ['manifest.json', 'main.js', 'styles.css'];
// 1. Ensure deploy/ exists (create or reuse)
fs.mkdirSync(deployDir, { recursive: true });
// 2. Install dependencies
console.log('Installing dependencies...');
execSync('npm install', { stdio: 'inherit', cwd: __dirname });
// 3. Update Material Symbols font
console.log('\nUpdating Material Symbols font...');
execSync('node update-font.mjs', { stdio: 'inherit', cwd: __dirname });
// 4. Run the production build
console.log('\nRunning npm run build...');
execSync('npm run build', { stdio: 'inherit', cwd: __dirname });
// 5. Copy deployment files
console.log('\nCopying files to deploy/...');
for (const file of files) {
const srcPath = path.join(__dirname, file);
const destPath = path.join(deployDir, file);
if (!fs.existsSync(srcPath)) {
console.error(`Error: Expected source file not found: ${srcPath}`);
console.error('Deployment aborted. Ensure the build has produced all required files.');
process.exit(1);
}
fs.copyFileSync(srcPath, destPath);
console.log(`Copied ${file} → deploy/${file}`);
}
console.log('\n✓ Full deployment complete. Files are in deploy/');