-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatch-key.js
More file actions
21 lines (18 loc) · 1.02 KB
/
Copy pathpatch-key.js
File metadata and controls
21 lines (18 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const fs = require('fs');
let file = 'c:/Users/admin/Dropbox/Apps/remotely-save/Croptop/.obsidian/plugins/proxima/src/ui/views/ProjectsView.svelte';
let content = fs.readFileSync(file, 'utf8');
// I need to properly close the key block
content = content.replace(
/\{#key settingsVersion\}\s*<ProjectTaskBoard\s*\{app\}\s*\{fileManager\}\s*projectId=\{selectedProject\.id\}\s*\{projectTasks\}\s*\/>/g,
"{#key settingsVersion}\n <ProjectTaskBoard \n {app} \n {fileManager} \n projectId={selectedProject.id} \n {projectTasks} \n />\n {/key}"
);
// Also remove any stray {/key}
content = content.replace(
/\/>\s*\{\/key\}\s*\{:else\}/g,
"/>\n {/key}\n {:else}"
);
// Wait, the regex was:
// projectTasks={projectTasks} />\n {/key}
content = content.replace(/\{projectTasks\} \/>\s*\{\/key\}\s*\{:else\}/g, "{projectTasks} />\n {/key}\n {:else}");
fs.writeFileSync(file, content);
console.log("Fixed key block");