@@ -2,10 +2,9 @@ import 'dotenv/config';
22
33import pkg from "../package.json" with { type : "json" } ;
44
5- // @ts -ignore
6- import { Command } from 'commander' ;
5+ import { Command , } from 'commander' ;
76import { loadConfig , printConfig } from './features/config/index.js' ;
8- import { del , down , typescript , up , type TypescriptConversionOptions } from './features/schema/index.js' ;
7+ import { del , down , typescript , up , type CLI_DeleteType , type CLI_DownType , type CLI_UpType , type TypescriptConversionOptions } from './features/schema/index.js' ;
98
109main ( ) . catch ( ( error ) => {
1110 console . error ( "Error: " + error . message ) ;
@@ -23,8 +22,8 @@ async function main() {
2322 program
2423 . command ( "config" )
2524 . description ( "Returns the current configuration" )
26- . action ( async ( ) => {
27- await loadConfig ( program . opts ( ) . configPath ) ;
25+ . action ( ( ) => {
26+ loadConfig ( program . opts ( ) . configPath ) ;
2827
2928 printConfig ( ) ;
3029 } ) ;
@@ -38,8 +37,8 @@ async function main() {
3837 )
3938 . option ( "--ignore <ignore...>" , "Class(es) to ignore" , "" )
4039 . description ( "Fetch the schema from Parse Server" )
41- . action ( async ( schemaPath : string , options : { prefix ?: string ; ignore ?: string [ ] ; } | undefined ) => {
42- await loadConfig ( program . opts ( ) . configPath , {
40+ . action ( async ( schemaPath : string , options : CLI_DownType | undefined ) => {
41+ loadConfig ( program . opts ( ) . configPath , {
4342 operation : "down" ,
4443 } ) ;
4544
@@ -57,8 +56,8 @@ async function main() {
5756 . option ( "--safe" , "This will prevent destructive operations" , "" )
5857 . option ( "--deleteNonEmptyClass" , "Delete non-empty classes" , false )
5958 . description ( "Upload the local schema to Parse Server" )
60- . action ( async ( schemaPath : string , options : { prefix : any ; ignore : any ; safe : any ; deleteNonEmptyClass : any ; } ) => {
61- await loadConfig ( program . opts ( ) . configPath , {
59+ . action ( async ( schemaPath : string , options : CLI_UpType ) => {
60+ loadConfig ( program . opts ( ) . configPath , {
6261 operation : "up" ,
6362 } ) ;
6463
@@ -80,8 +79,8 @@ async function main() {
8079 )
8180 . option ( "--deleteNonEmptyClass" , "Delete non-empty classes" , false )
8281 . description ( "Delete the local schema from Parse Server" )
83- . action ( async ( schemaPath : string , options : { prefix ?: string ; deleteNonEmptyClass ?: boolean ; } | undefined ) => {
84- await loadConfig ( program . opts ( ) . configPath ) ;
82+ . action ( async ( schemaPath : string , options : CLI_DeleteType | undefined ) => {
83+ loadConfig ( program . opts ( ) . configPath ) ;
8584
8685 await del ( schemaPath , options ) ;
8786 } ) ;
@@ -100,7 +99,7 @@ async function main() {
10099 . option ( "--custom-class-field-types-config <path>" , "Path to .json config file for custom class field types" )
101100 . option ( "--verbose" , "Enable verbose logging including dependency graph" , false )
102101 . action ( async ( typescriptPath : string , options : TypescriptConversionOptions | undefined ) => {
103- await loadConfig ( program . opts ( ) . configPath ) ;
102+ loadConfig ( program . opts ( ) . configPath ) ;
104103
105104 await typescript ( typescriptPath , options ) ;
106105 } ) ;
0 commit comments