@@ -19,43 +19,49 @@ export default class MakeEtl extends BaseCommand {
1919
2020 async run ( ) {
2121 // Ask which ETL components to create
22- const components = await this . prompt . multiple ( 'Which ETL components do you want to create?' , [
23- 'Source ' ,
24- ' Transform',
25- 'Destination'
26- ] , {
27- validate : ( value ) => {
28- if ( ! value || value . length === 0 ) {
29- return 'You must select at least one component'
30- }
31- return true
22+ const components = await this . prompt . multiple (
23+ 'Which ETL components do you want to create? ' ,
24+ [ 'Source' , ' Transform', 'Destination' ] ,
25+ {
26+ validate : ( value ) => {
27+ if ( ! value || value . length === 0 ) {
28+ return 'You must select at least one component'
29+ }
30+ return true
31+ } ,
3232 }
33- } )
33+ )
3434
3535 // Ask for source details if source is selected
3636 let sourceDetails = null
3737 if ( components . includes ( 'Source' ) || components . includes ( 'Transform' ) ) {
38- sourceDetails = await this . prompt . ask ( 'What is the source type? (e.g., database, api, file)' , {
39- validate : ( value ) => {
40- if ( ! value || value . trim ( ) . length === 0 ) {
41- return 'Source type is required'
42- }
43- return true
38+ sourceDetails = await this . prompt . ask (
39+ 'What is the source type? (e.g., database, api, file)' ,
40+ {
41+ validate : ( value ) => {
42+ if ( ! value || value . trim ( ) . length === 0 ) {
43+ return 'Source type is required'
44+ }
45+ return true
46+ } ,
4447 }
45- } )
48+ )
4649 }
4750
4851 // Ask for destination details if destination is selected
4952 let destinationDetails = null
5053 if ( components . includes ( 'Destination' ) || components . includes ( 'Transform' ) ) {
51- destinationDetails = await this . prompt . ask ( 'What is the destination type? (e.g., database, api, file)' , {
52- validate : ( value ) => {
53- if ( ! value || value . trim ( ) . length === 0 ) {
54- return 'Destination type is required'
55- }
56- return true
54+ destinationDetails = await this . prompt . ask (
55+ 'What is the destination type? (e.g., database, api, file)' ,
56+ {
57+ validate : ( value ) => {
58+ if ( ! value || value . trim ( ) . length === 0 ) {
59+ return 'Destination type is required'
60+ }
61+ return true
62+ } ,
5763 }
58- } )
64+ )
5965 }
6066
6167 const codemods = await this . createCodemods ( )
@@ -65,30 +71,30 @@ export default class MakeEtl extends BaseCommand {
6571 for ( const component of components ) {
6672 if ( component === 'Source' ) {
6773 className = [
68- string . snakeCase ( this . name ) ,
69- string . snakeCase ( sourceDetails ! ) ,
70- 'source ' ,
71- ] . join ( '_ ' )
74+ string . pascalCase ( this . name ) ,
75+ string . pascalCase ( sourceDetails ! ) ,
76+ 'Source ' ,
77+ ] . join ( '' )
7278 } else if ( component === 'Destination' ) {
7379 className = [
74- string . snakeCase ( this . name ) ,
75- string . snakeCase ( destinationDetails ! ) ,
76- 'destination ' ,
77- ] . join ( '_ ' )
80+ string . pascalCase ( this . name ) ,
81+ string . pascalCase ( destinationDetails ! ) ,
82+ 'Destination ' ,
83+ ] . join ( '' )
7884 } else if ( component === 'Transform' ) {
7985 className = [
80- string . snakeCase ( this . name ) ,
81- string . snakeCase ( sourceDetails ! ) ,
82- 'to ' ,
83- string . snakeCase ( destinationDetails ! ) ,
84- 'transform ' ,
85- ] . join ( '_ ' )
86+ string . pascalCase ( this . name ) ,
87+ string . pascalCase ( sourceDetails ! ) ,
88+ 'To ' ,
89+ string . pascalCase ( destinationDetails ! ) ,
90+ 'Transform ' ,
91+ ] . join ( '' )
8692 }
8793
8894 const stubPath = `make/etl/${ component . toLowerCase ( ) } s/main.ts.stub`
8995
9096 await codemods . makeUsingStub ( stubsRoot , stubPath , {
91- className
97+ className,
9298 } )
9399 }
94100
0 commit comments