Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

@parshjs/codegen

npm version license

Filesystem-driven command tree generator for @parshjs/core.

Walks a commands/ directory and emits a commandTree.gen.ts that wires the runtime command tree and full ctx typing into @parshjs/core.

This file is generated — never hand-edit it. Commit it and re-run after any structural change under commands/ (added / renamed / deleted file, edited path string). Editing the body of an existing command never needs a regeneration.

Install

npm install -D @parshjs/codegen

Usage

parsh-codegen generate                   # one-shot
parsh-codegen generate --help            # full flag reference

Convention

  • One file per command. Export command from each.
  • The directory layout mirrors the path string passed to defineCommand. [name] directories or files declare params.
  • _root.ts is the optional root command (defineRootCommand).
src/commands/
  _root.ts                      // ''
  s3.ts                         // 's3'
  s3/
    buckets/
      list.ts                   // 's3 buckets list'
      [name].ts                 // 's3 buckets [name]'
      [name]/
        create.ts               // 's3 buckets [name] create'