Skip to content
This repository was archived by the owner on Jul 30, 2026. It is now read-only.
This repository was archived by the owner on Jul 30, 2026. It is now read-only.

Modernize to TypeScript + ESM CLI; drop lex/yargs; republish #13

Description

@mvhenten

Revive and modernize this i18n string extractor. It was unpublished from npm (2025-06-19); republish after modernizing. Small, coherent tool (~100 lines) with a CLI, and existing tests guard the tricky lexer.

Why

  • CommonJS, untyped, and leans on the unmaintained lex lexer + yargs.
  • Core logic is simple enough to own outright with near-zero deps.

Tasks

  • Convert to src/ TypeScript (strict). Preserve behavior exactly (tests lex_test/scan_test are the guard):
    • tokenize string literals inside __('...') / __n('...') calls, incl. escaped-quote handling
    • scan files → unique, sorted token list
  • Drop lex → inline a small (~30-line) tokenizer/state-machine.
  • Drop yargsnode:util parseArgs. Consider dropping debug too.
  • Wire the bin (extract-gettext) through package.json; ensure the CLI runs under ESM.
  • Port tape tests → node:test.
  • CI (Node 20/22/24) + release workflow with npm trusted publishing (--provenance). Mirror mvhenten/phishy.
  • Republish once trusted publishing is enabled.

Notes

  • Module format: ESM-only is fine for the CLI; offer a dual lib build only if library (non-CLI) consumers matter.
  • Template/reference: mvhenten/phishy.
  • Publishing setup to be enabled by @mvhenten before release.
  • No AI attribution on commits.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions