Skip to content

Feature: Accept file arguments in typia generate CLI #1700

@knoan

Description

@knoan

Problem

The current typia generate command requires --input and --output directories:

npx typia generate --input src/templates --output src/generated --project tsconfig.json

For projects with templates spread across multiple submodules, this creates organizational challenges:

  • Requires centralizing templates in a single directory hierarchy
  • Or running multiple generate commands with different input/output pairs

Proposed Solution

Accept .ts files as positional arguments, as alternative to --input:

npx typia generate --output src/generated --project tsconfig.json src/**/*.typia.ts

This complements (not replaces) the existing --input directory mode.

Benefits

  • Templates can live alongside app code in multiple submodules
  • Shell glob patterns (*.typia.ts) select exactly which files to transform
  • Single command handles templates from anywhere in the project

Example

src/
├── users/
│   ├── user.ts
│   └── user.typia.ts    ← template
├── orders/
│   ├── order.ts
│   └── order.typia.ts   ← template
└── generated/           ← all output goes here
    ├── user.typia.ts
    └── order.typia.ts
npx typia generate src/**/*.typia.ts --output src/generated --project tsconfig.json

CLI Interface

Usage: typia generate [options] [files...]

Arguments:
  files                 input .ts files (alternative to --input)

Options:
  --input [path]        input directory
  --output [directory]  output directory
  --project [project]   tsconfig.json file location

Related

This differs from #1251 (glob patterns for directories) - it's about accepting file arguments directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions