33import shlex
44import sys
55import os
6+ import shutil
67import subprocess
78
89install_deps = '{{cookiecutter.install_dependencies}}'
910project_shortname = '{{cookiecutter.project_shortname}}'
11+ use_async = '{{cookiecutter.use_async}}'
1012
1113
1214is_windows = sys .platform == 'win32'
@@ -33,6 +35,22 @@ def _execute_command(cmd):
3335 return status
3436
3537
38+
39+ # Remove the cookiecutter_templates directory since it only contains
40+ # files that are conditionally included.
41+ template_dir = os .path .join (os .getcwd (), 'cookiecutter_templates' )
42+ shutil .rmtree (template_dir )
43+
44+ print ("\n \n \n use_async" )
45+ print (use_async )
46+ # If it doesn't use async, we can remove the fragments and lazyloader.js
47+ if use_async != "True" :
48+ print ('use_async is set to False, your component will not be lazy loaded and fragments will not be created.' )
49+ shutil .rmtree (os .path .join (os .getcwd (), 'src' , 'lib' , 'fragments' ))
50+ os .remove (os .path .join (os .getcwd (), 'src' , 'lib' , 'LazyLoader.js' ))
51+
52+
53+
3654if install_deps != 'True' :
3755 print ('`install_dependencies` is false!!' , file = sys .stderr )
3856 print ('Please create a venv in your project root'
@@ -90,4 +108,5 @@ def _execute_command(cmd):
90108
91109print ('\n {} ready!\n ' .format (project_shortname ))
92110
111+
93112sys .exit (0 )
0 commit comments