@@ -3,6 +3,7 @@ const rover_helpers = rover.helpers
33const rover_addComponent = rover . addComponents
44const rover_addModules = rover . addModules
55const rover_generateSAM = rover . generateSAM
6+ const rover_addModulesToexisting = rover . addModulesToExisting
67import * as util from "../utilities/cliUtil"
78import * as cliConfig from "../configs/cliConfig"
89import { createModules , roverADD } from "../utilities/helper"
@@ -87,7 +88,6 @@ export async function addComponentCLI() {
8788 )
8889 i = i + 1
8990 } while ( moreStack !== "No" )
90- console . log ( JSON . stringify ( template ) )
9191 await rover_addComponent . addComponents ( template )
9292}
9393export async function addModuleCLI ( ) : Promise < void > {
@@ -123,6 +123,9 @@ export async function addModuleCLI(): Promise<void> {
123123 const moduletemplate = < IroveraddModule > (
124124 await createModules ( app_name , language )
125125 )
126+ Object . keys ( moduletemplate . stackDetails ) . forEach ( ( ele ) => {
127+ moduletemplate . stackDetails [ ele ] . stackName = selectedchoice [ 0 ]
128+ } )
126129 if ( Object . keys ( template ) . length == 0 ) {
127130 template = moduletemplate
128131 } else {
@@ -131,9 +134,6 @@ export async function addModuleCLI(): Promise<void> {
131134 ...moduletemplate . stackDetails ,
132135 }
133136 }
134- Object . keys ( template . stackDetails ) . forEach ( ( ele ) => {
135- template . stackDetails [ ele ] . stackName = selectedchoice [ 0 ]
136- } )
137137 } else {
138138 const choice = cliConfig . customizable . components
139139 const Compnents = < Array < string > > (
@@ -143,21 +143,21 @@ export async function addModuleCLI(): Promise<void> {
143143 if ( customStacks !== null )
144144 template = {
145145 ...template ,
146- file_name,
147146 ...Compnents ,
148147 }
149148 }
150-
151149 moreStack = await util . moreStack (
152- "Do you want to add one more modules to this stack ?"
150+ "Do you want to add one more modules to another stack ?"
153151 )
154-
155152 i = i + 1
156153 } while ( moreStack !== "No" )
154+ template [ "file_name" ] = file_name
155+ console . log ( "template" , JSON . stringify ( template ) )
156+ await rover_addModulesToexisting . addModulesToExistingStack ( template )
157157 } else {
158158 template = < IroveraddModule > await createModules ( app_name , language )
159- template [ "file_name" ] = file_name
160- await rover_addModules . addModules ( template )
159+
160+ console . log ( "template" , JSON . stringify ( template ) )
161+ await rover_addModules . addModules ( template )
161162 }
162-
163163}
0 commit comments