env + perms + tools

This commit is contained in:
2022-10-25 22:03:11 +02:00
parent 3c5b60e1aa
commit 6b815a6a68
15 changed files with 216 additions and 114 deletions

View File

@ -1,12 +0,0 @@
#!/usr/bin/python
import os
import json
apps: 'list[str]' = json.load(open('apps.json'))['apps']
print(len(apps), 'apps:', apps)
for app in apps:
os.chdir(app)
os.system('npm run build')
os.chdir('..')

View File

@ -2,8 +2,8 @@
useradd node -md /home/node -s /usr/sbin/nologin
python3 scripts/install.py
python3 scripts/build.py
python3 scripts/tools.py install
python3 scripts/tools.py build
rm -r /var/www/html/*
mv www/public/* /var/www/html

View File

@ -1,12 +0,0 @@
#!/usr/bin/python
import os
import json
apps: 'list[str]' = json.load(open('apps.json'))['apps']
print(len(apps), 'apps:', apps)
for app in apps:
os.chdir(app)
os.system('npm ci')
os.chdir('..')

View File

@ -1,12 +0,0 @@
#!/usr/bin/python
import os
import json
apps: 'list[str]' = json.load(open('apps.json'))['apps']
print(len(apps), 'apps:', apps)
for app in apps:
os.chdir(app)
os.system('npm run prettier')
os.chdir('..')

32
scripts/tools.py Executable file
View File

@ -0,0 +1,32 @@
#!/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('..')