Skip to content

Add lingo check command for CI/CD validation #1094

@maxprilutskiy

Description

@maxprilutskiy

Summary

Add a dedicated check command that exits with non-zero code when translations need updating, replacing the lingo.dev i18n --frozen functionality we're deprecating in the future (in favor of run command).

Requirements

  • Create new check command that validates translation state without making changes
  • Reuse run command's setup and plan phases
  • Exit with code 1 if plan phase generates any tasks (tasks.length > 0)
  • Exit with code 0 if no tasks needed (everything up-to-date)
  • Display summary of what needs updating before exiting

Implementation

Core Approach

The check and run commands should reuse the common logic.

Key Benefits

  1. Zero duplication: Reuses all validation logic
  2. Consistency: Same detection logic as actual translation process
  3. Maintainability: Single source of truth for what needs updating
  4. Simplicity: ~50 lines of code instead of reimplementing validation

Task Detection

The run command's plan phase already creates tasks for:

  • Source file changes (checksum mismatches)
  • Missing translations
  • New locales
  • Configuration changes

By checking tasks.length > 0, we detect all these cases automatically.

Example Usage

# CI/CD pipeline
- name: Check translations
  run: `npx lingo.dev@latest check`
  # Fails pipeline if translations need updating

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions