#!/usr/bin/python import os import sys apps = ['core', 'api', 'www'] commands = { 'build': 'npm run build', 'install': 'npm ci', 'prettier': 'npm run prettier' } def print_commands(): print('Available commands:', [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('Command \'%s\' not available' % cmd) print_commands() exit() print('Running \'%s\' on %d apps: %s' % (commands[cmd], len(apps), apps)) for app in apps: os.chdir(app) os.system(commands[cmd]) os.chdir('..')