fabien0102 / ts-to-zod

Generate zod schemas from typescript types/interfaces
MIT License
1.22k stars 67 forks source link

Making --help flag work #222

Closed tvillaren closed 7 months ago

tvillaren commented 7 months ago

Why

As described in https://github.com/fabien0102/ts-to-zod/issues/196, the --help flag didn't work anymore. Trying to add tests for oclif, I updated:

Result

Running ts-to-zod --help will output the help information:

Generate Zod schemas from a Typescript file

USAGE
  $ ts-to-zod  --all
  $ ts-to-zod  --config example
  $ ts-to-zod  --config example/person
  $ ts-to-zod  --config config

ARGUMENTS
  INPUT   input file (typescript)
  OUTPUT  output file (zod schemas)

FLAGS
  -a, --all                    Execute all configs
  -c, --config=<option>        Execute one config
                               <options: example|example/person|config>
  -h, --help                   Show CLI help.
  -i, --init                   Create a ts-to-zod.config.js file
  -k, --keepComments           Keep parameters comments
  -v, --version                Show CLI version.
  -w, --watch                  Watch input file(s) for changes and re-run related task
      --inferredTypes=<value>  Path of z.infer<> types file
      --skipParseJSDoc         Skip the creation of zod validators from JSDoc annotations
      --skipValidation         Skip the validation step (not recommended)

DESCRIPTION
  Generate Zod schemas from a Typescript file

EXAMPLES
  $ ts-to-zod src/types.ts src/types.zod.ts

Tests

Tested locally on the project I use ts-to-zod and it does seem to work. Still trying to get @oclif/test to work but I believe we can merge this still