LearnNewsExamplesServices
Frontmatter
id7745
titleRefactor `generate-seo-files.mjs`: Implement CLI Option Parsing with Commander
stateClosed
labels
enhancementairefactoring
assigneestobiu
createdAtNov 11, 2025, 1:33 PM
updatedAtNov 11, 2025, 1:59 PM
githubUrlhttps://github.com/neomjs/neo/issues/7745
authortobiu
commentsCount0
parentIssue7446
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtNov 11, 2025, 1:59 PM

Refactor generate-seo-files.mjs: Implement CLI Option Parsing with Commander

Closed v11.1.0 enhancementairefactoring
tobiu
tobiu commented on Nov 11, 2025, 1:33 PM

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.
tobiu assigned to @tobiu on Nov 11, 2025, 1:33 PM
tobiu added the enhancement label on Nov 11, 2025, 1:33 PM
tobiu added the ai label on Nov 11, 2025, 1:33 PM
tobiu added the refactoring label on Nov 11, 2025, 1:33 PM
tobiu added parent issue #7446 on Nov 11, 2025, 1:33 PM
tobiu referenced in commit 450ea66 - "Refactor generate-seo-files.mjs: Implement CLI Option Parsing with Commander #7745" on Nov 11, 2025, 1:59 PM
tobiu closed this issue on Nov 11, 2025, 1:59 PM