This PR refactors the build scripts into smaller, more focused components to improve maintainability, debugging, and extensibility. Each script handles a specific aspect of the build process, making it easier to isolate and fix issues.
Script Organization
The scripts are organized to mirror the workflow phases:
Setup Phase
setup.sh: Prepares the build environment
copy-images.sh: Copies images to build directory
Build Phase
build.sh: Main entry point for the build process
build-language.sh: Builds a specific language version
combine-markdown.sh: Combines markdown files into a single document
Format Generation
generate-pdf.sh: Creates PDF version
generate-epub.sh: Creates EPUB version
generate-mobi.sh: Creates MOBI (Kindle) version
generate-html.sh: Creates HTML version
New Features and Improvements
Better Error Handling: Each script includes proper error checking and reporting
Modular Design: Each script has a single responsibility
Script Documentation: Added README with usage instructions and debugging tips
Enhanced CLI Options: Support for more granular control via command-line options:
--all-languages: Build all languages
--lang=XX: Build a specific language
--skip-pdf, --skip-epub, etc.: Skip specific formats
Better Debugging: Makes it easier to debug specific parts of the build process
Migration Approach
The main build.sh in the root directory now simply forwards all arguments to the modular scripts, ensuring backward compatibility with existing workflows.
Testing
The scripts have been tested with both English and Spanish content, ensuring they produce the same output as the original monolithic script.
Refactor Build Scripts into Modular Components
This PR refactors the build scripts into smaller, more focused components to improve maintainability, debugging, and extensibility. Each script handles a specific aspect of the build process, making it easier to isolate and fix issues.
Script Organization
The scripts are organized to mirror the workflow phases:
Setup Phase
setup.sh
: Prepares the build environmentcopy-images.sh
: Copies images to build directoryBuild Phase
build.sh
: Main entry point for the build processbuild-language.sh
: Builds a specific language versioncombine-markdown.sh
: Combines markdown files into a single documentFormat Generation
generate-pdf.sh
: Creates PDF versiongenerate-epub.sh
: Creates EPUB versiongenerate-mobi.sh
: Creates MOBI (Kindle) versiongenerate-html.sh
: Creates HTML versionNew Features and Improvements
--all-languages
: Build all languages--lang=XX
: Build a specific language--skip-pdf
,--skip-epub
, etc.: Skip specific formatsMigration Approach
The main
build.sh
in the root directory now simply forwards all arguments to the modular scripts, ensuring backward compatibility with existing workflows.Testing
The scripts have been tested with both English and Spanish content, ensuring they produce the same output as the original monolithic script.