0.0.9999-alpha-7 • Published 8 months agoCLI
@intellegens/cornerstone-cli
Licence
MIT
Version
0.0.9999-alpha-7
Deps
7
Size
15 kB
Vulns
0
Weekly
0
Cornerstone TypeScript CLI Tool(s)
A command-line interface (CLI) with various utilities. The CLI is built using yargs and supports the following commands:
Getting started
- Install dependencies:
npm install
Available scripts
build: Compiles the TypeScript code
npm run build
cli: Runs the CLI in development mode using tsx
npm run cli <command> [options]
Install and run
npm install -g @intellegens/cornerstone-cli
cornerstone-ts <command> [options]
API reference
Zod Schema Generator
Generates Zod schemas from JSON schema files, preserving namespace structure.
# Development
npm run cli zod-gen --input <input-dir> --output <output-dir>
# After building
./dist/utils/cli/index.js zod-gen --input <input-dir> --output <output-dir>
Options:
--input, -i: Path to the folder containing JSON schemas--output, -o: Path to the folder where Zod schemas will be saved
The command will:
- Read JSON schema files from the input directory
- Create a folder structure matching the type's namespace
- Generate Zod schemas with proper type names
- Save the generated schemas in their respective namespace folders
For example, if you have a JSON schema file named MyCompany.ModuleA.Models.UserDto.json, it will:
- Create directories:
output-dir/MyCompany/ModuleA/Models/ - Generate and save
UserDto.tsin that directory with the Zod schema
OpenAPI Generator
Generates client code from OpenAPI schema files using Orval.
# Development
npm run cli openapi-gen --input <input-file> --output <output-dir> [options]
# After building
./dist/utils/cli/index.js openapi-gen --input <input-file> --output <output-dir> [options]
Options:
--input, -i: Path to the OPENAPI schema .json file--output, -o: Path to the folder where client and types will be saved--prettier, -p: Format generated code with Prettier (default: false)--fetchClient, -f: Generate fetch client (default: false)--angularClient, -a: Generate Angular client (default: false)--zod, -z: Generate Zod schemas (default: false)--mock, -m: Generate mock client (default: false)--clean, -c: Clean output folder (default: true)--project, -pr: Project name (default: 'my-project')--baseUrl, -b: Base URL for the API (default: '')
The command will generate client code based on the selected options. By default, it generates only types; additionally, you can generate fetch client, angular client or zod schemas.