zhongrj
2025-11-25 b89962006164a462404b79a738bee8cbb6d7fe7e
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
import os
import shutil
import glob
from django.core.management.base import BaseCommand
from app.plugins import build_plugins
 
def cleanup():
    # Delete all node_modules and build directories within plugins' public/ folders
    root = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..", ".."))
    for d in glob.glob(os.path.join(root, "coreplugins", "**", "public", "node_modules")):
        shutil.rmtree(d)
        print("R\t" + d)
    for d in glob.glob(os.path.join(root, "coreplugins", "**", "public", "build")):
        shutil.rmtree(d)
        print("R\t" + d)
 
    print("Cleanup done!")
 
class Command(BaseCommand):
    requires_system_checks = []
    
    def add_arguments(self, parser):
        super(Command, self).add_arguments(parser)
 
    def handle(self, **options):
        cleanup()
        build_plugins()