-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatch_render_ghost.cjs
More file actions
29 lines (23 loc) · 843 Bytes
/
Copy pathpatch_render_ghost.cjs
File metadata and controls
29 lines (23 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const fs = require('fs');
function patchFile(filepath) {
let code = fs.readFileSync(filepath, 'utf-8');
// Studio.tsx has `handleGhostSync` in destructuring if we export it from StudioHandlers
if (filepath.includes('Studio.tsx')) {
code = code.replace(
/handleUpdateAndSync,/,
`handleUpdateAndSync,
handleGhostSync,`
);
}
code = code.replace(
/<WhiteboardCanvas([^>]*)onUpdateAndSync=\{handleUpdateAndSync\}/g,
`<WhiteboardCanvas$1onUpdateAndSync={handleUpdateAndSync} onGhostSync={handleGhostSync}`
);
code = code.replace(
/<SVGPathEditor([^>]*)onUpdateAndSync=\{handleUpdateAndSync\}/g,
`<SVGPathEditor$1onUpdateAndSync={handleUpdateAndSync} onGhostSync={handleGhostSync}`
);
fs.writeFileSync(filepath, code);
}
patchFile('src/views/Studio.tsx');
patchFile('src/App.tsx');