-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathfix-paths.js
More file actions
27 lines (23 loc) · 884 Bytes
/
fix-paths.js
File metadata and controls
27 lines (23 loc) · 884 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
const fs = require('fs');
function replaceFile(path, search, replace) {
if (fs.existsSync(path)) {
const data = fs.readFileSync(path, 'utf8');
fs.writeFileSync(path, data.replace(search, replace));
}
}
replaceFile('backend/src/services/push.ts',
"import { webpush, setVapidDetails } from 'webpush';",
"import webpush from 'web-push';\nconst { setVapidDetails } = webpush;"
);
['email.ts', 'in-app.ts', 'sms.ts'].forEach(file => {
replaceFile(`backend/src/services/notifications/channels/${file}`,
"import { config } from '../../config.js';",
"import { config } from '../../../config.js';"
);
});
['deliveryTracker.ts', 'preferenceService.ts', 'templateService.ts'].forEach(file => {
replaceFile(`backend/src/services/notifications/${file}`,
"import { config } from '../config.js';",
"import { config } from '../../config.js';"
);
});