The buildScripts/generate-seo-files.mjs script currently parses command-line options manually using process.argv. This approach is inconsistent with other build scripts in the project, such as buildScripts/buildAll.mjs, which leverage the commander library for CLI argument parsing.
This ticket proposes to refactor buildScripts/generate-seo-files.mjs to use the commander library for handling its command-line options.
Benefits of using commander:
- Consistency: Aligns with existing project conventions for CLI tools.
- Robustness: Provides built-in argument validation and type checking.
- Maintainability: Reduces boilerplate code for argument parsing.
- User Experience: Automatically generates help messages and handles common CLI patterns.
Implementation Details:
- Replace the manual
process.argv parsing logic within the runCli function with commander's API.
- Define all existing options (
--format, --base-url, --base-path, --output, --no-lastmod, --no-top-level) using program.option().
- Ensure that the script's functionality remains identical after the refactoring.
Acceptance Criteria:
buildScripts/generate-seo-files.mjs uses commander for CLI option parsing.
- All existing command-line options are supported and function as before.
- The script's output and behavior are unchanged when invoked with the same arguments.
The
buildScripts/generate-seo-files.mjsscript currently parses command-line options manually usingprocess.argv. This approach is inconsistent with other build scripts in the project, such asbuildScripts/buildAll.mjs, which leverage thecommanderlibrary for CLI argument parsing.This ticket proposes to refactor
buildScripts/generate-seo-files.mjsto use thecommanderlibrary for handling its command-line options.Benefits of using
commander:Implementation Details:
process.argvparsing logic within therunClifunction withcommander's API.--format,--base-url,--base-path,--output,--no-lastmod,--no-top-level) usingprogram.option().Acceptance Criteria:
buildScripts/generate-seo-files.mjsusescommanderfor CLI option parsing.