const fs = require('fs'); let code = fs.readFileSync('src/views/chat/chat-view.js', 'utf8'); code = code.replace( /this\.transitionToLoading\(\);/g, `console.log('triggering transitionToLoading'); this.transitionToLoading();` ); code = code.replace( /transitionToLoading\(\) \{/g, `transitionToLoading() { console.log('transitionToLoading called. canvas height:', document.getElementById('particle-logo-canvas')?.height);` ); code = code.replace( /canvas\.width = viewRect\.width \* dpr;/g, `console.log('Resizing canvas to', viewRect.width, viewRect.height); canvas.width = viewRect.width * dpr;` ); code = code.replace( /this\.cleanupParticleLogo\(true\);/g, `console.log('cleanupParticleLogo called with true'); this.cleanupParticleLogo(true);` ); fs.writeFileSync('src/views/chat/chat-view.js', code);