summarylogtreecommitdiffstats
path: root/update.py
blob: baa936d68f406cce1745da686b95968b24f71dfa (plain)
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
34
35
36
37
#!/usr/bin/env python3

# This script can update the content of ./patch.json to the latest version
# Usage: ./update.py /path/to/extracted/produce.json
# Where /path/to/extracted/produce.json is extracted from the latest version of official vscode release

import sys
import json

key_list = [
    "extensionsGallery",
    "extensionRecommendations",
    "keymapExtensionTips",
    "languageExtensionTips",
    "configBasedExtensionTips",
    "webExtensionTips",
    "virtualWorkspaceExtensionTips",
    "remoteExtensionTips",
    "extensionAllowedBadgeProviders",
    "extensionAllowedBadgeProvidersRegex",
    "msftInternalDomains",
    "linkProtectionTrustedDomains"
]

product_path = sys.argv[1]
patch_path = "patch.json"

with open(product_path, "r") as product_file:
    product_data = json.load(product_file)

patch_data = {}

for key in key_list:
    patch_data[key] = product_data[key]

with open(patch_path, "w") as patch_file:
    json.dump(patch_data, patch_file, indent='\t')