Something went wrong. Try again.
Monorepo for Aesthetic.Computer aesthetic.computer
Something went wrong. Try again.
JavaScript
1234567891011121314151617181920212223242526272829303132333435363738394041import { watch, existsSync, unlink } from 'fs';import { exec, execSync } from 'child_process';import { join } from 'path';import { homedir } from 'os';
// Resolve the file path to handle the '~' characterconst dirPath = join(homedir(), 'aesthetic-computer/ssl-dev');const filePath = join(dirPath, '.ssl');
// Get the path to fish dynamicallyconst fishPath = 'fish';
const command = `${fishPath} ${join(homedir(), 'aesthetic-computer/ssl-dev/ssl-install.fish')} --install-only`;
watch(dirPath, (eventType, filename) => { if (eventType === 'rename' && filename === '.ssl') { // Check if the .ssl file exists if (existsSync(filePath)) { exec(command, { shell: true }, (err, stdout, stderr) => { if (err) { console.error(`Error executing command: ${err.message}`); console.error(`stderr: ${stderr}`); return; } console.log(`Command output: ${stdout}`); // Remove the .ssl file unlink(filePath, (err) => { if (err) { console.error(`Error removing file: ${err.message}`); return; } console.log(`File ${filePath} removed successfully.`); }); }); } }});
console.log(`Watching for .ssl file creation in ${dirPath}`);