rate/scripts/tools.py

33 lines
611 B
Python
Raw Normal View History

2022-10-25 20:03:11 +00:00
#!/usr/bin/python
import os
import sys
import json
apps = ['core', 'api', 'www']
commands = {
'build': 'npm run build',
'install': 'npm ci',
'prettier': 'npm run prettier'
}
def print_commands():
print('Commandes disponibles: ', [c for c in commands])
if __name__ == '__main__':
if len(sys.argv) < 2:
print_commands()
exit()
cmd = sys.argv[1]
if cmd not in commands:
print('Commande \'%s\' non disponible' % cmd)
print_commands()
exit()
for app in apps:
os.chdir(app)
os.system(commands[cmd])
os.chdir('..')