-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathstage1.py
More file actions
31 lines (27 loc) · 978 Bytes
/
stage1.py
File metadata and controls
31 lines (27 loc) · 978 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
28
29
30
31
import subprocess
import sys
import json
def generate_extension(config_file):
# Load configuration from config.json for extension metadata
with open(config_file, 'r') as f:
config = json.load(f)
# Construct the command to generate the extension
command = [
'yo',
'code',
'--extensionType=js',
f'--extensionDisplayName={config["extensionDisplayName"]}',
f'--extensionId={config["extensionId"]}',
f'--extensionDescription={config["extensionDescription"]}',
'--pkgManager=npm',
'--gitInit=False'
]
process = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
try:
process.communicate(input='y\n') # Send 'y' to accept the prompt for JavaScript type checking
except KeyboardInterrupt:
process.terminate()
sys.exit(1)
if __name__ == "__main__":
config_file = 'config.json'
generate_extension(config_file)