|
@@ -467,23 +467,23 @@ class App(Base):
|
|
|
)
|
|
|
task = progress.add_task("Compiling: ", total=len(self.pages))
|
|
|
|
|
|
+ # TODO: include all work done in progress indicator, not just self.pages
|
|
|
for render, kwargs in DECORATED_ROUTES:
|
|
|
self.add_page(render, **kwargs)
|
|
|
|
|
|
# Get the env mode.
|
|
|
config = get_config()
|
|
|
|
|
|
- # Empty the .web pages directory
|
|
|
- compiler.purge_web_pages_dir()
|
|
|
-
|
|
|
# Store the compile results.
|
|
|
compile_results = []
|
|
|
|
|
|
# Compile the pages in parallel.
|
|
|
custom_components = set()
|
|
|
+ # TODO Anecdotally, processes=2 works 10% faster (cpu_count=12)
|
|
|
thread_pool = ThreadPool()
|
|
|
with progress:
|
|
|
for route, component in self.pages.items():
|
|
|
+ # TODO: this progress does not reflect actual threaded task completion
|
|
|
progress.advance(task)
|
|
|
component.add_style(self.style)
|
|
|
compile_results.append(
|
|
@@ -505,6 +505,8 @@ class App(Base):
|
|
|
# Get the results.
|
|
|
compile_results = [result.get() for result in compile_results]
|
|
|
|
|
|
+ # TODO the compile tasks below may also benefit from parallelization too
|
|
|
+
|
|
|
# Compile the custom components.
|
|
|
compile_results.append(compiler.compile_components(custom_components))
|
|
|
|
|
@@ -521,10 +523,12 @@ class App(Base):
|
|
|
)
|
|
|
compile_results.append(compiler.compile_tailwind(config.tailwind))
|
|
|
|
|
|
+ # Empty the .web pages directory
|
|
|
+ compiler.purge_web_pages_dir()
|
|
|
+
|
|
|
# Write the pages at the end to trigger the NextJS hot reload only once.
|
|
|
thread_pool = ThreadPool()
|
|
|
for output_path, code in compile_results:
|
|
|
- compiler_utils.write_page(output_path, code)
|
|
|
thread_pool.apply_async(compiler_utils.write_page, args=(output_path, code))
|
|
|
thread_pool.close()
|
|
|
thread_pool.join()
|