atlantis icon indicating copy to clipboard operation
atlantis copied to clipboard

chore(docx): improve generateDocs script to run only for updated components with -t/--touched flag

Open nad182 opened this issue 6 months ago • 1 comments

Motivations

  • Make the docs generator quieter and easier to operate, while keeping behavior consistent with the target branch.
  • Improve path stability in generated JSON and avoid unnecessary work when requested.

Changes

Added

  • -t/--touched mode: only write outputs when the source is newer than the existing JSON (mtime-based skip).
  • Unknown flag guard: fail fast on invalid flags with a short usage message.

Changed

  • Parse using a relative path so JSON filePath entries remain stable and relative.
  • Resolve base directories via __dirname/fileURLToPath and build paths via path.join.
  • DRY generation flow with a small generate() helper reused for web, native, and V2 auto-detect.
  • Reduce noisy per-item logs; print a concise end-of-run summary (parsed/updated/skipped) and list updated files.

Removed

  • Autocomplete V2 special-case (now covered by the generic V2 auto-detection).
  • Content-diff write logic (default runs always write; touched mode controls skipping via mtime).

Fixed

  • Stable filePath values in generated JSON by parsing via a relative path.

Security

  • n/a

Testing

  1. From packages/site, run npm run generate.
    • Expect all JSONs to be regenerated and a concise summary printed at the end.
  2. Run npm run generate -- -t.
    • Expect only stale outputs to be written; summary should show a non-zero Skipped count if nothing changed.
  3. Run npm run generate -- -g.
    • Expect an error about unknown flags with usage instructions.

nad182 avatar Oct 15 '25 00:10 nad182

Deploying atlantis with  Cloudflare Pages  Cloudflare Pages

Latest commit: 85646ff
Status: ✅  Deploy successful!
Preview URL: https://6612e8ae.atlantis.pages.dev
Branch Preview URL: https://cleanup-improve-generatedocs.atlantis.pages.dev

View logs