Author: Sergei Golovan
Description: Patch adds system-wide directories for searching for
 Node.js modules to bundle into the binary package.
 Also, it creates a destination directory for one of the temporary
 files.
Last-Modified: Fri, 01 Mar 2024 14:04:03 +0300

--- a/assets/build/build.js
+++ b/assets/build/build.js
@@ -17,6 +17,7 @@
   bundle: true,
   minify: true,
   logLevel: watchMode ? 'warning' : 'info',
+  nodePaths: ['/usr/share/node_modules', '/usr/share'],
 }
 const epubOutDir = path.resolve('../formatters/epub/dist')
 const htmlOutDir = path.resolve('../formatters/html/dist')
@@ -83,7 +84,8 @@
 }
 
 // HTML: Precompile Handlebars templates
-util.runShellCmdSync(`npx handlebars ${templates.sourceDir} --output ${templates.compiledPath}`)
+util.runShellCmdSync(`mkdir -p ${templates.compiledDir}`)
+util.runShellCmdSync(`handlebars ${templates.sourceDir} --output ${templates.compiledPath}`)
 
 // HTML: esbuild options
 const htmlBuildOptions = {
