-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathremove-from-nx-json.py
33 lines (28 loc) · 1.13 KB
/
remove-from-nx-json.py
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
33
import json
try:
with open('nx.json', 'r') as f:
nx_json = json.load(f)
# Remove any webpack-related configurations
if 'plugins' in nx_json:
nx_json['plugins'] = [p for p in nx_json['plugins'] if 'webpack' not in p]
if 'tasksRunnerOptions' in nx_json:
if 'default' in nx_json['tasksRunnerOptions']:
if 'options' in nx_json['tasksRunnerOptions']['default']:
if (
'runtimeCacheInputs'
in nx_json['tasksRunnerOptions']['default']['options']
):
nx_json['tasksRunnerOptions']['default']['options'][
'runtimeCacheInputs'
] = [
i
for i in nx_json['tasksRunnerOptions']['default']['options'][
'runtimeCacheInputs'
]
if 'webpack' not in i
]
with open('nx.json', 'w') as f:
json.dump(nx_json, f, indent=2)
print("nx.json updated successfully.")
except FileNotFoundError:
print("nx.json not found. Skipping.")