-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreplace_paths.py
More file actions
32 lines (28 loc) · 1.2 KB
/
Copy pathreplace_paths.py
File metadata and controls
32 lines (28 loc) · 1.2 KB
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
30
31
32
import os
replacements = {
"'/chaos-data'": "'/mock-data'",
'"/chaos-data"': '"/mock-data"',
"'/jwt-inspector'": "'/jwt-decoder'",
'"/jwt-inspector"': '"/jwt-decoder"',
"'/chaos-templates'": "'/api-templates'",
'"/chaos-templates"': '"/api-templates"',
"'/background-removal'": "'/background-remover'",
'"/background-removal"': '"/background-remover"',
"devpantry.com/chaos-data": "devpantry.com/mock-data",
"devpantry.com/jwt-inspector": "devpantry.com/jwt-decoder",
"devpantry.com/chaos-templates": "devpantry.com/api-templates",
"devpantry.com/background-removal": "devpantry.com/background-remover",
}
for root, _, files in os.walk('src'):
for file in files:
if file.endswith('.tsx') or file.endswith('.ts'):
path = os.path.join(root, file)
with open(path, 'r') as f:
content = f.read()
new_content = content
for old, new in replacements.items():
new_content = new_content.replace(old, new)
if new_content != content:
with open(path, 'w') as f:
f.write(new_content)
print(f"Updated {path}")